Merge branch 'main' into prod

This commit is contained in:
weipengfei 2023-11-29 18:42:37 +08:00
commit 6c54f05221
19 changed files with 1460 additions and 231 deletions

56
App.vue
View File

@ -20,6 +20,9 @@
getUserInfo getUserInfo
} from '@/api/user.js'; } from '@/api/user.js';
import {
parseToken
} from "@/api/appLet.js";
import { import {
HTTP_REQUEST_URL HTTP_REQUEST_URL
} from './config/app'; } from './config/app';
@ -29,6 +32,7 @@
history history
} from '@/api/public.js' } from '@/api/public.js'
import Routine from './libs/routine.js'; import Routine from './libs/routine.js';
import { Toast } from "./libs/uniApi";
export default { export default {
data() { data() {
@ -93,16 +97,52 @@
key: 'launchFlag' key: 'launchFlag'
}) })
//
// parseToken({
// token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJjZXNoaS1taWRkbGUubGloYWluay5jbiIsImF1ZCI6ImNlc2hpLW1pZGRsZS5saWhhaW5rLmNuIiwiaWF0IjoxNzAwNjIwMjUxLCJuYmYiOjE3MDA2MjAyNTEsImV4cCI6MTcwMTIyNTA1MSwiZGF0YSI6eyJ1aWQiOjUsInBob25lIjoiMTc2ODUxNTE2NDMiLCJhdmF0YXIiOiIvcmVzb3VyY2UvaW1hZ2UvYWRtaW5hcGkvZGVmYXVsdC9kZWZhdWx0X2F2YXRhci5wbmciLCJuaWNrbmFtZSI6Ilx1NzUyOFx1NjIzNzE3Njg1MTUxNjQzIn19.sTWAHCScRY9FExwJw1MReHTnRBcK7tYu1AMSia_Sm4M'
// }).then((res)=>{
// this.$store.commit("LOGIN", {
// 'token': res.data.token,
// 'time': 604800
// });
// this.$isResolve()
// }).catch((err)=>{
// if(err==''){
// this.$store.commit("LOGIN", {
// 'token': option.referrerInfo?.extraData?.uniMP,
// 'time': 604800
// });
// }else {
// Toast(err);
// }
// this.$isResolve()
// })
if (option?.referrerInfo?.extraData?.uniMP) {
if (option.referrerInfo?.extraData?.uniMP) {
uni.setStorageSync('uniMP', option.referrerInfo?.extraData?.uniMP); uni.setStorageSync('uniMP', option.referrerInfo?.extraData?.uniMP);
// uni.setStorageSync('APP_token', option.referrerInfo?.extraData?.token); // this.$store.commit("LOGIN", {
this.$store.commit("LOGIN", { // 'token': option.referrerInfo?.extraData?.token,
'token': option.referrerInfo?.extraData?.token, // 'time': 604800
'time': 604800 // });
}); parseToken({
} token: option.referrerInfo?.extraData?.token
}).then((res)=>{
this.$store.commit("LOGIN", {
'token': res.data.token,
'time': 604800
});
this.$isResolve()
}).catch((err)=>{
this.$store.commit("LOGIN", {
'token': option.referrerInfo?.extraData?.token,
'time': 604800
});
console.log('TOKEN解析错误:', err);
this.$isResolve()
})
}else {
this.$isResolve()
}
// #ifdef APP-PLUS // #ifdef APP-PLUS
// #endif // #endif

9
api/appLet.js Normal file
View File

@ -0,0 +1,9 @@
import request from "@/utils/request.js";
/**
* 文章详情
*
*/
export function parseToken(data) {
return request.post('parse/token', data, { noAuth: true });
}

View File

