condition-set.php 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <style>
  2. .table-body {
  3. padding: 20px 20px;
  4. background-color: #fff;
  5. }
  6. .table-body .top-input {
  7. margin-top: 34px;
  8. }
  9. .input-item {
  10. width: 200px;
  11. margin-right: 20px;
  12. }
  13. .input-item .el-input__inner {
  14. border-right: 0;
  15. }
  16. .input-item .el-input__inner:hover {
  17. border: 1px solid #dcdfe6;
  18. border-right: 0;
  19. outline: 0;
  20. }
  21. .input-item .el-input__inner:focus {
  22. border: 1px solid #dcdfe6;
  23. border-right: 0;
  24. outline: 0;
  25. }
  26. .input-item .el-input-group__append {
  27. background-color: #fff;
  28. border-left: 0;
  29. width: 10%;
  30. padding: 0;
  31. }
  32. .input-item .el-input-group__append .el-button {
  33. padding: 0;
  34. }
  35. .input-item .el-input-group__append .el-button {
  36. margin: 0;
  37. }
  38. /* #app .table-body .el-table .el-button {
  39. border-radius: 16px;
  40. } */
  41. .create {
  42. height: 36px;
  43. line-height: 36px;
  44. float: right;
  45. color: #BCBCBC;
  46. margin-left: 20px;
  47. }
  48. .name {
  49. cursor: pointer;
  50. color: #49A9FF;
  51. }
  52. /* 卡片 */
  53. .plugin-list {
  54. margin: 0 0 0 -20px;
  55. /* padding-right: 100px; */
  56. display: flex;
  57. flex-wrap: wrap;
  58. }
  59. .plugin-list .plugin-item {
  60. width: 20%;
  61. min-width: 400px;
  62. }
  63. .plugin-item {
  64. border: 1px solid #ebebeb;
  65. background: #FFFFFF;
  66. box-shadow: 3px 5px 15px rgba(80, 80, 80, 0.16);
  67. opacity: 1;
  68. border-radius: 5px;
  69. padding: 20px;
  70. margin: 0 0 20px 20px;
  71. transition: 250ms;
  72. position: relative;
  73. /* min-width: 300px; */
  74. }
  75. .plugin-item .item-status {
  76. position: absolute;
  77. top: 0;
  78. right: 0;
  79. width: 94px;
  80. height: 30px;
  81. background: #E8EAEC;
  82. opacity: 1;
  83. border-radius: 0px 5px 0px 5px;
  84. font-size: 14px;
  85. font-family: Microsoft YaHei;
  86. font-weight: 400;
  87. line-height: 30px;
  88. color: #9398A4;
  89. text-align: center;
  90. }
  91. .item-status-permanent {
  92. width: 94px;
  93. }
  94. .item-status-effective {
  95. width: 164px;
  96. }
  97. .plugin-item .item-info {
  98. display: flex;
  99. align-items: center;
  100. }
  101. /* .plugin-item .item-info .item-right{
  102. min-width: 500px;
  103. } */
  104. .plugin-item .item-btns {
  105. display: flex;
  106. align-items: center;
  107. justify-content: flex-end;
  108. margin-top: 12px;
  109. }
  110. .plugin-item .mall-logo {
  111. width: 70px;
  112. height: 70px;
  113. margin-right: 12px;
  114. }
  115. .plugin-item .mall-logo img {
  116. width: 100%;
  117. height: 100%;
  118. display: block;
  119. border-radius: 50%;
  120. }
  121. .plugin-item .display-name {
  122. font-size: 18pt;
  123. margin-top: 10px;
  124. margin-bottom: 4px;
  125. font-family: Microsoft YaHei;
  126. font-weight: bold;
  127. line-height: 30px;
  128. color: #3F495D;
  129. opacity: 1;
  130. width: 200px;
  131. white-space: nowrap;
  132. overflow: hidden;
  133. text-overflow: ellipsis;
  134. }
  135. .plugin-item .name {
  136. color: #909399;
  137. }
  138. .plugin-item:hover {
  139. cursor: pointer;
  140. border-color: #bfddff;
  141. }
  142. /* .plugin-item:hover .display-name {
  143. color: #409EFF;
  144. } */
  145. .plugin-item .plugin-option-btn {
  146. height: 25px;
  147. width: 25px;
  148. font-size: 12px;
  149. padding: 0;
  150. }
  151. .plugin-item .detail-option.detail-option {
  152. color: #909399;
  153. background: #F2F6FC;
  154. }
  155. .plugin-item .detail-option:hover {
  156. color: #fff;
  157. background: #909399;
  158. }
  159. .feature-item input{
  160. appearance: auto;
  161. }
  162. .feature-item .radio-inline{
  163. display: flex;
  164. align-items: center;
  165. }
  166. .feature-item{
  167. display: flex;
  168. }
  169. .feature-item input[type="radio" i]{
  170. margin-top: 0;
  171. }
  172. </style>
  173. <div id="app" v-cloak>
  174. <el-card shadow="never" style="border:0;min-width: 1200px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  175. <div slot="header">
  176. <div>
  177. <span>设置升级条件</span>
  178. </div>
  179. </div>
  180. <div class="table-body">
  181. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" @close="handleClose('ruleForm')">
  182. <el-form-item label="升级条件" :label-width="formLabelWidth" prop="level">
  183. <template>
  184. <el-checkbox-group v-model="ruleForm.checked_condition_keys" class="check-group">
  185. <div style="margin-top: 20px" v-for="item in upgrade_condition">
  186. <el-checkbox :label="item.id" v-model="item.id" border size="medium">
  187. <div v-if="!item.is_html">{{item.content}}</div>
  188. <div v-else v-html="item.content" class="feature-item"></div>
  189. </el-checkbox>
  190. </div>
  191. </el-checkbox-group>
  192. </template>
  193. </el-form-item>
  194. <el-form-item prop="compute_type" :label-width="formLabelWidth" label="结算方式">
  195. <el-radio-group v-model="ruleForm.compute_type" size="small">
  196. <el-radio :label="1" border>订单支付后</el-radio>
  197. <el-radio :label="2" border>订单完成后</el-radio>
  198. </el-radio-group>
  199. </el-form-item>
  200. <el-form-item prop="level_down" :label-width="formLabelWidth" label="是否开启降级">
  201. <el-switch v-model="ruleForm.level_down" :active-value="1" :inactive-value="0"></el-switch>
  202. <div class="notice">启用后将会根据符合条件进行降级</div>
  203. </el-form-item>
  204. </el-form>
  205. <div slot="footer" class="dialog-footer">
  206. <el-button type="primary" @click="postAdd('ruleForm')">确 定</el-button>
  207. </div>
  208. </div>
  209. </el-card>
  210. </div>
  211. <script>
  212. new Vue({
  213. el: '#app',
  214. data() {
  215. return {
  216. activeName: "1",
  217. tableData: [],
  218. rules: {
  219. },
  220. upgrade_condition:[],
  221. ruleForm: {
  222. checked_condition_keys:[1,2],
  223. compute_type:1,
  224. level_down: 0,
  225. },
  226. formLabelWidth: '150px',
  227. is_set_condition: true,
  228. }
  229. },
  230. created() {
  231. this.getList();
  232. },
  233. methods: {
  234. postAdd(formName) {
  235. this.$refs[formName].validate((valid) => {
  236. if (valid) {
  237. this.$request({
  238. method: "post",
  239. params: {
  240. r: 'mall/user-level/condition-set',
  241. },
  242. data: this.ruleForm
  243. }).then(e => {
  244. if (e.data.code == 0) {
  245. this.$message({
  246. message: e.data.msg,
  247. type: 'success'
  248. });
  249. // navigateTo({
  250. // r: 'mall/user-level/index',
  251. // })
  252. }else{
  253. this.$message.error(e.data.msg);
  254. }
  255. }).catch(e => {});
  256. }
  257. });
  258. },
  259. getList(){
  260. this.$request({
  261. params: {
  262. r: 'mall/user-level/condition-set',
  263. },
  264. }).then(e => {
  265. if(e.data.code==0){
  266. this.upgrade_condition = e.data.data.upgrade_condition;
  267. this.ruleForm.compute_type = e.data.data.compute_type;
  268. this.ruleForm.checked_condition_keys = e.data.data.checked_condition_keys
  269. this.ruleForm.level_down = e.data.data.level_down ?? 0;
  270. }else{
  271. this.$message.error(e.data.msg);
  272. }
  273. console.log(e.data.data);
  274. }).catch(e => {});
  275. },
  276. goodsSelect(){
  277. },
  278. picUrl(e) {
  279. if (e.length) {
  280. this.ruleForm.pic_url = e[0].url;
  281. this.$refs.ruleForm.validateField('pic_url');
  282. }
  283. },
  284. },
  285. });
  286. </script>