zory 1 день назад
Родитель
Сommit
237dc944b5
2 измененных файлов с 35 добавлено и 7 удалено
  1. 7 0
      src/api/model/merPlan.js
  2. 28 7
      src/views/merchant/cps/index/components/edit.vue

+ 7 - 0
src/api/model/merPlan.js

@@ -23,6 +23,13 @@ export default {
             return await http.post(this.url, params);
             return await http.post(this.url, params);
         },
         },
     },
     },
+    goods: {
+        url: `${config.API_URL}/merchant/plan/goods`,
+        name: "-",
+        post: async function (params) {
+            return await http.post(this.url, params);
+        },
+    },
     update: {
     update: {
         url: `${config.API_URL}/merchant/plan/update`,
         url: `${config.API_URL}/merchant/plan/update`,
         name: "-",
         name: "-",

+ 28 - 7
src/views/merchant/cps/index/components/edit.vue

@@ -85,13 +85,6 @@
                                         <div class="status-danger" v-if="scope.row.goods.status==0"><sc-status-indicator type="danger"></sc-status-indicator> 审核中</div>
                                         <div class="status-danger" v-if="scope.row.goods.status==0"><sc-status-indicator type="danger"></sc-status-indicator> 审核中</div>
                                     </template>
                                     </template>
                                 </el-table-column>
                                 </el-table-column>
-                                <el-table-column label="操作" width="100" align="left" fixed="right">
-                                    <template #default="scope">
-                                        <el-button-group>
-                                            <el-button type="danger" size="small" @click="aloneSave(scope.row)">保存</el-button>
-                                        </el-button-group>
-                                    </template>
-                                </el-table-column>
                             </scTable>
                             </scTable>
                         </div>
                         </div>
                     </el-form-item>
                     </el-form-item>
@@ -191,6 +184,7 @@
             </el-main>
             </el-main>
             <el-footer>
             <el-footer>
                 <el-button @click="visible=false" size="large">取 消</el-button>
                 <el-button @click="visible=false" size="large">取 消</el-button>
+                <el-button size="large" type="primary" :loading="isSaveing" @click="submitRate()">保 存</el-button>
             </el-footer>
             </el-footer>
         </el-container>
         </el-container>
     </el-drawer>
     </el-drawer>
@@ -228,6 +222,14 @@ export default {
             this.starData = []
             this.starData = []
             this.getDetail()
             this.getDetail()
         },
         },
+        async aloneSave(data){
+            var loading = this.$loading()
+            var resp = await this.$API.merPlan.goods.post({"id":this.formData.id,"commission_rate":data.commission_rate,"goods_id":data.goods.goods_id})
+            loading.close();
+            if (resp.code == 0) return this.$message.error(resp.msg);
+            this.$message.success(resp.msg);
+            this.getDetail()
+        },
         async getDetail(){
         async getDetail(){
             this.loading = true;
             this.loading = true;
             var resp = await this.$API.merPlan.detail.get({"id":this.formData.id});
             var resp = await this.$API.merPlan.detail.get({"id":this.formData.id});
@@ -253,6 +255,25 @@ export default {
             const rateMoney = this.$TOOL.moneyFormat(parseFloat(goods.commission_rate) * goods.goods.price / 100);
             const rateMoney = this.$TOOL.moneyFormat(parseFloat(goods.commission_rate) * goods.goods.price / 100);
             this.goodsData[index].rate_money = rateMoney;
             this.goodsData[index].rate_money = rateMoney;
         },
         },
+        async submitRate(){
+            const formData = {};
+            if (this.mode == 'star') {
+                formData.data = JSON.stringify(this.starData);
+            }
+            if (this.mode == 'goods') {
+                formData.data = JSON.stringify(this.goodsData);
+            }
+            formData.id = this.formData.id;
+            formData.type = this.mode
+            var loading = this.$loading()
+            this.isSaveing = true;
+            var resp = await this.$API.merPlan.goods.post(formData)
+            this.isSaveing = false;
+            loading.close();
+            if (resp.code == 0) return this.$message.error(resp.msg);
+            this.$message.success(resp.msg);
+            this.getDetail()
+        }
     }
     }
 }
 }
 </script>
 </script>