diff --git a/api/public.js b/api/public.js index 6c4ba5b..00f1912 100644 --- a/api/public.js +++ b/api/public.js @@ -149,4 +149,12 @@ export function getNavigation(data) { */ export function systemGroupValue(data) { return request.get("system_group_value", data); +} + +/** + * 获取商品标签 + * @param data string 获取商品标签 + */ +export function labelLst(data) { + return request.get("label_lst", data); } \ No newline at end of file diff --git a/pages/nongKe/cloud_entrepot/indexOther.vue b/pages/nongKe/cloud_entrepot/indexOther.vue index 36330a7..d28977d 100644 --- a/pages/nongKe/cloud_entrepot/indexOther.vue +++ b/pages/nongKe/cloud_entrepot/indexOther.vue @@ -866,7 +866,7 @@ long: e.latitude, }); } - this.getStoreList(true); + this.getStoreList(); }) } }) diff --git a/pages/nongKe/cloud_entrepot/indexb.vue b/pages/nongKe/cloud_entrepot/indexb.vue index 7413cf5..ec2e9fd 100644 --- a/pages/nongKe/cloud_entrepot/indexb.vue +++ b/pages/nongKe/cloud_entrepot/indexb.vue @@ -862,7 +862,7 @@ long: e.latitude, }); } - this.getStoreList(true); + this.getStoreList(); }) } }) diff --git a/pages/nongKe/supply_chain/shopping_trolley.vue b/pages/nongKe/supply_chain/shopping_trolley.vue index 5c7928a..f8cbf8e 100644 --- a/pages/nongKe/supply_chain/shopping_trolley.vue +++ b/pages/nongKe/supply_chain/shopping_trolley.vue @@ -1,10 +1,16 @@ @@ -232,6 +245,7 @@ productRecommendApi, productUpdateFree } from "@/api/product"; + import { labelLst } from "@/api/public.js"; import Loading from '@/components/Loading/index.vue'; import { merstreet, @@ -296,7 +310,12 @@ isshow: false, num: -1, ll: 0, - + lableList: [], //标签列表 + lableShow: false, + lableInfo: { + id: '', + mer_labels: '' + }, // 已选择标签 } }, onLoad(options) { @@ -331,19 +350,56 @@ */ getUserInfo() { getUserInfo().then(res => { - - this.mer_id = res.data.service.mer_id; this.mer_info = res.data.mer_info; - - this.getList(res.data.service.mer_id, true); - - - }).catch(res => { - console.log(res) - }) - + this.initLable(); + this.getList(res.data.service.mer_id, true); + }).catch(res => { + console.log(res) + }) }, + // 初始化商品标签 + initLable(){ + labelLst({ + type: 1 + }).then((res)=>{ + this.lableList = res.data.list; + }) + }, + // 点击标签 + changeLable(item){ + this.lableInfo.id = item.product_id; + this.lableInfo.mer_labels = []; + item.mer_labels?.forEach(t=>{ + this.lableInfo.mer_labels.push(+t.product_label_id); + }) + if(this.lableInfo.mer_labels.length==0)this.lableInfo.mer_labels = [4]; + this.lableShow = true; + }, + changeLableItem(item){ + if(item.product_label_id==4) return Toast('该项必须勾选'); //现款现货 + const index = this.lableInfo.mer_labels.indexOf(+item.product_label_id); + if (index >= 0) { + // 如果存在,则删除该元素 + this.lableInfo.mer_labels.splice(index, 1); + } else { + // 如果不存在,则添加该元素 + this.lableInfo.mer_labels.push(+item.product_label_id); + } + }, + // 编辑标签 + updateLable(){ + console.log({...this.lableInfo}); + productUpdateFree(this.lableInfo.id, { + mer_labels: this.lableInfo.mer_labels + }).then((res)=>{ + Toast(res.message); + this.lableShow = false; + this.getList(this.mer_id, false); + }).catch(e=>{ + Toast(e) + }) + }, menuActiona(item, index) { if (item.is_good) { this.options = [{ @@ -1203,4 +1259,42 @@ } } + .lable-popup{ + width: 600rpx; + border-radius: 14rpx; + background-color: #fff; + padding: 28rpx; + .stock_type{ + display: flex; + flex-wrap: wrap; + margin-top: 28rpx; + font-size: 28rpx; + .type_btn{ + padding: 8rpx 20rpx 10rpx 20rpx; + border: 2rpx solid #898989; + border-radius: 50rpx; + margin: 0 10rpx; + margin-bottom: 15rpx; + } + .btn_a{ + border: 2rpx solid #F84221; + color: #F84221; + } + } + .btn-box{ + display: flex; + justify-content: flex-end; + margin-top: 30rpx; + .pra, .cal{ + font-size: 28rpx; + background-color: #ff6d20; + color: #FFF; + padding: 10rpx 40rpx; + } + .cal{ + background-color: #999999; + margin-right: 40rpx; + } + } + } \ No newline at end of file