Browse Source

商品返现

YY 2 năm trước cách đây
mục cha
commit
9aecb82feb
3 tập tin đã thay đổi với 18 bổ sung34 xóa
  1. 2 24
      README.md
  2. 8 5
      src/views/platmanag/goods/index.vue
  3. 8 5
      src/views/selfShop/goods/index.vue

+ 2 - 24
README.md

@@ -1,24 +1,2 @@
-# web-admin
-
-## Project setup
-```
-npm install
-```
-
-### Compiles and hot-reloads for development
-```
-npm run serve
-```
-
-### Compiles and minifies for production
-```
-npm run build
-```
-
-### Lints and fixes files
-```
-npm run lint
-```
-
-### Customize configuration
-See [Configuration Reference](https://cli.vuejs.org/config/).
+https://broadcast.waityou24.cn/shoppingAdminDev/
+https://broadcast.waityou24.cn/shoppingAdmin/

+ 8 - 5
src/views/platmanag/goods/index.vue

@@ -48,20 +48,20 @@
               <el-option v-for="i in statusList" :key="i.value" :label="i.label" :value="i.value"></el-option>
             </template>
             <template #cb_config>
-              <el-form :model="cb_config" ref="cb_config" label-width="180px" @save="toSave">
+              <el-form :model="cb_config" ref="cb_config" label-width="180px" @save="toSave" v-if="form.is_cashBack == '0'">
                 <el-col :span="24">
                   <el-form-item label="返现金额类型" prop="back_type">
                     <el-select v-model="cb_config.back_type" clearable filterable placeholder="请选择返现金额类型" size="small" style="width: 100%">
-                      <el-option v-for="i in typeList" :key="i.label" :label="i.label" :value="i.label"> </el-option>
+                      <el-option v-for="i in typeList" :key="i.value" :label="i.label" :value="i.value"> </el-option>
                     </el-select>
                   </el-form-item>
                 </el-col>
-                <el-col :span="24" v-if="cb_config.back_type == '固定金额'">
+                <el-col :span="24" v-if="cb_config.back_type == 'fixed'">
                   <el-form-item label="具体返现金额设置" prop="money">
                     <el-input v-model="cb_config.money" placeholder="请输入金额" type="number" size="small"></el-input>
                   </el-form-item>
                 </el-col>
-                <el-col :span="24" v-if="cb_config.back_type == '百分比'">
+                <el-col :span="24" v-if="cb_config.back_type == 'percent'">
                   <el-form-item label="具体返现金额设置" prop="money">
                     <el-input v-model="cb_config.money" placeholder="请输入百分比" type="number" size="small"></el-input>
                   </el-form-item>
@@ -196,7 +196,7 @@ export default {
       const res = await this.fetch(data._id);
       if (this.$checkRes(res)) {
         this.$set(this, `form`, res.data);
-        this.cb_config = res.data.cb_config;
+        if (res.data.cb_config) this.cb_config = res.data.cb_config;
         if (data.shop) {
           let list = [];
           let res = await this.shopFetch(data.shop._id);
@@ -275,6 +275,9 @@ export default {
       // 是否返现
       res = await this.getDict({ code: 'use' });
       if (this.$checkRes(res)) this.$set(this, `statusList`, res.data);
+      // 返现金额类型
+      res = await this.getDict({ code: 'cashBack_type' });
+      if (this.$checkRes(res)) this.$set(this, `typeList`, res.data);
     },
     // 商品状态
     getStatus(data) {

+ 8 - 5
src/views/selfShop/goods/index.vue

@@ -54,20 +54,20 @@
               <el-option v-for="i in statusList" :key="i.value" :label="i.label" :value="i.value"></el-option>
             </template>
             <template #cb_config>
-              <el-form :model="cb_config" ref="cb_config" label-width="180px" @save="toSave">
+              <el-form :model="cb_config" ref="cb_config" label-width="180px" @save="toSave" v-if="form.is_cashBack == '0'">
                 <el-col :span="24">
                   <el-form-item label="返现金额类型" prop="back_type">
                     <el-select v-model="cb_config.back_type" clearable filterable placeholder="请选择返现金额类型" size="small" style="width: 100%">
-                      <el-option v-for="i in typeList" :key="i.label" :label="i.label" :value="i.label"> </el-option>
+                      <el-option v-for="i in typeList" :key="i.value" :label="i.label" :value="i.value"> </el-option>
                     </el-select>
                   </el-form-item>
                 </el-col>
-                <el-col :span="24" v-if="cb_config.back_type == '固定金额'">
+                <el-col :span="24" v-if="cb_config.back_type == 'fixed'">
                   <el-form-item label="具体返现金额设置" prop="money">
                     <el-input v-model="cb_config.money" placeholder="请输入金额" type="number" size="small"></el-input>
                   </el-form-item>
                 </el-col>
-                <el-col :span="24" v-if="cb_config.back_type == '百分比'">
+                <el-col :span="24" v-if="cb_config.back_type == 'percent'">
                   <el-form-item label="具体返现金额设置" prop="money">
                     <el-input v-model="cb_config.money" placeholder="请输入百分比" type="number" size="small"></el-input>
                   </el-form-item>
@@ -185,7 +185,7 @@ export default {
       const res = await this.fetch(data._id);
       if (this.$checkRes(res)) {
         this.$set(this, `form`, res.data);
-        this.cb_config = res.data.cb_config;
+        if (res.data.cb_config) this.cb_config = res.data.cb_config;
         this.view = 'info';
       } else {
         this.$message.error('未找到指定数据');
@@ -281,6 +281,9 @@ export default {
       // 是否返现
       res = await this.getDict({ code: 'use' });
       if (this.$checkRes(res)) this.$set(this, `statusList`, res.data);
+      // 返现金额类型
+      res = await this.getDict({ code: 'cashBack_type' });
+      if (this.$checkRes(res)) this.$set(this, `typeList`, res.data);
     },
     // 商品状态
     getStatus(data) {