This commit is contained in:
weipengfei 2023-12-25 19:07:39 +08:00
parent aaf4114eda
commit 1203d133cf
5 changed files with 134 additions and 19 deletions

View File

@ -150,3 +150,11 @@ 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);
}

View File

@ -866,7 +866,7 @@
long: e.latitude,
});
}
this.getStoreList(true);
this.getStoreList();
})
}
})

View File

@ -862,7 +862,7 @@
long: e.latitude,
});
}
this.getStoreList(true);
this.getStoreList();
})
}
})

View File

@ -1,10 +1,16 @@
<template>
<view :style="viewColor">
<view class='shoppingCart' :class="(newData.status && newData.status.status) ? 'showFoot' : ''">
<view class='labelNav acea-row row-around row-middle'>
<!-- <view class='labelNav acea-row row-around row-middle'>
<view class='item'><text class='iconfont icon-xuanzhong'></text>100%正品保证</view>
<view class='item'><text class='iconfont icon-xuanzhong'></text>所有商品精挑细选</view>
<view class='item'><text class='iconfont icon-xuanzhong'></text>售后无忧</view>
</view> -->
<view class='labelNav acea-row row-around row-middle row-between-wrapper btn-nav'>
<view class='item_btn'>现款现货</view>
<view class='item_btn'>赊账进货</view>
<view class='item_btn'>线上铺货</view>
<view class='item_btn'>线下铺货</view>
</view>
<view class='nav acea-row row-between-wrapper'>
<view>购物数量 <text class='num t-color'>{{cartTotalCount}}</text></view>
@ -1359,4 +1365,11 @@
font-size: 24rpx;
}
}
.btn-nav{
display: flex;
.item_btn{
flex: 1;
margin: 0 20rpx;
}
}
</style>

View File

@ -111,11 +111,10 @@
<text class="num">库存: {{item.stock}}</text>
<text class="num">销量: {{item.sales}}</text>
</view>
<view class="stock_type">
<view class="type_btn btn_a">现货现款</view>
<view class="type_btn">赊账进货</view>
<view class="type_btn">线上铺货</view>
<view class="type_btn">线下铺货</view>
<view class="stock_type" v-if="mer_info.type_code=='TypeSupplyChain'">
<view class="type_btn" v-for="lable in lableList" :key="lable.product_label_id"
@click="changeLable(item)"
:class="{'btn_a': lable.label_name=='现款现货'||item.mer_labels&&item.mer_labels.find(item=>item.product_label_id==lable.product_label_id)}">{{lable.label_name}}</view>
</view>
<view class='money-wrap'>
<block v-if="mer_info.type_code=='TypeSupplyChain'">
@ -212,6 +211,20 @@
</view>
</view>
</u-popup>
<u-popup :show="lableShow" @close="lableShow=false" mode="center" bgColor='transparent'>
<view class="lable-popup">
<h3 style="font-size: 34rpx;">编辑商品标签</h3>
<view class="stock_type" v-if="mer_info.type_code=='TypeSupplyChain'">
<view class="type_btn" v-for="lable in lableList" :key="lable.product_label_id"
@click="changeLableItem(lable)"
:class="{'btn_a': lableInfo&&lableInfo.mer_labels&&lableInfo.mer_labels.find(id=>id==lable.product_label_id)}">{{lable.label_name}}</view>
</view>
<view class="btn-box">
<button class="cal" @click="lableShow=false">取消</button>
<button class="pra" @click="updateLable">确认</button>
</view>
</view>
</u-popup>
</view>
</template>
@ -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,18 +350,55 @@
*/
getUserInfo() {
getUserInfo().then(res => {
this.mer_id = res.data.service.mer_id;
this.mer_info = res.data.mer_info;
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) {
@ -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;
}
}
}
</style>