cgp 2 недель назад
Родитель
Сommit
005d64fe42

+ 7 - 0
src/api/hisStore/collection.js

@@ -69,6 +69,13 @@ export function getWxaCodeCollectionUnLimit(collectionId,appId) {
   })
 }
 
+export function getWxaCodeCollectionUnLimitNew(collectionId,appId) {
+  return request({
+    url: '/hisStore/collection/getWxaCodeCollectionUnLimitNew/'+collectionId+"/"+appId,
+    method: 'get',
+  })
+}
+
 export function getSalesHasCollectionPermission() {
   return request({
     url: '/hisStore/collection/getSalesHasCollectionPermission',

+ 9 - 0
src/api/qw/collectionPendingSales.js

@@ -59,3 +59,12 @@ export function getLastAuditPassPrescribeInfo(userId) {
     params: { userId }
   })
 }
+
+// 查询个微采集套餐包信息
+export function getCollectionPackageInfo(collectionId) {
+  return request({
+    url: '/hisStore/collection/getCollectionPackageInfo',
+    method: 'get',
+    params: { collectionId }
+  })
+}

+ 44 - 49
src/views/qw/collectionFully/BindPackageDialog.vue

@@ -1,25 +1,20 @@
 <template>
   <el-dialog
-    title="绑定套餐"
+    :title="isEdit ? '编辑套餐' : '绑定套餐'"
     :visible.sync="dialogVisible"
     width="500px"
     append-to-body
     @close="handleClose"
   >
     <el-form ref="form" :model="form" :rules="rules" label-width="100px">
-      <el-form-item label="小程序" prop="appId">
-        <el-select v-model="form.appId" placeholder="请选择小程序" clearable>
-          <el-option
-            v-for="item in sourceList"
-            :key="item.dictValue1"
-            :label="item.dictLabel"
-            :value="item.dictValue1"
-          />
-        </el-select>
-      </el-form-item>
-
       <el-form-item label="套餐包" prop="packageId">
-        <el-select v-model="form.packageId" placeholder="请选择套餐包" clearable filterable>
+        <el-select
+          v-model="form.packageId"
+          placeholder="请选择套餐包"
+          clearable
+          filterable
+          :disabled="isEdit"
+        >
           <el-option
             v-for="item in packageOptions"
             :key="item.dictValue"
@@ -57,9 +52,8 @@
 </template>
 
 <script>
-import { allPrivatePackage } from "@/api/store/package";
-import { options } from "@/api/course/coursePlaySourceConfig";
-import { bindCollectionPackage } from "@/api/qw/collectionPendingSales";
+import {allPrivatePackage} from "@/api/store/package";
+import {bindCollectionPackage} from "@/api/qw/collectionPendingSales";
 
 export default {
   name: "BindPackageDialog",
@@ -73,36 +67,42 @@ export default {
       type: Number,
       default: null,
     },
+    // 编辑时传入的数据 { packageId, payType, amount }
+    editData: {
+      type: Object,
+      default: null,
+    },
   },
   data() {
     return {
       dialogVisible: false,
       submitLoading: false,
-      sourceList: [],
       packageOptions: [],
       form: {
-        id: null,          // 采集信息主键
-        appId: null,
+        id: null,
         packageId: null,
-        payType: 1,        // 默认全款
+        payType: 1,
         amount: null,
       },
       rules: {
-        appId: [
-          { required: true, message: "请选择小程序", trigger: "change" },
-        ],
         packageId: [
-          { required: true, message: "请选择套餐包", trigger: "change" },
+          {required: true, message: "请选择套餐包", trigger: "change"},
         ],
         payType: [
-          { required: true, message: "请选择支付类型", trigger: "change" },
+          {required: true, message: "请选择支付类型", trigger: "change"},
         ],
         amount: [
-          { required: true, message: "请填写物流代收金额", trigger: "blur" },
+          {required: true, message: "请填写物流代收金额", trigger: "blur"},
         ],
       },
+      originalPackageId: null, // 编辑模式下保留的原套餐包ID
     };
   },
+  computed: {
+    isEdit() {
+      return this.editData !== null;
+    },
+  },
   watch: {
     visible: {
       handler(val) {
@@ -114,7 +114,6 @@ export default {
       immediate: true,
     },
     "form.payType"(val) {
-      // 切换支付类型时,重置金额字段
       if (val !== 2) {
         this.form.amount = null;
         this.$refs.form?.clearValidate("amount");
@@ -122,15 +121,9 @@ export default {
     },
   },
   created() {
-    this.fetchSourceList();
     this.fetchPackageList();
   },
   methods: {
-    fetchSourceList() {
-      options().then((res) => {
-        this.sourceList = res.data || [];
-      });
-    },
     fetchPackageList() {
       allPrivatePackage().then((res) => {
         this.packageOptions = res.rows || [];
@@ -138,10 +131,18 @@ export default {
     },
     initData() {
       this.form.id = this.collectionId;
-      this.form.appId = null;
-      this.form.packageId = null;
-      this.form.payType = 1;
-      this.form.amount = null;
+      if (this.isEdit) {
+        // 编辑模式:保留原套餐包ID(用于提交),表单中套餐包下拉框置空(不可选)
+        this.originalPackageId = this.editData.packageId;
+        this.form.packageId = null;
+        this.form.payType = this.editData.payType;
+        this.form.amount = this.editData.amount;
+      } else {
+        this.originalPackageId = null;
+        this.form.packageId = null;
+        this.form.payType = 1;
+        this.form.amount = null;
+      }
       this.$nextTick(() => {
         if (this.$refs.form) {
           this.$refs.form.clearValidate();
@@ -152,26 +153,24 @@ export default {
       this.$refs.form.validate((valid) => {
         if (!valid) return;
 
-        // 构建提交参数,与后端 bindCollectionPackageParam 对应
         const params = {
           id: this.form.id,
-          packageId: this.form.packageId,
-          // 以下字段根据实际接口是否需要传递决定,若不需要可省略
-          // appId: this.form.appId,
-          // payType: this.form.payType,
-          // amount: this.form.amount,
+          // 编辑模式下使用原套餐包ID,新增模式下使用表单选择的套餐包ID
+          packageId: this.isEdit ? this.originalPackageId : this.form.packageId,
+          payType: this.form.payType,
+          amount: this.form.amount,
         };
 
         this.submitLoading = true;
         bindCollectionPackage(params)
           .then((res) => {
-            this.$message.success("绑定套餐成功");
+            this.$message.success(this.isEdit ? "修改成功" : "绑定成功");
             this.dialogVisible = false;
             this.$emit("success", res.data);
             this.$emit("update:visible", false);
           })
           .catch((error) => {
-            this.$message.error(error.msg || "绑定失败");
+            this.$message.error(error.msg || (this.isEdit ? "修改失败" : "绑定失败"));
           })
           .finally(() => {
             this.submitLoading = false;
@@ -186,7 +185,3 @@ export default {
   },
 };
 </script>
-
-<style scoped>
-/* 可根据需要添加样式 */
-</style>