@ -23,3 +23,7 @@ export function getCartList(data) {
export function getCartCounts(data) { export function getCartCounts(data) {
return request.get("user/cart/count", data); return request.get("user/cart/count", data);
} }
export function getCategoryListLevel(data) {
return request.get("category/list_level", data);
}

View File

@ -34,6 +34,12 @@ Vue.prototype.$eventHub = new Vue();
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.$bus = new Vue(); Vue.prototype.$bus = new Vue();
// initRouter()
// 让app的onLaunch先执行主要是用来进行登录
Vue.prototype.$onLaunched = new Promise(resolve => {
Vue.prototype.$isResolve = resolve
})
// #ifdef H5 // #ifdef H5
import { import {
parseQuery parseQuery

View File

@ -1332,7 +1332,15 @@
"path" : "addGood/addGood", "path" : "addGood/addGood",
"style" : "style" :
{ {
"navigationBarTitleText" : "", "navigationBarTitleText" : "商品设置",
"enablePullDownRefresh" : false
}
},
{
"path" : "addGood/specGood",
"style" :
{
"navigationBarTitleText" : "规格设置",
"enablePullDownRefresh" : false "enablePullDownRefresh" : false
} }
}, },

View File

@ -1,5 +1,5 @@
<template> <template>
<view> <view style="padding-bottom: 30rpx;">
<view class="order-index" ref="container"> <view class="order-index" ref="container">
<view class="header acea-row"> <view class="header acea-row">
<navigator class="item" :url="`/pages/admin/orderList/index?types=1&merId=${mer_id}`" <navigator class="item" :url="`/pages/admin/orderList/index?types=1&merId=${mer_id}`"
@ -83,8 +83,8 @@
<view class="item acea-row row-between-wrapper" v-for="(item, index) in list" :key="index"> <view class="item acea-row row-between-wrapper" v-for="(item, index) in list" :key="index">
<view class="data">{{ item.day }}</view> <view class="data">{{ item.day }}</view>
<view class="browse">{{ item.total }}</view> <view class="browse">{{ item.total }}</view>
<view class="turnover">{{ item.pay_price }}</view> <view class="turnover" @click="navToOrder(item, 2)">{{ item.pay_price }}</view>
<view class="turnover">{{ item.pay_price }}</view> <view class="turnover" @click="navToOrder(item, 4)">{{ toFixed2(item.settlement_price) }}</view>
</view> </view>
</view> </view>
</view> </view>
@ -270,7 +270,21 @@
this.OrderList = res.data this.OrderList = res.data
// console.log(this.OrderList); // console.log(this.OrderList);
}) })
} },
//
toFixed2(num){
let str = num;
if(typeof num =='string'){
str = +str;
str = str.toFixed(2);
}else str = str.toFixed(2);
return str || '0.00';
},
navToOrder(item, type=2){
uni.navigateTo({
url: `/pages/admin/orderList/index?merId=${this.mer_id}&types=${type}&pay_time=${item.pay_time.split(' ')[0]}`
})
}
}, },
onReachBottom() { onReachBottom() {
this.getList(this.mer_id) this.getList(this.mer_id)

View File

@ -50,7 +50,7 @@
<view v-if="val.product" class="goods acea-row row-between-wrapper"> <view v-if="val.product" class="goods acea-row row-between-wrapper">
<view class="picTxt acea-row row-between-wrapper"> <view class="picTxt acea-row row-between-wrapper">
<view class="pictrue"> <view class="pictrue">
<image :src="val.product.cart_info.product.image" /> <image :src="val.product.cart_info.productAttr.image||val.product.cart_info.product.image" />
</view> </view>
<view class="text acea-row row-between row-column"> <view class="text acea-row row-between row-column">
<view class="info line1 refund-info"> <view class="info line1 refund-info">
@ -74,6 +74,7 @@
<text v-if="item.status == 0" class="iconfont icon-tuikuanzhong on"></text> <text v-if="item.status == 0" class="iconfont icon-tuikuanzhong on"></text>
<text v-if="item.status == 1 || item.status == 2" class="iconfont icon-tuihuozhong on"></text> <text v-if="item.status == 1 || item.status == 2" class="iconfont icon-tuihuozhong on"></text>
<text v-if="item.status == 3" class="iconfont icon-yituikuan1"></text> <text v-if="item.status == 3" class="iconfont icon-yituikuan1"></text>
<text v-if="item.status == -2" class="iconfont icon-yiquxiao"></text>
</view> </view>
<view class="operation acea-row row-between-wrapper"> <view class="operation acea-row row-between-wrapper">
<view class="more"> <view class="more">
@ -109,7 +110,7 @@
<view class="acea-row row-between-wrapper"> <view class="acea-row row-between-wrapper">
<view class="picTxt acea-row row-between-wrapper"> <view class="picTxt acea-row row-between-wrapper">
<view class="pictrue"> <view class="pictrue">
<image :src="val.cart_info.product.image" /> <image :src="val.cart_info.productAttr.image||val.cart_info.product.image" />
</view> </view>
<view class="text acea-row row-between row-column"> <view class="text acea-row row-between row-column">
<view class="info line2"> <view class="info line2">
@ -262,7 +263,8 @@
limit: 10, limit: 10,
status: 1, status: 1,
search_info: '', search_info: '',
product_type: '' product_type: '',
pay_time: null,
}, },
list: [], list: [],
loaded: false, loaded: false,
@ -291,6 +293,9 @@
this.where.status = option.types this.where.status = option.types
this.current = ""; this.current = "";
this.merId = option.merId; this.merId = option.merId;
if(option.pay_time){
this.where.pay_time = option.pay_time;
}
this.getIndex(); this.getIndex();
}, },
@ -332,7 +337,7 @@
let that = this; let that = this;
console.log(that.merId) // console.log(that.merId)
if (that.loading || that.loaded) return; if (that.loading || that.loaded) return;
that.loading = true; that.loading = true;
if (that.where.status == 6) { if (that.where.status == 6) {

View File

@ -208,7 +208,8 @@
</script> </script>
<style lang="scss"> <style lang="scss">
.refund-wrapper{ .refund-wrapper{
padding-bottom: 150rpx;
.form-box{ .form-box{
padding-left: 30rpx; padding-left: 30rpx;
margin-top: 18rpx; margin-top: 18rpx;

View File

@ -121,7 +121,15 @@
getUserInfo().then(res => { getUserInfo().then(res => {
if (res.data.mer_info.length == 0) { if (res.data.mer_info.length == 0) {
return uni.showModal({ return uni.showModal({
title: '暂无商户信息' title: '暂无商户信息',
complete(res) {
// #ifdef APP-PLUS
uni.sendHostEvent('closeApp', (ret) => {
//
console.log('关闭应用' + JSON.stringify(ret));
});
// #endif
}
}) })
} }
this.mer_id = res.data.service.mer_id; this.mer_id = res.data.service.mer_id;

View File

@ -131,8 +131,8 @@
<view class="list-one_right-b">待发货</view> <view class="list-one_right-b">待发货</view>
</view> </view>
</view> </view>
<view class="" v-for="(g,h) in item.orderProduct"> <view class="">
<view class="list-two"> <view class="list-two" v-for="(g,h) in item.orderProduct">
<view class="list-two_left"> <view class="list-two_left">
<image :src="g.cart_info.product.image" mode=""></image> <image :src="g.cart_info.product.image" mode=""></image>
</view> </view>
@ -563,13 +563,16 @@
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.getGoods(true)
uni.stopPullDownRefresh() this.getGoods(true).then(()=>{
uni.stopPullDownRefresh()
})
}, },
onLoad() { async onLoad() {
this.list1()
this.Fheight = uni.getSystemInfoSync().windowHeight + 'px'; this.Fheight = uni.getSystemInfoSync().windowHeight + 'px';
await this.$onLaunched;
this.list1()
}, },
@ -579,13 +582,15 @@
if (this.productList.length > 0) { if (this.productList.length > 0) {
setTimeout(() => { setTimeout(() => {
this.getGoods(false); this.getGoods(false);
}, 1000) this.getindex();
}, 10)
} }
}, },
onShow() { async onShow() {
await this.$onLaunched;
this.getUserInfo() this.getUserInfo()
this.codelist() this.codelist()
}, },
@ -955,13 +960,20 @@
} }
if (res.data.mer_info.length == 0) { if (res.data.mer_info.length == 0) {
uni.showModal({ uni.showModal({
title: '暂无商户信息' title: '暂无商户信息',
complete(res) {
// #ifdef APP-PLUS
uni.sendHostEvent('closeApp', (ret) => {
//
console.log('关闭应用' + JSON.stringify(ret));
});
// #endif
}
}) })
} else { } else {
this.getindex() this.getindex()
this.getGoods(true) this.getGoods(true)
} }
merstreet({ merstreet({
street_code: res.data.mer_info.street_id street_code: res.data.mer_info.street_id
}).then((res) => { }).then((res) => {
@ -974,7 +986,7 @@
this.company = res.data.title this.company = res.data.title
this.organization_code = res.data.organization_code this.organization_code = res.data.organization_code
}).catch(res => { }).catch(res => {
console.log(res) console.log('错误:', res)
}) })
}); });
}, },
@ -1149,16 +1161,19 @@
}, },
// //
getGoods: function(isPage) { getGoods: async function(isPage) {
let that = this; let that = this;
if (that.loadend) return; if (that.loadend) return;
if (that.loading) return; if (that.loading) return;
if (isPage === true) that.$set(that, 'productList', []); if (isPage === true) {
that.where.page = 1;
that.$set(that, 'productList', []);
}
that.loading = true; that.loading = true;
that.loadTitle = ''; that.loadTitle = '';
getOrderList(that.where, this.userInfoData.service.mer_id).then(res => { await getOrderList(that.where, this.userInfoData.service.mer_id).then(res => {
let list = res.data.list; let list = res.data.list;
let productList = that.$util.SplitArray(list, that.productList); let productList = that.$util.SplitArray(list, that.productList);
let loadend = list.length < that.where.limit; let loadend = list.length < that.where.limit;

View File

@ -237,27 +237,28 @@
editGoodsStore: '', editGoodsStore: '',
editGoodsShow: false, // editGoodsShow: false, //
mer_id: 0, mer_id: 0,
userInfo: {},
searchGoodsShow: false, searchGoodsShow: false,
searchGoodsName: '', searchGoodsName: '',
showModel: false, showModel: false,
showModelCode: '', showModelCode: '',
goods: [ goods: [
// { // {
// "id": 7, // "id": 314,
// "store_name": " 400", // "store_name": "",
// "bar_code": "6922868290895", // "bar_code": "6974008060011",
// "manu_address": "", // "manu_address": "",
// "price": "4.80", // "price": "0.00",
// "stock": 9999999, // "stock": 9999999,
// "image": "http://lihai001.oss-cn-chengdu.aliyuncs.com/def/2023-11-02/202311021740247976.jpg", // "image": "http://lihai001.oss-cn-chengdu.aliyuncs.com/def/2023-11-18/202311181017131387.jpg",
// "slider_image": [ // "slider_image": [
// "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/e4784202311041417185146.jpg" // "http://lihai001.oss-cn-chengdu.aliyuncs.com/def/2023-11-18/202311181017131387.jpg"
// ], // ],
// "spec": "****()", // "spec": "560",
// "trademark": "****()", // "trademark": "",
// "manu_name": null, // "manu_name": null,
// "note": "login_dateJul 13 1998 12:00:00:000AMvalid_dateJul 13 2020 12:00:00:000AM" // "note": ""
// }, // }
], ],
putGoods: { // putGoods: { //
@ -283,17 +284,20 @@
}, },
onLoad(e) { onLoad(e) {
this.mer_id = e.mer_id this.mer_id = e.mer_id
this.userInfo = this.$store.state.app.userInfo;
if(typeof this.userInfo == 'string') this.userInfo = JSON.parse(this.userInfo);
}, },
onShow() { onShow() {
}, },
methods: { methods: {
addGoods(item) { addGoods(item={}) {
if(this.isNullImage(item.image)|| item = JSON.parse(JSON.stringify(item));
( this.isNullImage(item.slider_image[0]) && this.isNullImage(item.slider_image[1]) && this.isNullImage(item.slider_image[2]) )){ // if(this.isNullImage(item.image)||
return Toast('请先上传商品图片后再加入店铺'); // ( this.isNullImage(item.slider_image[0]) && this.isNullImage(item.slider_image[1]) && this.isNullImage(item.slider_image[2]) )){
} // return Toast('');
if(item.update) return Toast('请保存修改后再添加'); // }
// if(item.update) return Toast('');
this.putGoods.id = item.id; this.putGoods.id = item.id;
this.putGoods.price = ''; this.putGoods.price = '';
this.putGoods.stock = ''; this.putGoods.stock = '';
@ -308,9 +312,50 @@
this.putGoods[key] = item[key]; this.putGoods[key] = item[key];
} }
}) })
this.initShop(item);
this.addGoodsShow = true // this.addGoodsShow = true
this.item = item // this.item = item
},
initShop(item){
item.attr = [{
value: '规格',
detail: [item.spec]
}]
item.attrValue = [{
"detail": {
'规格': item.spec
},
"sku": item.spec,
"stock": 0,
"image": item.image,
"bar_code": item.bar_code,
"cost": "",
"ot_price": "",
"price": item.price,
"volume": "",
"weight": "",
}]
item.spec_type = 1;
item.import_id = item.id + '';
item.imageList = [item.image, ...item.slider_image];
item.content = {
title: '',
image: item.slider_image[0]?[item.slider_image[0]]:[]
}
delete item.id;
delete item.stock;
console.log({...item});
uni.navigateTo({
url: `/pages/product/addGood/addGood?mer_id=${this.userInfo.service.mer_id}&import=1`,
success: (e) => {
e.eventChannel.emit('importAttrValue', item);
uni.$once('importAttrValueOK', (e)=>{
this.goods = this.goods.filter(t=>{
return t.id!=e;
})
})
}
})
}, },
isNullImage(src){ isNullImage(src){
let flag = false; let flag = false;
@ -528,7 +573,7 @@
Toast("暂无搜索商品,请添加!") Toast("暂无搜索商品,请添加!")
setTimeout(() => { setTimeout(() => {
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/addGoods/index?mer_id=${rq.mer_id}` url: `/pages/product/addGood/addGood?mer_id=${rq.mer_id}`
}) })
}, 2000) }, 2000)
return return
@ -646,8 +691,8 @@
}, },
navToAdd(){ navToAdd(){
let url; let url;
if(this.showModelCode) url = `/pages/product/addGoods/index?mer_id=${this.mer_id}&code=${this.showModelCode}`; if(this.showModelCode) url = `/pages/product/addGood/addGood?mer_id=${this.mer_id}&code=${this.showModelCode}`;
else url = `/pages/product/addGoods/index?mer_id=${this.mer_id}`; else url = `/pages/product/addGood/addGood?mer_id=${this.mer_id}`;
uni.navigateTo({ uni.navigateTo({
url:url, url:url,
success:()=> { success:()=> {
@ -667,7 +712,7 @@
} }
}) })
} }
navigateTo(1, '/pages/product/addGoods/index', { navigateTo(1, '/pages/product/addGood/addGood', {
mer_id: this.mer_id mer_id: this.mer_id
}); });
}, },

View File

@ -35,15 +35,15 @@
</view> </view>
</view> </view>
</view> </view>
<u-popup ref="select_popup" class="pop" :show="show" mode="center" closeOnClickOverlay bgColor='transparent'> <u-popup ref="select_popup" class="pop" :show="show" mode="center" closeOnClickOverlay bgColor='transparent'>
<image :src="image"></image> <image :src="image"></image>
<image src="@/static/images/guanbi.png" class="guanbi" @click="close"></image> <image src="@/static/images/guanbi.png" class="guanbi" @click="close"></image>
</u-popup> </u-popup>
</view> </view>
<!-- 商品详情 --> <!-- 商品详情 -->
<commodityComponent v-if="showCommodity" :key="showCommodity" :showCommodity="showCommodity" :product_id="product_id" :merId="merId" <commodityComponent ref="commodityRef" v-if="showCommodity" :key="showCommodity" :showCommodity="showCommodity"
:code="code" @lastStep="lastStep"> :product_id="product_id" :merId="merId" :code="code">
</commodityComponent> </commodityComponent>
<view class="popup_group"> <view class="popup_group">
@ -58,32 +58,61 @@
<view><span class="iconfont">&#xe6bd;</span></view> <view><span class="iconfont">&#xe6bd;</span></view>
</view> </view>
</view> </view>
<view class="popup_group_item"> <view class="popup_group_item">
<view class="popup_group_item_label">商品单位</view> <view class="popup_group_item_label">商品单位</view>
<view class="popup_group_item_value"><input v-model="setFormData.unit_name" type="text" <view class="popup_group_item_value"><input v-model="setFormData.unit_name" type="text"
placeholder="请填写商品单位" /></view> placeholder="请填写商品单位" /></view>
</view> </view>
</view> </view>
<!-- 选择平台分类弹框 --> <!-- 选择平台分类弹框 -->
<uni-popup ref="select_platform" type="bottom"> <uni-popup ref="select_platform" type="bottom">
<platfrom @close="closePlatfrom" :classifiedData="platformClassificationData" @getPlatData="getPlatData"> <platfrom @close="closePlatfrom" :classifiedData="platformClassificationData" @getPlatData="getPlatData">
</platfrom> </platfrom>
</uni-popup> </uni-popup>
<!-- 规格设置 -->
<priceComponent :product_id="product_id" :bar_code="code" @updateCode = "updateCode" v-if="showCommodity"></priceComponent>
<!-- 规格设置 -->
<picker mode="selector" :range="['单规格','多规格']" :value="setFormData.spec_type" @change="changeSpecType">
<view class="popup_group" style="margin-bottom: 0;">
<view class="popup_group_item">
<view class="popup_group_item_label">商品规格</view>
<view class="popup_group_item_value">
<view class="popup_group_item_message">
<span class="popup_group_item_message_value">{{ setFormData.spec_type==0?'单规格':'多规格' }}</span>
</view>
<view><span class="iconfont">&#xe6bd;</span></view>
</view>
</view>
</view>
<u-modal :show="showSpecType" title="温馨提示" content="切换后商品原有规格将失效,是否继续?"
show-cancel-button confirm-text="继续" @confirm="changeSpecType2" @cancel="showSpecType=false"
></u-modal>
</picker>
<priceComponent v-if="setFormData.spec_type==0" :datas="setFormData.attrValue[0]" ref="priceRef" :product_id="product_id" :bar_code="code" @updateCode="updateCode">
</priceComponent>
<view v-else class="popup_group" style="margin-top: 0;border-top: 1rpx solid #eeeeee;">
<view class="popup_group_item" @click="navToSpecGood()">
<view class="popup_group_item_label" style="flex: 1; text-align: center;">
设置多规格
<text v-if="setFormData.attrValue.length>0">({{setFormData.attrValue.length}})</text>
</view>
</view>
</view>
<view class="popup_group"> <view class="popup_group">
<!-- <view class="popup_group_item" @click="showMoreInfo=!showMoreInfo"> <!-- <view class="popup_group_item" @click="showMoreInfo=!showMoreInfo">
<view class="popup_group_item_label">更多信息</view> <view class="popup_group_item_label">更多信息</view>
<view class="popup_group_item_value" :class="showMoreInfo?'icon_bottom':'icon_top'"> <view class="popup_group_item_value" :class="showMoreInfo?'icon_bottom':'icon_top'">
<view><span class="iconfont">&#xe6bd;</span></view> <view><span class="iconfont">&#xe6bd;</span></view>
</view> </view>
</view> --> </view> -->
<block > <block>
<view class="input_content"> <view class="input_content">
<!-- <view class="input_content_describe" style="border-top: none"> <!-- <view class="input_content_describe" style="border-top: none">
<view class="input_content_describe_title"> <view class="input_content_describe_title">
@ -99,7 +128,7 @@
placeholderClass="placeholderClass" maxlength="200" /> placeholderClass="placeholderClass" maxlength="200" />
</view> </view>
</view> --> </view> -->
<view class="input_content_keyword"> <view class="input_content_keyword">
<view class="input_content_keyword_label">关键字</view> <view class="input_content_keyword_label">关键字</view>
<view class="input_content_keyword_value"><input v-model="setFormData.keyword" type="text" value="" <view class="input_content_keyword_value"><input v-model="setFormData.keyword" type="text" value=""
@ -108,7 +137,7 @@
</view> </view>
<view class="radio"> <view class="radio">
<view class="radio_label ">送货方式</view> <view class="radio_label ">送货方式</view>
<checkbox-group class="select_group flex_start" @change="deliveryWayChange"> <checkbox-group class="select_group flex_start">
<label class="radio_select" v-for="(val, i) in deliveryFreeList" :key="val.value"> <label class="radio_select" v-for="(val, i) in deliveryFreeList" :key="val.value">
<view> <view>
<checkbox :value="val.value" disabled :checked="val.value" /> <checkbox :value="val.value" disabled :checked="val.value" />
@ -118,25 +147,20 @@
</checkbox-group> </checkbox-group>
</view> </view>
</block> </block>
</view> </view>
</view> </view>
<view class="handle"> <view class="handle">
<view class="handle_button" @click="submitCreatedGoods">提交</view> <view class="handle_button" @click="submitCreatedGoods">提交</view>
</view> </view>
<uni-popup ref="tempId" type="bottom">
<linkage-assembly selectProductTitle="选择运费模板" :form="setFormData" :classifiedData="classified['temp_id']"
:selectProductItem="productItem" :mer_id="merId" @getLinkageData="getTempIdData" @multipleList="multipleList"
@close="$refs.tempId.close()" @scrolltolower="scrolltolower"></linkage-assembly>
</uni-popup>
<!-- 图片选择器 --> <!-- 图片选择器 -->
<avatar @upload="doUpload" @getName="getImgName" quality="1" ref="avatar" selWidth="250upx" selHeight="250upx"> <avatar @upload="doUpload" @getName="getImgName" quality="1" ref="avatar" selWidth="250upx" selHeight="250upx">
</avatar> </avatar>
</view> </view>
</template> </template>
@ -153,14 +177,23 @@
attrList, attrList,
templateList, templateList,
productDetail, productDetail,
getDeliveryType getDeliveryType,
productCreate,
productUpdate
} from '@/api/product.js'; } from '@/api/product.js';
import {
serialize,
Toast,
Loading,
hideLoading,
Modal
} from "@/libs/uniApi.js";
import avatar from "@/components/yq-avatar/yq-avatar.vue"; import avatar from "@/components/yq-avatar/yq-avatar.vue";
import platfrom from "./components/platform.vue"; import platfrom from "./components/platform.vue";
import commodityComponent from "./components/commodity.vue"; import commodityComponent from "./components/commodity.vue";
import priceComponent from "./components/price.vue"; import priceComponent from "./components/price.vue";
export default { export default {
components:{ components: {
avatar, avatar,
platfrom, platfrom,
commodityComponent, commodityComponent,
@ -171,14 +204,28 @@
bar_code_dis: false, bar_code_dis: false,
merId: '', //id merId: '', //id
product_id: '', //id product_id: '', //id
import: 0, //
code: '', // code: '', //
show: false, // show: false, //
image: false, // image: false, //
setFormData:{ setFormData: {
store_name: '', store_name: '',
imageList: [], imageList: [],
cate_name: '', // attrValue: [],
cate_name: '', //
unit_name: '', // unit_name: '', //
cate_id: '', // id
mer_cate_id: '', //
mer_cate_name: '', //
spec_type: '0', // 0. 1
attr: [], //
specifica: '', //
// setSpecificaValue: '', //
// setSpecificaValue2: '',
delivery_way: [1, 2], // 1 2
delivery_free: '1', // 0 1
temp_id: '', // ID
tempName: '' //
}, },
platformClassificationData: [], // platformClassificationData: [], //
merchantClassification: [], // merchantClassification: [], //
@ -202,29 +249,102 @@
temp_id: [] temp_id: []
}, },
productItem: {} || [], productItem: {} || [],
showSpecType: false, //
spec_type: 0, //,0,1
}; };
}, },
onLoad(opt) { onLoad(opt) {
this.merId = Number(opt.mer_id); this.merId = Number(opt.mer_id);
this.product_id = opt.product_id; this.product_id = opt.product_id;
if(!opt.product_id)this.showCommodity=true; this.import = opt.import;
// if (!opt.product_id) this.showCommodity = true;
this.showCommodity = true;;
this.initData(); this.initData();
this.initClasiffy(); this.initClasiffy();
if(this.import==1){
this.getOpenerEventChannel().once('importAttrValue', (e) => {
this.attrValue = e.attrValue;
uni.setStorageSync('attrValue', JSON.stringify(e.attrValue));
this.attr = e.attr;
uni.setStorageSync('attr', JSON.stringify(e.attr));
this.setFormData = Object.assign({}, this.setFormData, e);
this.$nextTick(()=>{
this.$refs.commodityRef?.setDatas({
addGoodsSecoundData: {
is_good: this.setFormData.is_good, //
is_gift_bag: this.setFormData.is_gift_bag,
sort: this.setFormData.sort,
once_count: this.setFormData.once_count, //
video_link: this.setFormData.video_link,
},
goodsDis: {
store_name: this.setFormData.content?.title,
imageList: this.setFormData.content?.image
}
})
})
})
}
else if(this.product_id){
this.initDataEditData();
}
}, },
onBackPress() { onBackPress() {},
},
onShow() { onShow() {
// this.setFormData = Object.assign(this.setFormData, {
// "store_name": "",
// "imageList": [
// "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/457c6202311181745387896.jpeg",
// "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/185e2202311181745434402.jpeg"
// ],
// "cate_name": "",
// "unit_name": "",
// "cate_id": 445,
// "keyword": "22"
// })
// this.$nextTick(async () => {
// await this.$u.sleep(200)
// this.$refs.commodityRef.addGoodsSecoundData = {
// "is_good": 1,
// "is_gift_bag": 0,
// "sort": "20",
// "once_count": "",
// "video_link": "https://lihai001.oss-cn-chengdu.aliyuncs.com/media/7ce3d202311181816166215.mp4"
// }
// this.$refs.commodityRef.goodsDis = {
// "store_name": "",
// "imageList": [
// "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/fb73d202311181751262661.png"
// ]
// }
// this.$refs.priceRef.singleSpecification = {
// "price": "1",
// "cost": "1",
// "stock": "11",
// "ot_price": "",
// "procure_price": "",
// "bar_code": "666",
// "weight": "10",
// "volume": "5",
// "image": "",
// "extension_one": "",
// "extension_two": ""
// }
// })
}, },
beforeDestroy() { beforeDestroy() {},
watch: {
'setFormData.imageList'(val) {
this.setFormData.image = val.length ? val[0] : '';
this.setFormData.slider_image = val.length ? serialize(val).splice(1) : [];
}
}, },
methods: { methods: {
// //
initDataEditData() { initDataEditData() {
this.setFormData = { this.setFormData = {
imageList: [], imageList: [],
attrValue: [],
specification: '', specification: '',
image: '', // image: '', //
slider_image: '', // slider_image: '', //
@ -241,20 +361,16 @@
spec_type: '0', // 0. 1 spec_type: '0', // 0. 1
attr: [], // attr: [], //
specifica: '', // specifica: '', //
setSpecificaValue: '', // // setSpecificaValue: '', //
setSpecificaValue2: '', // // setSpecificaValue2: '', //
delivery_way: [], // 1 2 delivery_way: [], // 1 2
delivery_free: '0', // 0 1 delivery_free: '0', // 0 1
temp_id: '', // ID temp_id: '', // ID
tempName: '' // tempName: '' //
}; };
if (getStorage('editGoodsDetils')) { productDetail(this.merId, this.product_id).then(async (res) => {
removeStorage('editGoodsDetils'); this.showCommodity = true;
} if (res.data.content_arr.length > 0) res.data.content = res.data.content_arr;
productDetail(this.merId, this.product_id).then(res => {
setStorage('editGoodsDetils', res.data);
if(res.data.content_arr.length>0) res.data.content = res.data.content_arr;
this.$store.commit('setStorage', res.data);
let editGoodsDetils = res.data; let editGoodsDetils = res.data;
Object.keys(this.setFormData).forEach(item => { Object.keys(this.setFormData).forEach(item => {
this.setFormData[item] = editGoodsDetils[item]; this.setFormData[item] = editGoodsDetils[item];
@ -269,47 +385,55 @@
item => item item => item
.category && item.category.cate_name).join(',') : ''; .category && item.category.cate_name).join(',') : '';
this.setFormData.brand_name = editGoodsDetils.brand ? editGoodsDetils.brand.brand_name : ''; this.setFormData.brand_name = editGoodsDetils.brand ? editGoodsDetils.brand.brand_name : '';
// if(typeof res.data.content == 'string')res.data.content = JSON.parse(res.data.content);
if (this.setFormData.spec_type == 1) { //
if (editGoodsDetils.attr.length) { this.$refs.commodityRef.setDatas({
this.setFormData.specifica = '点击修改规格' addGoodsSecoundData: {
} is_good: res.data.is_good, //
if (editGoodsDetils.attrValue.length) { is_gift_bag: res.data.is_gift_bag,
this.setFormData.setSpecificaValue2 = '点击修改价格' sort: res.data.sort,
once_count: res.data.once_count, //
video_link: res.data.video_link,
},
goodsDis: {
store_name: res.data.content?.title,
imageList: res.data.content?.image
} }
})
//
if (this.setFormData.spec_type == 0) {
this.$refs.priceRef.setDatas(res.data.attrValue[0]);
} }
if (editGoodsDetils.spec_type == 0) {
setStorage('singleSpecification', editGoodsDetils.attrValue[0]);
if (editGoodsDetils.attrValue.length) {
this.setFormData.setSpecificaValue = '点击修改价格'
}
}
setStorage('attrValue', editGoodsDetils.attrValue);
editGoodsDetils.temp && (this.setFormData.tempName = editGoodsDetils.temp.name); editGoodsDetils.temp && (this.setFormData.tempName = editGoodsDetils.temp.name);
setStorage('canChange', true);
hideLoading(); hideLoading();
this.showCommodity = true;
}); });
}, },
// //
async initClasiffy() { async initClasiffy() {
this.merchantClassification = (await storeClassifyLst(this.merId)).data; this.merchantClassification = (await storeClassifyLst(this.merId)).data;
}, },
async initData() { initData() {
// //
this.brand = (await categoryBrandlist(this.merId)).data; categoryBrandlist(this.merId).then((res)=>{
this.brand = res.data;
}).catch(e=>{
console.log(e);
});
// //
let { data } = await categoryList(this.merId); categoryList(this.merId).then((res)=>{
data.forEach((item1)=>{ res.data.forEach((item1) => {
item1.children.forEach((item2)=>{ item1.children.forEach((item2) => {
item2.children = null; item2.children = null;
})
}) })
this.platformClassificationData = res.data;
}).catch(e=>{
console.log(e);
}) })
this.platformClassificationData = data;
}, },
// //
updateCode(e){ updateCode(e) {
this.code = e + ''; this.code = e + '';
}, },
// //
@ -450,12 +574,117 @@
this.$refs.tempId.open(); this.$refs.tempId.open();
}); });
}, },
// //
submitCreatedGoods() { submitCreatedGoods() {
console.log('创建商品'); console.log('创建商品');
console.log('商品数据', this.setFormData); // return console.log('', this.setFormData.attr);
console.log('是否推荐', this.$refs.commodityRef.addGoodsSecoundData);
console.log('商品详情', this.$refs.commodityRef.goodsDis, this.$refs.commodityRef.store_name);
if(this.setFormData.spec_type==0){
console.log('价格库存', this.$refs.priceRef.singleSpecification);
}
let postData = {
...this.setFormData,
...this.$refs.commodityRef.addGoodsSecoundData,
content: {
title: this.$refs.commodityRef.goodsDis?.store_name || '',
image: this.$refs.commodityRef.goodsDis?.imageList || []
},
video_link: this.$refs.commodityRef.addGoodsSecoundData.video_link,
};
if(this.setFormData.spec_type==0){
postData.attrValue = [this.$refs.priceRef.singleSpecification];
}else postData.attrValue = this.setFormData.attrValue;
postData.stock = postData.attrValue[0]?.stock||0;
if(!postData.store_name||postData.store_name?.trim().length<=0)return Toast('请输入商品名称');
if(!postData.imageList||postData.imageList?.length<2)return Toast('请上传2张以上商品图片');
if(!postData.cate_name||postData.cate_name?.trim().length<=0)return Toast('请选择平台分类');
if(!postData.unit_name||postData.unit_name?.trim().length<=0)return Toast('请输入商品单位');
let userInfo = this.$store.state.app.userInfo;
if(typeof userInfo == 'string')userInfo= JSON.parse(userInfo);
let showFlag = '';
postData.attrValue.forEach(t=>{
if(userInfo?.mer_info?.type_code=="TypeSupplyChain" && (!t.procure_price||+t.procure_price<=0) ){
showFlag = '批发价不能小于0'
}
if(!t.price||+t.price<=0) showFlag = '零售价不能小于0';
if(!t.stock||+t.stock<=0) showFlag = '库存不能小于0';
if(!t.cost||+t.cost<=0) showFlag = '成本价不能小于0';
})
if(showFlag) {
if(this.setFormData.spec_type==1) showFlag+=', 请点击设置多规格设置';
return Toast(showFlag);
}
Loading();
if (this.product_id) {
productUpdate(this.merId, this.product_id, postData)
.then(res => {
hideLoading()
Modal('提交成功', '点击确定,返回商品管理', {
showCancel: false
}).then(() => {
uni.redirectTo({
url: '/pages/product/goodsOnSale/index?mer_id=' + this.merId
})
})
})
.catch(rej => {
Toast(rej);
});
} else {
productCreate(this.merId, postData)
.then(res => {
hideLoading();
Modal('提交成功', '点击确定,返回商品管理', {
showCancel: false,
}).then(() => {
if(this.import==1){
uni.$emit('importAttrValueOK', this.setFormData.import_id);
uni.navigateBack();
}
else uni.redirectTo({
url: '/pages/product/goodsOnSale/index?mer_id=' + this.merId
})
})
})
.catch(rej => {
Toast(rej);
});
}
}, },
//
changeSpecType(e){
if(this.setFormData.spec_type!=e.detail.value){
this.showSpecType = true;
}
this.spec_type = e.detail.value;
},
//
changeSpecType2(){
this.showSpecType = false;
this.setFormData.spec_type = this.spec_type + '';
this.setFormData.attrValue = [];
this.setFormData.attr = [];
},
//
navToSpecGood(){
uni.navigateTo({
url:'/pages/product/addGood/specGood?product_id=' + this.product_id,
success: (e) => {
// console.log(this.setFormData.attrValue, e);
e.eventChannel.emit('updateAttrValue', {
attrValue: JSON.parse(JSON.stringify(this.setFormData.attrValue)),
attr: JSON.parse(JSON.stringify(this.setFormData.attr))
});
uni.$once('updateSpecType', (e)=>{
this.setFormData.attrValue = JSON.parse(JSON.stringify(e.attrValue));
this.setFormData.attr = JSON.parse(JSON.stringify(e.attr));
})
}
})
}
} }
}; };
</script> </script>

View File

@ -164,13 +164,6 @@
}, },
mounted() { mounted() {
this.initData();
// this.$nextTick(()=>{
// this.initData();
// })
},
updated() {
// this.initData();
}, },
methods: { methods: {
videoshow() { videoshow() {
@ -179,52 +172,10 @@
this.$nextTick(() => { this.$nextTick(() => {
this.videoContext.play(); this.videoContext.play();
}) })
// this.video_link = this.formData.video_link;
// this.videoContext.requestFullScreen({ direction: 90 });
// this.videoContext.play(); this.videoplay = true;
}, },
initData() { setDatas(data){
let editGoodsDetils = {}; this.addGoodsSecoundData = data.addGoodsSecoundData;
if (getStorage('goodsDis')) { this.goodsDis = data.goodsDis;
this.disModel = true;
}
if (this.product_id) {
editGoodsDetils = this.$store.state.storage.storage;
Object.keys(this.addGoodsSecoundData).forEach(item => {
// console.log(item, editGoodsDetils[item]);
this.addGoodsSecoundData[item] = editGoodsDetils[item];
});
if (editGoodsDetils.content) {
this.goodsDis.imageList = editGoodsDetils.content.image;
this.goodsDis.store_name = editGoodsDetils.content.title;
this.store_name = editGoodsDetils.content.title;
// console.log(this.goodsDis, editGoodsDetils.content);
setStorage('goodsDis', {
store_name: editGoodsDetils.content.title,
imageList: editGoodsDetils.content.image
});
this.disModel = true;
}
setStorage('canChangeSecound', true);
return;
}else {
setStorage('goodsDis', {
store_name: '',
imageList: []
});
}
if (getStorage('addGoodsSecoundData')) {
Object.keys(this.addGoodsSecoundData).forEach(item => {
if (getStorage('addGoodsSecoundData')[item] || getStorage('addGoodsSecoundData')[item] == 0) {
this.addGoodsSecoundData[item] = getStorage('addGoodsSecoundData')[item];
}
});
}
},
lastStep() {
this.$emit('lastStep');
}, },
// //
isGood(e) { isGood(e) {

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="container"> <view class="container">
<select-form style="border-radius: 10rpx 10rpx 0 0;" :platformClassification="formList" :form="singleSpecification" <select-form :class="show_sku?'container_input':'border-radius'" :platformClassification="formList" :form="singleSpecification"
@input="input"></select-form> @input="input"></select-form>
<view class="more_than" @click="moreThanFlag?selectMoreThan():spliceMoreThan()"> <view class="more_than" @click="moreThanFlag?selectMoreThan():spliceMoreThan()">
<view v-if="moreThanFlag">更多</view> <view v-if="moreThanFlag">更多</view>
@ -22,10 +22,11 @@
components: { components: {
selectForm selectForm
}, },
props: ['product_id', 'bar_code'], props: ['product_id', 'bar_code', 'datas', 'show_sku'],
data() { data() {
return { return {
singleSpecification: { singleSpecification: {
// sku: '', //
price: '', // price: '', //
cost: '', // cost: '', //
stock: '', // stock: '', //
@ -34,7 +35,7 @@
bar_code: '', // bar_code: '', //
weight: '', // weight: '', //
volume: '', // volume: '', //
image: '', // image: '',
extension_one: '', extension_one: '',
extension_two: '' extension_two: ''
}, },
@ -106,27 +107,25 @@
} }
}, },
watch: { // watch: {
singleSpecification: { // singleSpecification: {
handler(val, old) { // handler(val, old) {
this.singleSpecification = val; // console.log('', val);
this.$emit('updateCode', val.bar_code); // this.singleSpecification = val;
}, // },
deep: true // deep: true
}, // },
}, // },
mounted() { mounted() {
if (getStorage('addGoodsFormData').image) { this.singleSpecification.bar_code = this.$props.bar_code + '';
this.singleSpecification.image = getStorage('addGoodsFormData').image; if(this.$props.datas){
} // this.singleSpecification = this.$props.datas;
if (getStorage('singleSpecification')) { // this.$set(this, 'singleSpecification', this.$props.datas);
Object.keys(this.singleSpecification).forEach(item => { Object.keys(this.singleSpecification).forEach((key)=>{
if (getStorage('singleSpecification')[item]) { this.singleSpecification[key] = this.$props.datas[key]
this.singleSpecification[item] = getStorage('singleSpecification')[item]
}
}) })
} }
this.singleSpecification.bar_code = this.$props.bar_code + '';
let userInfo = this.$store.state.app.userInfo; let userInfo = this.$store.state.app.userInfo;
if(typeof userInfo == 'string') userInfo = JSON.parse(userInfo); if(typeof userInfo == 'string') userInfo = JSON.parse(userInfo);
// //
@ -160,9 +159,13 @@
spliceMoreThan() { spliceMoreThan() {
this.moreThanFlag = true; this.moreThanFlag = true;
// this.formList.splice(!this.$props.product_id ? 2 : 1, this.formList.length); // this.formList.splice(!this.$props.product_id ? 2 : 1, this.formList.length);
let len = 4;
if(this.$store.state.app?.userInfo?.mer_info?.type_code=="TypeSupplyChain") if(this.$store.state.app?.userInfo?.mer_info?.type_code=="TypeSupplyChain")
this.formList.splice(4, this.formList.length); this.formList.splice(len, this.formList.length);
else this.formList.splice(3, this.formList.length); else this.formList.splice(len-1, this.formList.length);
},
setDatas(data){
this.singleSpecification = data;
}, },
input(val) { input(val) {
this.singleSpecification = val this.singleSpecification = val
@ -214,4 +217,11 @@
border-radius: 43rpx; border-radius: 43rpx;
} }
} }
.container_input{
margin-top: 0;
border-radius: 0;
}
.border-radius{
border-radius: 10rpx 10rpx 0 0;
}
</style> </style>

View File

@ -0,0 +1,776 @@
<template>
<view class="page">
<view class="mode">
<view class="line">
<view class="title">规格模板</view>
<picker style="flex: 1;" mode="selector" :range="attr_mode_list" range-key="template_name" @change="changAttrMode">
<view class="input">
<view>{{template_name}}</view>
<uni-icons type="right"></uni-icons>
</view>
</picker>
<view class="btn" @click="preAddMode(3)">添加模板</view>
</view>
<view class="btn-box" @click="settingSpec()">
<view class="btn">点击设置规格</view>
</view>
<uni-popup ref="modeRef" type="top">
<view class="mode-ref" style="min-height: 300rpx;width: 100%;background-color: #fff;">
<view style="height: 1rpx;"></view>
<scroll-view scroll-y style="max-height: 550rpx;min-height: 220rpx;">
<view class="mode-item" v-for="(item, index) in attr" :key="item+index">
<view class="mode-head">{{item.value}}</view>
<view class="mode-body">
<view class="box mode-body-box" v-for="(t, i) in item.detail" :key="t+i"
@click="deleteAttrTow(index, i)">
{{t}}<uni-icons type="close" color="#f84221" style="margin-left: 10rpx;"></uni-icons>
</view>
<view class="box mode-body-add" @click="addSpecTow(index)"><uni-icons type="plus" color="#333"
style="margin-right: 10rpx;"></uni-icons></view>
</view>
<view class="delete-spec" @click="deleteAttrOne(index)"><uni-icons type="close" color="#f84221"
style="margin-right: 10rpx;"></uni-icons></view>
</view>
<view v-if="attr.length==0" style="color: #ccc;height: 220rpx;text-align: center;display: flex;flex-direction: column;justify-content: center;align-items: center;">
<view>暂无规格</view>
<view>点击下方按钮添加新规格</view>
</view>
</scroll-view>
<view class="tab">
<view class="add-btn" @click="addSpecOne()">添加新规格</view>
<view class="save" @click="saveAttrMode()">保存模板</view>
</view>
</view>
</uni-popup>
<uni-popup ref="inputModeRef" type="center">
<view class="input-mode">
<view class="head-tips">
<view v-if="addAttrType==1">添加规格值</view>
<view v-else-if="addAttrType==2">添加新规格</view>
<view v-else>添加模板</view>
</view>
<view class="input-box">
<input v-if="addAttrType==4||addAttrType==3" v-model="attrMode" placeholder="请输入模板名称" />
<input v-if="addAttrType==2||addAttrType==3" v-model="attrName" placeholder="请输入规格名称" />
<input v-if="addAttrType!=4" v-model="attrDetail" placeholder="请输入规格值" />
</view>
<view class="show-btn-box">
<view class="cof prai" @click="addAttr()">确认</view>
<view class="can" @click="closeAddAttr()">取消</view>
</view>
</view>
</uni-popup>
</view>
<view style="height: 160rpx;"></view>
<avatar style="height: 1px;" @upload="doUpload" @getName="getImgName" quality="1" ref="avatar" selWidth="250upx"
selHeight="250upx">
</avatar>
<block v-for="(item,index) in attrValue" :key="item.uuid">
<view class="popup_group head_close">
<view class="popup_group_item " v-for="(value, key) in item.detail" :key="key">
<view class="popup_group_item_label">{{key}}</view>
<view class="popup_group_item_value">
<input :value="value" type="text" disabled placeholder="请填写规格名称" />
</view>
</view>
<view class="delete_btn" @click="deleteByIndex(index)">
<image style="width: 50%;height: 50%;" src="../static/images/close.png"></image>
</view>
<view class="popup_group_item">
<view class="popup_group_item_label">规格图片</view>
<view style="width: 120rpx;height: 120rpx;position: relative;">
<block v-if="item.image">
<image @click="clk(item.uuid)" style="width: 120rpx;height: 120rpx;border-radius: 10rpx;"
:src="item.image"></image>
<view class="close-icon" @click="deleteImage(item)">
<image style="width: 50%;height: 50%;" src="../static/images/close.png"></image>
</view>
</block>
<view v-else
style="width: 120rpx;height: 120rpx;display: flex;justify-content: center;align-items: center;border: 1rpx solid #ccc;border-radius: 10rpx;">
<image @click="clk(item.uuid)" style="height: 60rpx;width: 60rpx;" src="../static/images/creamer.png">
</image>
</view>
</view>
</view>
</view>
<priceComponent ref="priceRef" :product_id="product_id" :datas="item" :bar_code="item.bar_code"
@updateCode="updateCode" :show_sku="true">
</priceComponent>
</block>
<!-- <button class="add_btn" @click="addAttrValue">点击添加规格</button> -->
<view class="submit">
<button class="btn" @click="submitAttr">确认<text>({{attrValue.length}})</text></button>
</view>
<u-modal title="警告" content="删除后数据不可恢复,是否确认删除?" :show="showDelete" show-cancel-button @cancel="showDelete=false"
@confirm="deleteAttr()"></u-modal>
</view>
</template>
<script>
import priceComponent from "./components/price.vue";
import avatar from "@/components/yq-avatar/yq-avatar.vue";
import { TOKENNAME, HTTP_REQUEST_URL } from '@/config/app.js';
import { Toast } from "../../../libs/uniApi";
import {
specificationUpdate,
attrList,
specificationAdd
} from "@/api/product.js"
export default {
components: {
priceComponent,
avatar
},
data() {
return {
attrValue: [],
attr: [],
attr_mode_list: [], //
template_name: '点击选择模板', //
attr_mode: { //
"detail": {},
"sku": "",
"stock": 0,
"image": "",
"bar_code": "",
"cost": "",
"ot_price": "",
"price": "",
"volume": "",
"weight": "",
},
product_id: '',
uuid: '', //id
deleteIndex: '', //
showDelete: false,
userInfo: {},
addAttrType: 1, // , 1, 2, 3, 4
attrName: '', //
attrDetail: '', //
attrMode: '', //
changeAttr: 0, //
}
},
onLoad(options) {
this.product_id = options.product_id;
this.attrValue = JSON.parse(uni.getStorageSync('attrValue') || '[]');
this.attr = JSON.parse(uni.getStorageSync('attr') || '[]');
this.getOpenerEventChannel().once('updateAttrValue', (e) => {
e.attrValue.forEach((item, index) => {
item.uuid = Date.now() + '-' + Math.floor(Math.random() * 10000);
})
this.attrValue = e.attrValue;
uni.setStorageSync('attrValue', JSON.stringify(e.attrValue));
this.attr = e.attr;
uni.setStorageSync('attr', JSON.stringify(e.attr));
})
this.userInfo = this.$store.state.app.userInfo;
if (typeof this.userInfo == 'string') this.userInfo = JSON.parse(this.userInfo);
this.initAttrModeList();
},
methods: {
updateCode(e) {
console.log(e);
},
//
settingSpec() {
this.$refs.modeRef.open();
},
//
addSpecTow(index) {
this.attrDetail = '';
this.addAttrType = 1;
this.changeAttr = index;
this.$refs.inputModeRef.open();
},
//
addSpecOne() {
this.attrName = '';
this.attrDetail = '';
this.addAttrType = 2;
this.$refs.inputModeRef.open();
},
//
deleteAttrTow(i, j) {
if(this.attr[i].detail.length<=1){
return this.deleteAttrOne(i); // ,
}
this.attrValue = this.attrValue.filter(item=>{
return !(item.detail[this.attr[i].value] == this.attr[i].detail[j]);
})
this.attr[i].detail.splice(j, 1);
},
//
deleteAttrOne(i) {
let attr = this.attr[i];
if(this.attr.length==1){ // , ,
this.$set(this, 'attrValue', []);
this.attr.splice(i, 1);
return ;
}
//
this.attrValue.forEach(item => {
let a = item.sku.split(',');
a = a.filter(e=>e!=item.detail[attr.value]);
item.sku = a.join(',');
delete item.detail[attr.value];
})
//
this.attrValue = Array.from(new Set(this.attrValue.map(item => item.sku))).map(sku => {
return this.attrValue.find(item => item.sku === sku);
});
this.attr.splice(i, 1);
},
//
addAttrValueCard(){
let arr = this.computeAttr(this.attr); // sku
let t = [];
let keys = this.attr.map(e => { //
return e.value;
})
let temp = [];
arr.forEach((sku) => { // sku
if (this.attrValue.find(e => e.sku == sku)) return;
else {
let detail = {};
let t = sku.split(',');
keys.forEach((e, i) => { // detail
detail[e] = t[i];
})
temp.push(Object.assign({}, this.attr_mode, {
sku: sku,
detail: detail,
uuid: Date.now() + '-' + Math.floor(Math.random() * 10000) // uuid
})) //
}
})
setTimeout(() => {
this.attrValue = [...this.attrValue, ...temp] //
})
},
//
closeAddAttr() {
this.$refs.inputModeRef.close();
},
//
computeAttr(arr) {
let s = [];
arr.forEach(item => {
s.push(item.detail);
})
let t = this.getCombination(s);
t = t.map(item => {
if (typeof item == 'object') {
return item.join(',')
} else return item;
})
return t;
},
//
getCombination(arr) {
if (arr.length === 1) {
return arr[0];
}
var result = [];
var first = arr[0];
var rest = arr.slice(1);
for (var i = 0; i < first.length; i++) {
var subResult = this.getCombination(rest);
for (var j = 0; j < subResult.length; j++) {
result.push([first[i]].concat(subResult[j]));
}
}
return result;
},
//
addAttr() {
this.attrDetail = this.attrDetail.trim();
this.attrDetail = this.attrDetail.trim();
if (this.addAttrType == 1) { // 2
if (this.attr[this.changeAttr].detail.find(name => name == this.attrDetail)) {
this.closeAddAttr();
this.$nextTick(() => {
Toast('该规格已存在')
})
} else {
this.attr[this.changeAttr].detail.push(this.attrDetail);
this.closeAddAttr();
setTimeout(()=>{
this.addAttrValueCard();
})
}
} else if (this.addAttrType == 2) { // 1
if (this.attr.find(item => item.value == this.attrName)) {
this.closeAddAttr();
this.$nextTick(() => {
Toast('该规格已存在')
})
} else {
console.log('添加新规格');
this.attr.push({
value: this.attrName,
detail: [this.attrDetail]
});
if(this.attrValue.length){
this.attrValue.forEach((item) => {
item.detail[this.attrName] = this.attrDetail;
item.sku = item.sku + ',' + this.attrDetail;
})
}
else {
let detail = {};
detail[this.attrName] = this.attrDetail;
this.attrValue.push(Object.assign({}, this.attr_mode, {
sku: this.attrDetail,
detail: detail,
uuid: Date.now() + '-' + Math.floor(Math.random() * 10000)
}))
}
this.closeAddAttr();
}
} else if (this.addAttrType == 3 || this.addAttrType == 4){
this.addNewAttrMode();
}
},
//
saveAttrMode() {
if(this.attr.length<=0)return Toast('不可保存空模板');
if(this.attr_template_id){
this.addAttrType = 4;
let template = this.attr_mode_list.find(e=>e.attr_template_id==this.attr_template_id);
specificationUpdate(this.userInfo.service.mer_id, this.attr_template_id, {
attr_template_id: template.attr_template_id,
mer_id: template.attr_template_id,
template_name: template.template_name,
template_value: this.attr
}).then((res)=>{
this.$refs.modeRef.close();
this.$nextTick(()=>{
Toast('保存成功');
})
}).catch(err=>{
Toast(err)
})
}else {
this.preAddMode(4)
}
},
//
addNewAttrMode(){
this.attrMode = this.attrMode.trim(' ');
if(this.attrMode==''||this.attrMode===undefined||this.attrMode===null){
return Toast('模板名称不可为空')
}
let attr = [];
if(this.addAttrType==3){
attr[0] = {};
attr[0].value = this.attrName;
attr[0].detail = [];
attr[0].detail[0] = this.attrDetail;
}else attr = this.attr;
specificationAdd(this.userInfo.service.mer_id, {
template_name: this.attrMode,
template_value: attr
}).then((res)=>{
this.initAttrModeList();
this.closeAddAttr();
this.$nextTick(()=>{
this.$refs.modeRef.close();
this.$nextTick(()=>{
Toast('保存成功');
})
})
}).catch(err=>{
Toast(err)
})
},
//
preAddMode(type=3){
this.attrName = '';
this.attrDetail = '';
this.attrMode = '';
this.addAttrType = type;
this.$refs.inputModeRef.open();
},
//
submitAttr() {
if (this.attrValue.length < 1) return Toast('请至少添加一种规格');
let flag = true;
let str = '请填写完整信息';
this.attrValue.forEach((item, index) => {
Object.keys(this.$refs.priceRef[index].singleSpecification).forEach(key => {
item[key] = this.$refs.priceRef[index].singleSpecification[key];
})
if (flag) {
if (item.sku == undefined || item.sku == null || item.sku == '') {
flag = false;
str = '规格不能为空';
}
else if (!item.price||+item.price<=0) {
flag = false;
str = '零售价不能小于等于0';
}
else if (!item.stock||+item.stock<=0) {
flag = false;
str = '库存不能小于等于0';
}
else if (!item.cost||+item.cost<=0) {
flag = false;
str = '成本价不能小于等于0';
}
else if ((!item.procure_price||+item.procure_price<=0) && this.userInfo.mer_info.type_code == 'TypeSupplyChain') {
flag = false;
str = '批发价不能小于等于0';
}
}
})
if (!flag) return Toast(str);
else {
uni.$emit('updateSpecType', {
attr: this.attr,
attrValue: this.attrValue
});
uni.navigateBack();
}
},
//
clk(uuid) {
this.uuid = uuid;
let avatar = this.$refs.avatar;
avatar.fChooseImg(1, { selWidth: '350upx', selHeight: '350upx', inner: true });
},
doUpload(rsp) {
// console.log(rsp);
let that = this
uni.uploadFile({
url: HTTP_REQUEST_URL + '/api/upload/image/field',
filePath: rsp.path,
name: 'field',
formData: {
'filename': rsp.path,
'name': that.imgName
},
header: {
// #ifdef MP
"Content-Type": "multipart/form-data",
// #endif
[TOKENNAME]: 'Bearer ' + this.$store.state.app.token
},
success: (uploadFileRes) => {
let imgData = JSON.parse(uploadFileRes.data)
let item = this.attrValue.find(item => item.uuid == this.uuid);
item.image = imgData.data.path;
},
complete(res) {
// console.log(res)
}
});
},
getImgName(name) {
this.imgName = name
},
//
deleteImage(item) {
item.image = '';
},
//
addAttrValue() {
this.attrValue.push(Object.assign({}, this.attr_mode, {
uuid: Date.now() + '-' + Math.floor(Math.random() * 10000) // uuid
}))
},
//
deleteByIndex(index) {
this.deleteIndex = index;
this.showDelete = true;
},
//
deleteAttr() {
this.attrValue.splice(this.deleteIndex, 1);
this.showDelete = false;
},
//
initAttrModeList(){
attrList(this.userInfo.service.mer_id,{
page: 1,
limit: 10000
}).then((res)=>{
console.log(res);
this.attr_mode_list = res.data.list;
})
},
changAttrMode(e){
this.attr_template_id = this.attr_mode_list[e.detail.value].attr_template_id;
this.template_name = this.attr_mode_list[e.detail.value].template_name;
this.attr = JSON.parse(JSON.stringify(this.attr_mode_list[e.detail.value].template_value));
this.$set(this, 'attrValue', []);
this.addAttrValueCard();
}
},
onBackPress: () => {
}
}
</script>
<style lang="scss">
@import './scss/index.scss';
.page{
padding-bottom: 150rpx;
}
.popup_group {
margin-bottom: 0;
}
.popup_group_item {
border-bottom: 1rpx solid #eee;
padding-left: 18rpx !important;
.close-icon {
position: absolute;
top: 0;
right: 0;
width: 30rpx;
height: 30rpx;
border-radius: 10rpx;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
background-color: rgba(#000, 0.4);
color: #fff;
}
}
.head_close {
position: relative;
.delete_btn {
position: absolute;
top: -15rpx;
right: -15rpx;
width: 40rpx;
height: 40rpx;
display: flex;
justify-content: center;
align-items: center;
background-color: red;
color: #fff;
border-radius: 50%;
}
}
.add_btn {
width: 710rpx;
margin: 28rpx auto;
margin-bottom: 160rpx;
font-size: 30rpx;
padding: 28rpx;
color: #333;
}
.submit {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
background-color: #fff;
padding: 20rpx 0;
.btn {
width: 694rpx;
height: 80rpx;
margin: 0 auto;
background: #e93323;
border-radius: 43px;
display: flex;
align-items: center;
justify-content: center;
font-size: 15px;
color: #ffffff;
}
}
.mode {
width: 100%;
background-color: #fff;
position: fixed;
top: 0;
left: 0;
z-index: 1;
.line {
padding: 0 28rpx;
height: 80rpx;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 28rpx;
.btn {
background-color: #f84221;
color: #fff;
width: 140rpx;
height: 50rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 10rpx;
}
.input {
flex: 1;
padding: 0 16rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
}
.btn-box {
height: 80rpx;
display: flex;
justify-content: center;
align-items: center;
border-top: 1rpx solid #eee;
border-bottom: 1rpx solid #eee;
}
.mode-ref {
.mode-item {
margin: 20rpx;
border: 1rpx solid #eee;
border-radius: 10rpx;
font-size: 26rpx;
position: relative;
overflow: hidden;
.mode-head {
padding-top: 20rpx;
padding-left: 20rpx;
font-size: 32rpx;
font-weight: bold;
}
.mode-body {
display: flex;
flex-wrap: wrap;
padding: 20rpx;
padding-left: 0;
.box {
padding: 10rpx 20rpx;
border: 1px solid #f84221;
margin-left: 20rpx;
border-radius: 10rpx;
margin-bottom: 10rpx;
background-color: rgba(#f84221, 0.1);
color: #f84221;
display: flex;
justify-content: center;
align-items: center;
}
.mode-body-add {
border: 1rpx solid #ddd;
background-color: #fff;
color: #333;
}
}
.delete-spec {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
top: 0;
right: 0;
background-color: #eee;
padding: 5rpx;
border-radius: 0 0 0 10rpx;
color: #f84221;
}
}
.tab {
padding: 20rpx;
border-top: 1rpx solid #eee;
display: flex;
font-size: 28rpx;
.add-btn {
flex: 1;
background-color: #f84221;
color: #fff;
padding: 10rpx;
text-align: center;
border-radius: 10rpx;
}
.save {
color: #333;
border: 1rpx solid #ddd;
padding: 10rpx;
text-align: center;
border-radius: 10rpx;
margin-left: 20rpx;
}
}
}
.input-mode {
width: 694rpx;
padding: 28rpx;
font-size: 28rpx;
border-radius: 10rpx;
background-color: #fff;
.head-tips {
font-size: 32rpx;
font-weight: bold;
text-align: center;
padding-bottom: 20rpx;
}
.input-box {
input {
height: 80rpx;
margin-bottom: 20rpx;
font-size: 28rpx;
border: 1rpx solid #ddd;
padding: 0 20rpx;
border-radius: 10rpx;
}
}
.show-btn-box {
width: 100%;
display: flex;
justify-content: space-between;
.cof,
.can {
height: 80rpx;
line-height: 80rpx;
width: 300rpx;
text-align: center;
border: 1rpx solid #ddd;
border-radius: 10rpx;
}
.prai {
background-color: #f84221;
border: 1rpx solid #f84221;
color: #fff;
}
}
}
}
</style>

View File

@ -597,6 +597,7 @@
productDetail(this.merId, this.product_id).then(res => { productDetail(this.merId, this.product_id).then(res => {
setStorage('editGoodsDetils', res.data); setStorage('editGoodsDetils', res.data);
if(res.data.content_arr.length>0) res.data.content = res.data.content_arr; if(res.data.content_arr.length>0) res.data.content = res.data.content_arr;
if(typeof res.data.content == 'string')res.data.content = JSON.parse(res.data.content);
this.$store.commit('setStorage', res.data); this.$store.commit('setStorage', res.data);
let editGoodsDetils = res.data; let editGoodsDetils = res.data;
Object.keys(this.setFormData).forEach(item => { Object.keys(this.setFormData).forEach(item => {

View File

@ -55,7 +55,7 @@
<view v-if="item.is_show == 0 && item.status == 1 && type != 5" class="shop_button" @click="upperShelfAndLowerShelf(item, index)">上架</view> <view v-if="item.is_show == 0 && item.status == 1 && type != 5" class="shop_button" @click="upperShelfAndLowerShelf(item, index)">上架</view>
<view class="shop_button" v-if="type != 1 && type != 3" @click="handleDelete(item, index)">删除</view> <view class="shop_button" v-if="type != 1 && type != 3" @click="handleDelete(item, index)">删除</view>
<view class="shop_button" v-if="type == 5" @click="reduction(item, index)">恢复</view> <view class="shop_button" v-if="type == 5" @click="reduction(item, index)">恢复</view>
<navigator :url="`/pages/product/addGoods/index?mer_id=${merId}&product_id=${item.product_id}`" v-if="type != 5" class="shop_button" hover-class="none">编辑</navigator> <navigator :url="`/pages/product/addGood/addGood?mer_id=${merId}&product_id=${item.product_id}`" v-if="type != 5" class="shop_button" hover-class="none">编辑</navigator>
</view> </view>
</view> </view>
</view> </view>
@ -209,7 +209,7 @@ export default {
removeStorage(item); removeStorage(item);
} }
}); });
navigateTo(1, '/pages/product/addGoods/index', { mer_id: this.merId, type: 'edit', product_id: item.product_id, type: 'edit' }); navigateTo(1, '/pages/product/addGood/addGood', { mer_id: this.merId, type: 'edit', product_id: item.product_id, type: 'edit' });
}, },
// //
handleDelete(item, index) { handleDelete(item, index) {

View File

@ -9,6 +9,17 @@
<block> <block>
<swiper-item :class="{ active: 0 == swiperCur }"> <swiper-item :class="{ active: 0 == swiperCur }">
<view class="slide-navigator"> <view class="slide-navigator">
<picker class="item"
mode="multiSelector"
:range="[menuList,menuCList]"
:range-key="'cate_name'"
@columnchange="columnchange"
@change="changeMenu"
@cancel="cancelMenu"
>
<image mode='widthFix' class="image" src="@/static/images/daoru.png"></image>
<text class="text">分类筛选</text>
</picker>
<!-- <view class="item" hover-class='none' @click="jumpAddGoods"> <!-- <view class="item" hover-class='none' @click="jumpAddGoods">
<image mode='widthFix' class="image" src="../static/images/product_add.png"> <image mode='widthFix' class="image" src="../static/images/product_add.png">
</image> </image>
@ -74,6 +85,16 @@
</view> </view>
<view class="wrapper"> <view class="wrapper">
<view class='product_list'> <view class='product_list'>
<!-- <view class="menu_cls">
<u-scroll-list indicatorActiveColor='#FF6D20' :indicator="true">
<view class="menu_li" :class="{'menu_li_on': item.store_category_id==store_category_id}" @click="changeMerchant(item.store_category_id)" v-for="item,index in menuList"
:key="index">
<u--image class="image" :showLoading="true" :src="item.pic" width="87.62rpx" height="87.62rpx" shape="circle"
></u--image>
<view class="li_text" style="display: block;font-size: 26.29rpx;margin-top: 10rpx;">{{item.cate_name}}</view>
</view>
</u-scroll-list>
</view> -->
<view v-for="(item,index) in productList" :key="index" style="position: relative;width: 100%;"> <view v-for="(item,index) in productList" :key="index" style="position: relative;width: 100%;">
<view class='item' @click="yinc"> <view class='item' @click="yinc">
<view class='image'> <view class='image'>
@ -217,6 +238,9 @@
import { import {
getPreviewProDetail getPreviewProDetail
} from "@/api/store.js"; } from "@/api/store.js";
import {
getCategoryListLevel
} from '@/api/requesta.js';
export default { export default {
name: 'productList', name: 'productList',
components: { components: {
@ -230,6 +254,9 @@
page: 1, page: 1,
limit: 20 limit: 20
}, },
menuList: [], //
menuCList: [], //
cate_id: '', // id
loaded: false, loaded: false,
loading: false, loading: false,
mer_id: '', mer_id: '',
@ -263,7 +290,12 @@
onLoad(options) { onLoad(options) {
// this.mer_id = options.mer_id; // this.mer_id = options.mer_id;
this.getUserInfo() this.getUserInfo()
getCategoryListLevel({
type: 2
}).then(res => {
this.menuList = res.data;
this.menuCList = res.data[0].children;
})
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.where.page = 1 this.where.page = 1
@ -389,7 +421,7 @@
Fline(item) { Fline(item) {
this.checkboxList1 = item.attrValue this.checkboxList1 = item.attrValue
// console.log(this.checkboxList1.length) // console.log(this.checkboxList1.length)
if (this.checkboxList1.length>1){ if (this.checkboxList1.length>0){
navigateTo(1, '/pages/product/updateStock/updateStock', { navigateTo(1, '/pages/product/updateStock/updateStock', {
product_id: item.product_id product_id: item.product_id
}) })
@ -541,7 +573,7 @@
} }
}) })
} }
navigateTo(1, '/pages/product/addGoods/index', { navigateTo(1, '/pages/product/addGood/addGood', {
mer_id: this.mer_id mer_id: this.mer_id
}); });
}, },
@ -557,20 +589,24 @@
} }
}, },
getList: function(mer_id, ispage) { getList: function(mer_id, ispage) {
console.log('调用');
var that = this; var that = this;
if (that.loading || that.loaded) return; if (that.loading || that.loaded) return;
that.loading = true; that.loading = true;
if (ispage) { if (ispage) {
this.where.page = 1 this.where.page = 1
that.productList = [] this.$set(this, 'productList', []);
} }
if(this.cate_id.store_category_id){
that.where.cate_id = this.cate_id.store_category_id;
// mer_cate_id
}
productLstApi(mer_id, that.where).then( productLstApi(mer_id, that.where).then(
res => { res => {
that.loading = false; that.loading = false;
that.loaded = res.data.list.length < that.where.limit; that.loaded = res.data.list.length < that.where.limit;
that.productList.push.apply(that.productList, res.data.list); that.productList.push.apply(that.productList, res.data.list);
that.where.page = that.where.page + 1; that.where.page = that.where.page + 1;
}, },
error => { error => {
that.$util.Tips({ that.$util.Tips({
@ -580,23 +616,23 @@
); );
}, },
editGoods(item) { editGoods(item) {
let waitDeleteData = [ // let waitDeleteData = [
'addGoodsFormData', // 'addGoodsFormData',
'singleSpecification', // 'singleSpecification',
'attrValue', // 'attrValue',
'modifyPriceData', // 'modifyPriceData',
'addGoodsSecoundData', // 'addGoodsSecoundData',
'goodsDis', // 'goodsDis',
'editGoodsDetils', // 'editGoodsDetils',
'canChange', // 'canChange',
'canChangeSecound' // 'canChangeSecound'
]; // ];
waitDeleteData.forEach(item => { // waitDeleteData.forEach(item => {
if (getStorage(item)) { // if (getStorage(item)) {
removeStorage(item); // removeStorage(item);
} // }
}); // });
navigateTo(1, '/pages/product/addGoods/index', { navigateTo(1, '/pages/product/addGood/addGood', {
mer_id: item.mer_id, mer_id: item.mer_id,
product_id: item.product_id product_id: item.product_id
}); });
@ -689,6 +725,26 @@
more(index) { more(index) {
this.current = index this.current = index
}, },
//
columnchange(e){
if(e.detail.column==0){
this.menuCList = this.menuList[e.detail.value].children;
}
},
changeMenu(e){
let cate_id = this.menuList[e.detail.value[0]].children[e.detail.value[1]]||this.menuList[e.detail.value[0]]||'';
this.$set(this, 'cate_id', JSON.parse(JSON.stringify(cate_id)));
this.loading = false;
this.loaded = false;
this.getList(this.mer_id, true)
},
cancelMenu(){
this.loading = false;
this.loaded = false;
this.where.cate_id = null;
this.cate_id.store_category_id = null;
this.getList(this.mer_id, true)
}
}, },
} }
@ -1065,4 +1121,52 @@
} }
} }
} }
.menu_cls {
background-color: white;
// height: 199.77rpx;
border-radius: 10rpx;
padding: 20rpx 20rpx 0 20rpx;
margin-top: 20rpx;
font-size: 26.29rpx;
height: 220rpx;
width: 100%;
.menu_li {
// margin-right: 20rpx;
// background-color: red;
// width: 50vw;
display: flex;
flex-direction: column;
align-items: center;
min-width: 140rpx;
height: auto;
// width: 120rpx;
// display: inline-block;
.image{
border: 5rpx solid #fff;
}
.li_text{
flex: 1;
width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-align: center;
padding: 1rpx 10rpx 4rpx 10rpx;
}
}
.menu_li_on{
.image{
border: 5rpx solid #ff6d20;
border-radius: 50%;
}
.li_text{
background-color: #ff6d20;
border-radius: 2em;
color: #fff;
padding: 1rpx 10rpx 4rpx 10rpx;
}
}
}
</style> </style>

View File

@ -13,7 +13,10 @@
<image :src="item.image||short.image||defualtImg"></image> <image :src="item.image||short.image||defualtImg"></image>
</view> </view>
<view class="td sku"> <view class="td sku">
<view v-for="name in item.sku.split(',')">{{name}}</view> <block v-if="item.sku">
<view v-for="name in item.sku.split(',')">{{name}}</view>
</block>
<view v-else>{{short.store_name}}</view>
</view> </view>
<view class="td stock"> <view class="td stock">
<input type="number" v-model="item.stock" /> <input type="number" v-model="item.stock" />
@ -156,7 +159,7 @@ import { Toast } from '../../../libs/uniApi';
} }
} }
.sku{ .sku{
padding: 16rpx 0; padding: 16rpx 16rpx;
} }
} }
} }