From 2f6c62aafbe03393703368e70e1bd8dad6705074 Mon Sep 17 00:00:00 2001 From: pengda <1111@qq.com> Date: Tue, 22 Jul 2025 16:44:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/site/serviceSetting/priceSet.vue | 605 ++++++++++++++++++++---- 1 file changed, 505 insertions(+), 100 deletions(-) diff --git a/src/components/site/serviceSetting/priceSet.vue b/src/components/site/serviceSetting/priceSet.vue index deb0d27..80b1d17 100644 --- a/src/components/site/serviceSetting/priceSet.vue +++ b/src/components/site/serviceSetting/priceSet.vue @@ -4,37 +4,191 @@ {{info.type_desc}}-价格设置 -
-

网页支付与售价

- + + + + + +
+ +
+ 网页支付与售价 + 供货价:{{ serviceAddInfo.supply_price }}{{ serviceAddInfo.supply_price_warning }} +
+
-
-
-

售价管理

-

供货价格:3.5元/篇

+
+
售价管理
+
+
+
+ +
+
+ +
+
+
+
+ +
-
- - - +
+ +
-
-
+ +
+
+ 重置 + 保存 +
+ +
+ + +
+ +
+ {{ serviceAddInfo.shop_name }}支付管理 + +
+
+
+
+
售价管理
+
+
+
+ +
+
+ +
+
+
+
+ + +
+
+ + +
+
+ +
+
+ 重置 + 保存
-
- 保存 + +
+ +
+ 关联电商商品 + 必须关联,且确保服务与{{ serviceAddInfo.shop_name }}电商商品一致 +
+
+
+ + 添加宝贝 +
+
+
+
+ +
+
+ {{ row.title }} +
+
+
+ ¥{{ row.price }} + {{ row.sec_title }} +
+
+ 删除 + 默认商品 +
+
+
+
+
+
+ + + + + + 您确定要删除吗?删除后所有绑定都会删除 +
@@ -43,6 +197,9 @@ import GuipButton from "@/components/GuipButton.vue"; import GuipInput from "@/components/GuipInput.vue"; import GuipSelect from "@/components/GuipSelect.vue"; +import bindGoods from "@/components/bindGoods.vue"; +import GuipDialog from "@/components/GuipDialog.vue"; +import PromptText from "@/components/PromptText.vue"; export default { name: 'priceSet', @@ -55,92 +212,241 @@ export default { components: { GuipSelect, GuipInput, - GuipButton + GuipButton, + PromptText, + bindGoods, + GuipDialog }, data(){ return { token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3NTI2NDY1NDUsIm5iZiI6MTc1MjY0NjU0NSwiZXhwIjoxNzU1MjM4NTQ1LCJ1c2VyIjoic3VidXNlciIsImxvZ2luX3R5cGUiOjAsImFpZCI6IjEifQ.G-Is-x9qPMiV_urOlDPQVRjfAIozySxL5EK2k82d46k', info:{}, - //添加按钮样式 - saveBtnStyleObj: { - width: '144px', - height: '46px', - borderRadius: '4px', - background: '#006AFF', - }, - options: [{ - value: '选项1', - label1: '黄金hhhhhh', - id1: '1', - id2: '啊11哈哈', - label: '黄金糕' - }, { - value: '选项2', - id1: '12', - id2: '啊22哈哈', - label1: '双皮奶hhhhhhhhh', - label: '双皮奶' - }, { - value: '选项3', - id1: '13', - id2: '啊33哈哈', - label1: '蚵仔煎hhhhhhhhh', - label: '蚵仔煎' - }, { - value: '选项4', - id1: '14', - id2: '啊444哈哈', - label1: '双皮奶hhhhhhhhh', - label: '龙须面' - }, { - value: '选项5', - id1: '155', - id2: '啊55哈哈', - label1: '双皮奶hhhhhhhhh', - label: '北京烤鸭' - }], - form: { - username: '', - language: '', - domain_set: '', - domainSuffix: '11', - domainSuffix1: '.chachongz.com', - card: '1', - input1: '跨年的烟火,绽放天空', - input2: '', - input3: '', - }, + uid: 0, + type: 0, + serviceAddInfo:{}, + service_unit:'', + bindList: [], + showBind: false, + pati: '', + pageCode: '', + dialogDelBindConfim: false, } }, mounted() { this.info = JSON.parse(JSON.stringify(this.serviceInfo)) + if(Object.keys(this.info).length>0){ + this.uid = this.info.uid + this.type = this.info.type + this.getServiceAddInfo() + this.getServiceBindGoods() + } }, methods:{ - saveConfirm() { - let obj = {} - obj.uid = this.info.uid - obj.type = this.info.type - obj.logo_bgcolor = this.tabColor.replace('#','') - obj.link_btn_color = this.themeColor.replace('#','') - obj.selected_nav_bgcolor = this.navColor.replace('#','') - + //获得要添加的服务信息 + getServiceAddInfo() { + const that = this + that.$http('POST', '/agentnew/ajax_get_service_add_info', { + uid: that.uid, + type: that.type, + }, { + headers: { + 'Auth': this.token + } + }).then(response => { + if (response.status) { + that.$nextTick(() => { + that.serviceAddInfo = response.data + that.service_unit = that.serviceAddInfo.unit + //拼多多渠道查询商品所需参数初始化 + if (that.serviceAddInfo.shop_name === '拼多多') this.initPddParam(that.uid) + }) + return true + } + that.$message.error(response.info); + }).catch(error => { + console.error(error, 'error') + }) + }, + //查询绑定的宝贝 + getServiceBindGoods() { const that = this - this.$http('POST', '/agentnew/ajax_update_service_style', obj,{ - headers:{ + that.$http('POST', '/agentnew/ajax_get_service_bind_goods', { + uid: that.uid, + type: that.type, + }, { + headers: { 'Auth': this.token } }).then(response => { - if(response.status){ + if (response.status && response.data) { + that.$nextTick(() => { + that.bindList = response.data + }) + } + }).catch(error => { + console.error(error, 'error') + }) + }, + handleUnitName(){ + this.serviceAddInfo.unit_name = this.serviceAddInfo.set_units[this.service_unit] + }, + resetPrice() { + this.info.price = '' + this.info.unit_num = '' + this.info.b_unit_price = '' + this.info.b_unit_num = '' + }, + savePrice() { + const that = this + //非字符计费 + if(that.service_unit !== '0') { + that.info.unit_num = 1 + that.info.base_unit_num = '' + that.info.base_unit_price = '' + } + this.$http('POST', "/agentnew/ajax_set_service_price", { + uid: that.uid, + type: that.type, + unit: that.service_unit, + unit_num: that.info.unit_num, + unit_price: that.info.price, + b_unit_num: that.info.base_unit_num, + b_unit_price: that.info.base_unit_price, + }, { + headers: { + 'Auth': this.token + } + }).then(response => { + if (response.status) { that.$message.success('保存成功'); + return true; + } + that.$message.error(response.info); + }).catch(error => { + console.error(error, 'error') + }) + }, + resetShopPrice() { + this.info.unit_piece = '' + this.info.unit_num = '' + this.info.b_unit_piece = '' + this.info.b_unit_num = '' + }, + saveShopPrice() { + const that = this + //非字符计费 单位默认为 1 + //非字符计费 + if(that.service_unit !== '0') { + that.info.unit_num = 1 + that.info.base_unit_num = '' + that.info.base_unit_piece = '' + } + this.$http('POST', "/agentnew/ajax_set_service_price", { + uid: that.uid, + type: that.type, + unit: that.service_unit, + unit_num: that.info.unit_num, + unit_piece: that.info.unit_piece, + b_unit_num: that.info.base_unit_num, + b_unit_piece: that.info.base_unit_piece, + }, { + headers: { + 'Auth': this.token + } + }).then(response => { + if (response.status) { + that.$message.success('保存成功'); + return true; + } + that.$message.error(response.info); + }).catch(error => { + console.error(error, 'error') + }) + }, + //------绑定相关 start------ + bindGoods() { + this.showBind = true + }, + handleBind(bindRes) { + this.showBind = false + if (bindRes) this.getServiceBindGoods() + }, + async getPddPageCode(uid) { + const that = this + return await that.$http('POST', '/agentnew/ajax_get_pdd_page_code', { + uid: uid, + }, { + headers: { + 'Auth': this.token + } + }).then(response => { + return response.data + }).catch(error => { + console.error(error, 'error') + }) + }, + async initPddParam(uid) { + if (typeof window.PDD_OPEN_init === 'function') { + this.pageCode = await this.getPddPageCode(uid) - let color_info = {} - color_info.logo_bgcolor = obj.logo_bgcolor - color_info.link_btn_color = obj.link_btn_color - color_info.selected_nav_bgcolor = obj.selected_nav_bgcolor - that.info.color_info = color_info - - that.$emit('saveEvent', that.info) + await window.PDD_OPEN_init({ code: this.pageCode }) + this.pati = await window.PDD_OPEN_getPati() + } else { + console.error('PDD_OPEN_init 不存在,SDK 未正确加载'); + } + }, + handleDelBindClick(row, index) { + this.dialogDelBindConfim = true + this.delRow.index = index + this.delRow.row = row + }, + handleDelBindCancel() { + this.dialogDelBindConfim = false + }, + handleDelBindConfirm() { + const that = this + this.dialogDelBindConfim = false + this.$http('POST', '/agentnew/ajax_del_bind_service_goods', { + uid: that.uid, + type: that.type, + numiid: that.delRow.row.num_iid, + skuid: that.delRow.row.sku_id, + paytype: that.delRow.row.pay_type, + }, { + headers: { + 'Auth': this.token + } + }).then(response => { + if (response.status) { + that.$message.success('删除成功'); + this.$nextTick(() => { + that.bindList.splice(that.delRow.index, 1); + }) + return true; + } + that.$message.error(response.info); + }).catch(error => { + console.error(error, 'error') + }) + }, + handleDefaultConfirm(id) { + const that = this + this.$http('POST', '/agentnew/ajax_default_bind_setting', { + uid: that.uid, + type: that.type, + id: id, + }, { + headers: { + 'Auth': this.token + } + }).then(response => { + if (response.status) { + that.$message.success('设置成功'); + that.bindList.forEach((item) => { + item.is_default = '0' + if (item.id === id) item.is_default = '1' + }); return true; } that.$message.error(response.info); @@ -148,27 +454,126 @@ export default { console.error(error, 'error') }) }, + //------绑定相关 end------ } } \ No newline at end of file