From 6e1233cbc2b26ec89ef2c5210714afb0ea5a4a6c Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Thu, 8 Jan 2026 10:40:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=85=B3=E8=81=94=E6=94=BF?= =?UTF-8?q?=E7=AD=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.production | 2 +- .../productService/components/addPolicy.vue | 3 +- .../productService/components/addProduct.vue | 299 ++++++++++-------- 3 files changed, 166 insertions(+), 138 deletions(-) diff --git a/.env.production b/.env.production index 31f1a15..b7af1a3 100644 --- a/.env.production +++ b/.env.production @@ -2,5 +2,5 @@ ENV = 'production' # base api -VUE_APP_BASE_API = +VUE_APP_BASE_API = / #VUE_APP_BASE_DEV_API = https://yybtest.ali251.langye.net/ diff --git a/src/views/productService/components/addPolicy.vue b/src/views/productService/components/addPolicy.vue index 7842b09..9df0393 100644 --- a/src/views/productService/components/addPolicy.vue +++ b/src/views/productService/components/addPolicy.vue @@ -103,7 +103,8 @@ export default { auto_fee:'自动扣除佣金', auto_refund_fee:'自动反佣', manually_refund_fee:'手工返佣', - auto_finish:'自动核销' + auto_finish:'自动核销', + auto_return_by_due_date:'超过预产期指定时间自动退单' }, detail:{}, diff --git a/src/views/productService/components/addProduct.vue b/src/views/productService/components/addProduct.vue index 297d7d8..4436f9e 100644 --- a/src/views/productService/components/addProduct.vue +++ b/src/views/productService/components/addProduct.vue @@ -78,62 +78,73 @@ - - - - - 产品类型: - - - 新增 - - - - - - 删除 - - - - - - - - - - - *是否可购买: - - - - - - - - + + + + 关联政策: + + + + + + + + + + + + 产品类型: + + + 新增 + + + + + + 删除 + + + + + + + + + + + *是否可购买: + + + + + + + + @@ -241,7 +252,7 @@ 内容: - + @@ -249,10 +260,10 @@ - - - - 查询 + + + + 查询 @@ -273,12 +284,15 @@ import { index as merchantIndex } from '@/api/merchant' + import { + index as policyIndex + } from '@/api/policy' import { Message } from 'element-ui' - // import tinymce from "@/components/Tinymce" - import xyTinymce from "@/components/XyTinymce/index.vue"; + // import tinymce from "@/components/Tinymce" + import xyTinymce from "@/components/XyTinymce/index.vue"; import {replaceAll} from "@/utils/index" export default { components: { @@ -291,7 +305,7 @@ return { id: '', isShow: false, - type: 'add', + type: 'add', sortnumberNew:'', action: `${process.env.VUE_APP_BASE_API}api/admin/upload-file`, pickerOptions: { @@ -313,20 +327,21 @@ } }] }, - productTypeName:'', - modelTable:[ - { - label: "产品名称", - customFn: (row, scope) => { - return ( - - ); - }, - } + productTypeName:'', + policies: [], + modelTable:[ + { + label: "产品名称", + customFn: (row, scope) => { + return ( + + ); + }, + } ], form: { name: '', @@ -334,8 +349,9 @@ merchantId: '', shopIds: '', productTypePid: '', - productTypeId: '', - model:[], + productTypeId: '', + policy_id: '', + model:[], can_buy:1, originalPrice: '', price: '', @@ -416,31 +432,31 @@ key: 'state', sortable: true } - ], + ], merchantKeyword:"", merchantIndex: 1, merchantTotal: 0, } }, - methods: { - changeProductTypeId(e){ - if(e){ - this.products.map(item=>{ - if(item.id===e){ - this.productTypeName = item.name - } - }) - } + methods: { + changeProductTypeId(e){ + if(e){ + this.products.map(item=>{ + if(item.id===e){ + this.productTypeName = item.name + } + }) + } }, async getDetail() { const res = await show({ id: this.id }) - this.typeChange(res?.product_type_pid) - this.products.map(item=>{ - if(item.id===res.product_type_id){ - this.productTypeName = item.name - } + this.typeChange(res?.product_type_pid) + this.products.map(item=>{ + if(item.id===res.product_type_id){ + this.productTypeName = item.name + } }) this.form = { name: res?.name, @@ -452,10 +468,11 @@ }, shopIds: res?.shop_ids, productTypePid: res?.product_type_pid, - productTypeId: res?.product_type_id, - model:res.model?JSON.parse(res.model):[], + productTypeId: res?.product_type_id, + policy_id: res?.policy_id || '', + model:res.model?JSON.parse(res.model):[], can_buy:res?.can_buy, - originalPrice: res?.original_price, + originalPrice: res?.original_price, price: res?.price, fee: res?.fee, @@ -466,7 +483,7 @@ time: [res?.start_time, res?.end_time], sortnumber: res?.sortnumber, content: res?.content - } + } console.log("form",this.form) // this.$refs['tinymce'].setContent(this.form.content || ' ') }, @@ -504,14 +521,21 @@ async getMerchants() { const res = await merchantIndex({ page_size: 10, - page: this.merchantIndex, + page: this.merchantIndex, keyword:this.merchantKeyword }) this.merchantTotal = res.total this.merchants = res.data - }, - searchMerchants(){ - this.getMerchants() + }, + async getPolicies() { + const res = await policyIndex({ + page_size: 999, + page: 1 + }) + this.policies = res.data || res.rows || [] + }, + searchMerchants(){ + this.getMerchants() }, merchantPageChange(e) { this.merchantIndex = e @@ -524,19 +548,19 @@ } }, - // replaceAll(str,before,after){ - - // if(str.indexOf(before) != -1){ - // return str.replace(new RegExp(before, 'g'),after) - // }else{ - // return str - // } - // }, - async updateSortNumber(){ - await this.getDetail() - this.form.sortnumber = this.sortnumberNew - await this.submit() - + // replaceAll(str,before,after){ + + // if(str.indexOf(before) != -1){ + // return str.replace(new RegExp(before, 'g'),after) + // }else{ + // return str + // } + // }, + async updateSortNumber(){ + await this.getDetail() + this.form.sortnumber = this.sortnumberNew + await this.submit() + }, submit() { if (this.type === 'add'||this.type === 'copy') { @@ -546,8 +570,9 @@ merchant_id: this.form.merchantId?.value, shop_ids: this.form.shopIds, product_type_pid: this.form.productTypePid, - product_type_id: this.form.productTypeId, - model:this.form.model, + product_type_id: this.form.productTypeId, + policy_id: this.form.policy_id, + model:this.form.model, can_buy:this.form.can_buy, original_price: this.form.originalPrice.toString(), price: this.form.price.toString(), @@ -570,7 +595,7 @@ }) return } - if (this.type === 'editor') { + if (this.type === 'editor') { // return save({ id: this.id, @@ -579,8 +604,9 @@ merchant_id: this.form.merchantId?.value, shop_ids: this.form.shopIds, product_type_pid: this.form.productTypePid, - product_type_id: this.form.productTypeId, - model:this.form.model, + product_type_id: this.form.productTypeId, + policy_id: this.form.policy_id, + model:this.form.model, can_buy:this.form.can_buy, original_price: this.form.originalPrice.toString(), price: this.form.price.toString(), @@ -597,7 +623,7 @@ Message({ type: 'success', message: '编辑商品成功' - }) + }) this.sortnumberNew = "" this.isShow = false this.$emit('refresh') @@ -608,12 +634,13 @@ watch: { isShow(newVal) { if (newVal) { + this.getPolicies() if (this.type === 'editor'||this.type === 'copy') { this.getDetail() - } - if(this.type==='add'){ - this.form.can_buy = 1 - } + } + if(this.type==='add'){ + this.form.can_buy = 1 + } } else { // this.$refs['tinymce'].setContent(' ') @@ -636,15 +663,15 @@ ::v-deep .el-input-number .el-input__inner { text-align: left !important; } - } - .searchMerchants{ - display: flex; - justify-content: space-between; - margin-bottom:16px; - .el-input{ - width:80% - } - } + } + .searchMerchants{ + display: flex; + justify-content: space-between; + margin-bottom:16px; + .el-input{ + width:80% + } + } @@ -688,4 +715,4 @@ top: 1px; left: 4%; } - +