1、修改密码手机号未拿到处理

2、首页/商品列表增加了广告弹窗
3、会员充值新增赠送菜品,
4、会员菜品增加最大添加数量限制
5、首页/我的/会员卡/菜品页面的图片设置
6、小程序余额支付,会员卡充值成功后增加 会员余额变动订阅(后端还未做处理,目前可以订阅不会推送)
7、多规格商品部分规格售罄/下架增加角标提示
This commit is contained in:
GaoHao
2024-08-27 14:43:15 +08:00
parent d75da8ac9f
commit 22b9726de6
19 changed files with 933 additions and 252 deletions

View File

@@ -518,9 +518,8 @@
if (res.data == 1) {
this.showToastUppop('支付成功')
let _this = this
uni.requestSubscribeMessage({
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
tmplIds:["z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ","AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
complete() {
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + _this

View File

@@ -13,7 +13,7 @@
:navigateBacknavtitle='true'></navseat>
<!-- 顶部面板可添加所需要放在页面顶部的内容代码比如banner图 -->
<image class="panelimgbackground"
:src="shopInfo.storeInfo.coverImg||'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/topBanner.png'"
:src="shopExtend?shopExtend.value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/topBanner.png'"
mode="aspectFill">
</image>
<view class="panelone">
@@ -152,7 +152,7 @@
<view class="monthlySale">月售{{item1.stockNumber}}</view>
<view v-if="item1.isPauseSale != 0 || item.isSale == 0 " class="flex-between">
<view v-if="item1.isPauseSale != 0 || item1.isSale == 0 " class="flex-between">
<view class="money"><text class="money_num">{{ item1.lowPrice }}</text>/</view>
<view class="flex-end" >
<view class="sku-wrap flex-center" style="background-color: #CECECE;">
@@ -256,12 +256,12 @@
</view>
<view class="operation-wrap">
<view class="btn" v-if="item.number" >
<u-icon name="minus-circle-fill" color="#E9AB7A" size="50"></u-icon>
<u-icon name="minus-circle-fill" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,index,'-')"></view>
</view>
<text class="num" v-if="item.number">{{ item.number }}</text>
<view class="btn">
<u-icon name="plus-circle-fill" color="#E9AB7A" size="50"></u-icon>
<u-icon name="plus-circle-fill" :color="item.isVip == 1 ? '#CECECE' : '#E9AB7A'" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,index,'+')"></view>
</view>
</view>
@@ -330,11 +330,20 @@
<view class="shop_sku_box_name">
{{item.name}}
</view>
<!-- :class="item.start == index1 ?'shop_sku_box_item_selected':''"> -->
<view class="flex-start">
<view class="shop_sku_box_item" v-for="(item1,index1) in item.children" :key="index1"
@click="morloe(item1,index,index1,item)" :style="{color:!item1.isGrounding?'#999':''}"
:class=" item.start == index1 ?'shop_sku_box_item_selected':''">
@click="morloe(item1,index,index1,item)"
:class="{'shop_sku_box_item_selected': item.start == index1, 'disabled': !item1.disabled || !item1.isGrounding || item1.isPauseSale==1}"
>
{{item1.name}}
<view class="shop_sku_box_item_tip" v-if="item1.isGrounding == false">
<view>下架</view>
</view>
<view class="shop_sku_box_item_tip" v-if="item1.isPauseSale == 1 && item1.isGrounding == true">
<view>售罄</view>
</view>
<!-- disabled -->
</view>
</view>
</view>
@@ -369,15 +378,18 @@
</view>
</view>
</u-popup>
<popupad :forceUpdate="forceUpdate" :showPosition="'make_order'"></popupad>
</view>
</template>
<script>
import navseat from '@/components/navseat.vue'
import webSocketUtils from '@/common/js/websocket.js';
import popupad from '@/components/popupad.vue'
export default {
components: {
navseat
navseat,
popupad
},
data() {
return {
@@ -413,6 +425,8 @@
lastbottom: '', //元素最低端的距离
scrollxleft: true,
orderdetailFlag: true,
forceUpdate: false,
shopExtend: null,
}
},
onPageScroll(e) {
@@ -460,17 +474,28 @@
},
async onShow() {
let _this = this;
this.forceUpdate = !this.forceUpdate;
this.orderdetailFlag = true;
uni.pageScrollTo({
scrollTop: 0,
duration: 0
});
console.log(uni.cache.get('token'))
console.log(14)
_this.getLocation()
},
methods: {
/**
* 获取背景图
*/
async getShopExtend () {
let res = await this.api.getShopExtend({
shopId: uni.cache.get('shopUser'),
autokey: "shopInfo_bg" //index_bg my_bg member_bg shopInfo_bg
})
if ( res.code == 0) {
this.shopExtend = res.data;
}
},
navigateBacknav() {
uni.pro.switchTab('index/index')
},
@@ -500,35 +525,40 @@
* 获取定位
*/
getLocation() {
try {
uni.getLocation({
type: 'wgs84',
success: async (res) => {
let successres = await this.api.geocodelocation({
lng: res.longitude,
lat: res.latitude,
})
if (successres.code == 0) {
let datastorage = {
country: successres.data.addressComponent.country, // "中国"
province: successres.data.addressComponent.province, //province: "陕西省"
address: successres.data.addressComponent.city, //district: "西安市"
district: successres.data.addressComponent.district, //district: "未央区"
if ( !uni.cache.get('getLocationstorage') ) {
try {
uni.getLocation({
type: 'wgs84',
success: async (res) => {
let successres = await this.api.geocodelocation({
lng: res.longitude,
lat: res.latitude,
})
if (successres.code == 0) {
let datastorage = {
country: successres.data.addressComponent.country, // "中国"
province: successres.data.addressComponent.province, //province: "陕西省"
address: successres.data.addressComponent.city, //district: "西安市"
district: successres.data.addressComponent.district, //district: "未央区"
lng: res.longitude,
lat: res.latitude,
}
uni.cache.set('getLocationstorage', datastorage);
this.productqueryShop();
}
uni.cache.set('getLocationstorage', datastorage);
},
fail: async (err) => {
this.productqueryShop();
}
},
fail: async (err) => {
this.productqueryShop();
}
});
} catch (e) {
});
} catch (e) {
this.productqueryShop();
//TODO handle the exception
}
} else {
this.productqueryShop();
//TODO handle the exception
}
},
/**
@@ -547,6 +577,7 @@
this.shopInfo = res.data;
this.productqueryProduct() //list 数据
this.handlemessage() //监听websocket返回
this.getShopExtend();
} else {
setTimeout(() => {
uni.pro.switchTab('index/index')
@@ -562,14 +593,17 @@
this.shopProductList.productInfo[index].products[index1]['imgLoad'] = true;
// e.currentTarget.src
},
/**
* 跳转搜索
* @param {Object} e
*/
searchStatus (e) {
if ( e == "searchClick" ) {
uni.navigateTo({
url: '/pages/order_food/order_food_search?tableCode=' + uni.cache.get('tableCode')
});
}
console.log(e)
},
/**
@@ -584,7 +618,16 @@
if (b == '单规格') { //没有规格为空
this.skuidname = []
}
if ( a == "+" && item.isVip == 1 && item.cartNumber >= item.limitNumber){
uni.showToast({
title: '当前商品已达到最大赠送数量',
icon: 'none'
})
return;
}
let cartNumber = a == '+' ? item.cartNumber + 1 : item.cartNumber - 1;
this.hodgepodge(item, 1, a, cartNumber) //获取skuid /1添加购物车
},
@@ -598,7 +641,13 @@
*/
shopAdd(item, index, index1, a, b) {
if (a == "+") {
if ( item.isVip == 1 && this.amountcartNumber >= item.limitNumber){
uni.showToast({
title: '当前商品已达到最大赠送数量',
icon: 'none'
})
return;
}
if (this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) {
this.amountcartNumber = this.amountcartNumber + (this.skuSuit == 0 ? 1 : this.skuSuit);
} else {
@@ -624,6 +673,13 @@
return;
}
let num = 0;
if ( item.isVip == 1 && item.cartNumber >= item.limitNumber){
uni.showToast({
title: '当前商品已达到最大赠送数量',
icon: 'none'
})
return;
}
if (item.typeEnum == "normal") {
num = item.cartNumber + this.amountcartNumber;
} else {
@@ -633,6 +689,7 @@
"skuId": this.skuId,
"num": num, //数量
"type": a == '+' ? 1 : 0,
"isVip": item.isVip,
"productId": item.id, //商品id
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
@@ -649,10 +706,14 @@
*/
async cartListadd(item, index, c) {
try {
if ( c == "+" && item.isVip == 1){
return;
}
let params = {
"skuId": item.skuId,
"num": c == '+' ? item.number + 1 : item.number - 1, //数量
"type": c == '+' ? 1 : 0,
"isVip": item.isVip,
"productId": item.productId, //商品id
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
@@ -694,7 +755,7 @@
setNumber() {
// 处理购物车相同id的情况下 数量相加
var summedArray = this.cartLists.data.reduce((acc, current) => {
const existing = acc.find(item => item.productId === current.productId);
const existing = acc.find(item => item.productId === current.productId && item.isVip === current.isVip);
if (existing) {
existing.number += current.number;
} else {
@@ -709,7 +770,7 @@
return item.products.filter(e => {
e.cartNumber = 0;
return summedArray.find(i => {
if (e.id == i.productId) {
if (e.id == i.productId && e.isVip == i.isVip) {
e.cartNumber = i.number
}
})
@@ -762,7 +823,7 @@
productId: item1.id, //商品id
})
this.querySpecList = obj.data;
this.specifications.tagSnap = JSON.parse(item1.productSkuResult.tagSnap).map((item) => {
this.specifications.tagSnap = JSON.parse(item1.productSkuResult.tagSnap).map((item,index) => {
let res = {
id: item1.id, //商品id
name: item.name,
@@ -772,7 +833,9 @@
item.value.split(",").forEach((v, e) => {
res.children.push({
name: v,
isGrounding: false
disabled: index == 0 ? true : false,
isGrounding: index == 0 ? false : true,
isPauseSale: index == 0 ? 1 : 0,
})
})
return res
@@ -786,9 +849,17 @@
isSkuidname.push(this.specifications.tagSnap[0].children[o].name)
//筛选符合条件的规格列表
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
// 上下架初始化处理
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isGrounding) {
this.specifications.tagSnap[0].children[o].isGrounding = true
this.specifications.tagSnap[0].children[o].isGrounding = true;
break; // 终止循环
}
}
// 售罄状态初始化
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isPauseSale == 0) {
this.specifications.tagSnap[0].children[o].isPauseSale = 0;
break; // 终止循环
}
}
@@ -796,12 +867,7 @@
}
this.skuBtnText = `您还没选择${this.specifications.tagSnap[0].name}`
// this.specifications.tagSnap.forEach((val, index, arr) => { //初始化skuidname的数据 选择第一个
// console.log(val)
// this.skuidname.push(val.children[0].info)
// })
this.hodgepodge(this.specifications.tagSnap[0], 2) //获取skuid /2查找价格和数量
this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量
}
} catch (e) {
@@ -817,23 +883,28 @@
* @param {Object} item
*/
async morloe(e, index, index1, item) {
if (!e.isGrounding) {
if (!e.isGrounding || !e.disabled || e.isPauseSale == 1) {
return;
}
let querySpecList = [];
this.skuBtnText = "添加到购物车";
this.isSpec = true;
// 设置当前选中下标
if (this.specifications.tagSnap[index].start != index1) {
this.$set(this.specifications.tagSnap[index], 'start', index1)
} else {
this.$set(this.specifications.tagSnap[index], 'start', -1)
index = index - 1;
}
this.skuidname = [];
this.specifications.tagSnap.forEach((val, i, arr) => { //初始化skuidname的数据 选择第一个
// 选择规格下面的其他规格可点击状态重置
this.specifications.tagSnap.forEach((val, i, arr) => {
if (i > index) {
val.children.forEach((v1, e1) => {
v1.isGrounding = false;
v1.isGrounding = i == (index+1) ? false : true;
v1.isPauseSale = i == (index+1) ? 1 : 0;
v1.disabled = i == (index+1) ? true : false;
})
val.start = -1;
}
@@ -841,8 +912,8 @@
this.skuidname.push(val.children[val.start].name)
}
})
// this.skuidname.splice(index, 1, e.info); //替换skuidname的数据
// 获取下一个没有选中的分类
for (let i = 0; i < this.specifications.tagSnap.length; i++) {
if (this.specifications.tagSnap[i].start < 0) {
this.isSpec = false;
@@ -851,7 +922,6 @@
}
}
let filteredJson;
let isSkuidname = [];
//提前下一列规格循环,查看是否有下架规格
@@ -859,11 +929,18 @@
for (let o = 0; o < this.specifications.tagSnap[index + 1].children.length; o++) {
isSkuidname = JSON.parse(JSON.stringify(this.skuidname));
isSkuidname.push(this.specifications.tagSnap[index + 1].children[o].name)
//筛选符合条件的规格列表
// 上下架状态处理
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isGrounding) {
this.specifications.tagSnap[index + 1].children[o].isGrounding = true
this.specifications.tagSnap[index + 1].children[o].isGrounding = true;
break; // 终止循环
}
}
// 售罄状态处理
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isPauseSale == 0) {
this.specifications.tagSnap[index + 1].children[o].isPauseSale = 0;
break; // 终止循环
}
}
@@ -871,13 +948,8 @@
}
}
// res.data.forEach((v,e)=>{
// // this.$set(this.specifications.tagSnap[e], 'children', v.value)
// })
this.$forceUpdate();
this.hodgepodge(item, 2)
this.hodgepodge(this.specifications, 2)
},
/**
@@ -894,6 +966,7 @@
code: uni.cache.get('tableCode'),
shopId: uni.cache.get('shopUser'),
productId: item.id, //商品id
isVip: item.isVip, //商品id
spec_tag: this.skuidname.join(","),
})
this.salePrice = res.data.salePrice // 价格
@@ -904,6 +977,7 @@
"num": num, //数量
"type": c == '+' ? 1 : 0,
"productId": item.id, //商品id
"isVip": item.isVip,
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
"tableId": uni.cache.get('tableCode'),
@@ -1472,14 +1546,41 @@
border-radius: 8rpx;
font-size: 24upx;
margin-left: 56rpx;
background: #F5F5F5;
border: 2rpx solid #F5F5F5;
background: #EFEFEF;
border: 2rpx solid #EFEFEF;
position: relative;
color: #666666;
.shop_sku_box_item_tip{
width: 62rpx;
height: 47rpx;
// background-color: #CECECE;
text-align: right;
position: absolute;
top: 0;
right: 0;
background: linear-gradient(45deg, transparent, transparent 50%, #CECECE 50%, #CECECE 100%);
view{
font-size: 18rpx;
color: #666666;
transform: rotate(45deg);
position: absolute;
top: 5rpx;
right: 3rpx;
}
}
}
.shop_sku_box_item:nth-child(1) {
margin-left: 0;
}
.disabled{
color: #999;
background-color: #F5F5F5;
border: 2rpx solid #F5F5F5;
}
.shop_sku_box_item_noselected {
color: #666;
}

View File

@@ -144,7 +144,7 @@
</view>
<text class="num" v-if="item.number">{{ item.number }}</text>
<view class="btn">
<u-icon name="plus-circle-fill" color="#E9AB7A" size="50"></u-icon>
<u-icon name="plus-circle-fill" :color="item.isVip == 1 ? '#CECECE' : '#E9AB7A'" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,'+')"></view>
</view>
</view>
@@ -180,9 +180,17 @@
</view>
<view class="flex-start">
<view class="shop_sku_box_item" v-for="(item1,index1) in item.children" :key="index1"
@click="morloe(item1,index,index1,item)" :style="{color:!item1.isGrounding?'#999':''}"
:class=" item.start == index1 ?'shop_sku_box_item_selected':''">
@click="morloe(item1,index,index1,item)"
:class="{'shop_sku_box_item_selected': item.start == index1, 'disabled': !item1.disabled || !item1.isGrounding || item1.isPauseSale==1}"
>
{{item1.name}}
<view class="shop_sku_box_item_tip" v-if="item1.isGrounding == false">
<view>下架</view>
</view>
<view class="shop_sku_box_item_tip" v-if="item1.isPauseSale == 1 && item1.isGrounding == true">
<view>售罄</view>
</view>
<!-- disabled -->
</view>
</view>
</view>
@@ -271,13 +279,9 @@
HeighT() { //手机类型的尺寸 导航栏高度
return this.$store.getters.is_BarHeight
},
scrollHeight() {
return this.$store.getters.is_BarHeight.info.windowHeight - (this.$store.getters.is_BarHeight.heightBar +
this.$store.getters.is_BarHeight.customBar)
}
},
onLoad(e) {
console.log(e)
},
onUnload() {
@@ -340,14 +344,34 @@
}
},
/**
* 获取商品数据
*/
async productqueryProduct() {
let res = await this.api.productqueryProduct({
"shopId": uni.cache.get('shopUser'),
"productGroupId": ''
})
if (res.code == 0) {
this.shopProductList = res.data;
if (this.cartLists && this.cartLists.data && this.cartLists.data.length >= 0) {
this.setNumber()
}
}
},
/**
* 图片加载
*/
imageLoaded(item, index) {
this.searchList[index]['imgLoad'] = true;
},
/**
* 搜索内容
* @param {Object} val
*/
searchVal (val) {
this.searchList = [];
if ( val == "") {
@@ -373,6 +397,13 @@
if (b == '单规格') { //没有规格为空
this.skuidname = []
}
if ( a == "+" && item.isVip == 1 && item.cartNumber >= item.limitNumber){
uni.showToast({
title: '当前商品已达到最大赠送数量',
icon: 'none'
})
return;
}
let cartNumber = a == '+' ? item.cartNumber + 1 : item.cartNumber - 1;
this.hodgepodge(item, 1, a, cartNumber) //获取skuid /1添加购物车
},
@@ -387,7 +418,13 @@
*/
shopAdd(item, a) {
if (a == "+") {
if ( item.isVip == 1 && this.amountcartNumber >= item.limitNumber){
uni.showToast({
title: '当前商品已达到最大赠送数量',
icon: 'none'
})
return;
}
if (this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) {
this.amountcartNumber = this.amountcartNumber + (this.skuSuit == 0 ? 1 : this.skuSuit);
} else {
@@ -413,6 +450,13 @@
return;
}
let num = 0;
if ( item.isVip == 1 && item.cartNumber >= item.limitNumber){
uni.showToast({
title: '当前商品已达到最大赠送数量',
icon: 'none'
})
return;
}
if (item.typeEnum == "normal") {
num = item.cartNumber + this.amountcartNumber;
} else {
@@ -422,6 +466,7 @@
"skuId": this.skuId,
"num": num, //数量
"type": a == '+' ? 1 : 0,
"isVip": item.isVip,
"productId": item.id, //商品id
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
@@ -438,10 +483,14 @@
*/
async cartListadd(item, c) {
try {
if ( c == "+" && item.isVip == 1){
return;
}
let params = {
"skuId": item.skuId,
"num": c == '+' ? item.number + 1 : item.number - 1, //数量
"type": c == '+' ? 1 : 0,
"isVip": item.isVip,
"productId": item.productId, //商品id
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
@@ -483,7 +532,7 @@
setNumber() {
// 处理购物车相同id的情况下 数量相加
var summedArray = this.cartLists.data.reduce((acc, current) => {
const existing = acc.find(item => item.productId === current.productId);
const existing = acc.find(item => item.productId === current.productId && item.isVip === current.isVip);
if (existing) {
existing.number += current.number;
} else {
@@ -498,7 +547,7 @@
return item.products.filter(e => {
e.cartNumber = 0;
return summedArray.find(i => {
if (e.id == i.productId) {
if (e.id == i.productId && e.isVip == i.isVip) {
e.cartNumber = i.number
}
})
@@ -523,6 +572,7 @@
this.cartLists_count = 0;
}
},
/**
* 多规格选择
* @param {Object} item1
@@ -530,6 +580,7 @@
* @param {Object} index1
*/
async clickspecifications(item1, index1, type) {
console.log(item1)
if ( item1.isPauseSale != 0 || item1.isSale == 0) {
return;
}
@@ -544,13 +595,16 @@
this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量
this.skuBtnText = `添加到购物车`
} else {
console.log(3)
// 多规格数据处理
this.isSpec = false;
let obj = await this.api.productquerySpec({
productId: item1.id, //商品id
})
console.log(2)
this.querySpecList = obj.data;
this.specifications.tagSnap = JSON.parse(item1.productSkuResult.tagSnap).map((item) => {
console.log(1)
this.specifications.tagSnap = JSON.parse(item1.productSkuResult.tagSnap).map((item,index) => {
let res = {
id: item1.id, //商品id
name: item.name,
@@ -560,12 +614,13 @@
item.value.split(",").forEach((v, e) => {
res.children.push({
name: v,
isGrounding: false
disabled: index == 0 ? true : false,
isGrounding: index == 0 ? false : true,
isPauseSale: index == 0 ? 1 : 0,
})
})
return res
})
//初始化第一列规格可编辑
let filteredJson;
let isSkuidname = [];
@@ -574,18 +629,26 @@
isSkuidname.push(this.specifications.tagSnap[0].children[o].name)
//筛选符合条件的规格列表
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
// 上下架初始化处理
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isGrounding) {
this.specifications.tagSnap[0].children[o].isGrounding = true
this.specifications.tagSnap[0].children[o].isGrounding = true;
break; // 终止循环
}
}
// 售罄状态初始化
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isPauseSale == 0) {
this.specifications.tagSnap[0].children[o].isPauseSale = 0;
break; // 终止循环
}
}
}
console.log(1)
this.skuBtnText = `您还没选择${this.specifications.tagSnap[0].name}`
this.hodgepodge(this.specifications.tagSnap[0], 2) //获取skuid /2查找价格和数量
console.log(this.specifications)
this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量
}
} catch (e) {
@@ -601,23 +664,29 @@
* @param {Object} item
*/
async morloe(e, index, index1, item) {
if (!e.isGrounding) {
if (!e.isGrounding || !e.disabled || e.isPauseSale == 1) {
return;
}
let querySpecList = [];
this.skuBtnText = "添加到购物车";
this.isSpec = true;
// 设置当前选中下标
if (this.specifications.tagSnap[index].start != index1) {
this.$set(this.specifications.tagSnap[index], 'start', index1)
} else {
this.$set(this.specifications.tagSnap[index], 'start', -1)
index = index - 1;
}
this.skuidname = [];
this.specifications.tagSnap.forEach((val, i, arr) => { //初始化skuidname的数据 选择第一个
// 选择规格下面的其他规格可点击状态重置
this.specifications.tagSnap.forEach((val, i, arr) => {
if (i > index) {
val.children.forEach((v1, e1) => {
v1.isGrounding = false;
v1.isGrounding = i == (index+1) ? false : true;
v1.isPauseSale = i == (index+1) ? 1 : 0;
v1.disabled = i == (index+1) ? true : false;
})
val.start = -1;
}
@@ -625,8 +694,8 @@
this.skuidname.push(val.children[val.start].name)
}
})
// this.skuidname.splice(index, 1, e.info); //替换skuidname的数据
// 获取下一个没有选中的分类
for (let i = 0; i < this.specifications.tagSnap.length; i++) {
if (this.specifications.tagSnap[i].start < 0) {
this.isSpec = false;
@@ -634,8 +703,7 @@
break; // 终止循环
}
}
let filteredJson;
let isSkuidname = [];
//提前下一列规格循环,查看是否有下架规格
@@ -643,15 +711,22 @@
for (let o = 0; o < this.specifications.tagSnap[index + 1].children.length; o++) {
isSkuidname = JSON.parse(JSON.stringify(this.skuidname));
isSkuidname.push(this.specifications.tagSnap[index + 1].children[o].name)
//筛选符合条件的规格列表
// 上下架状态处理
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isGrounding) {
this.specifications.tagSnap[index + 1].children[o].isGrounding = true
this.specifications.tagSnap[index + 1].children[o].isGrounding = true;
break; // 终止循环
}
}
// 售罄状态处理
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isPauseSale == 0) {
this.specifications.tagSnap[index + 1].children[o].isPauseSale = 0;
break; // 终止循环
}
}
}
}
@@ -668,13 +743,15 @@
*/
async hodgepodge(item, a, c, num) { //此接口去获取商品id !!!赋值库存 数量 价格等
try {
// console.log(this.skuidname.join(","))
console.log(this.skuidname.join(","))
let res = await this.api.productqueryProductSku({
code: uni.cache.get('tableCode'),
shopId: uni.cache.get('shopUser'),
productId: item.id, //商品id
isVip: item.isVip, //商品id
spec_tag: this.skuidname.join(","),
})
console.log(res)
this.salePrice = res.data.salePrice // 价格
let data = null;
if (a == 1) { //1添加购物车 2是websocket返回这个商品的价格(应为不同的多规格商品返回不同的价格)
@@ -683,6 +760,7 @@
"num": num, //数量
"type": c == '+' ? 1 : 0,
"productId": item.id, //商品id
"isVip": item.isVip,
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
"tableId": uni.cache.get('tableCode'),
@@ -788,21 +866,7 @@
}
},
/**
* 获取商品数据
*/
async productqueryProduct() {
let res = await this.api.productqueryProduct({
"shopId": uni.cache.get('shopUser'),
"productGroupId": ''
})
if (res.code == 0) {
this.shopProductList = res.data;
if (this.cartLists && this.cartLists.data && this.cartLists.data.length >= 0) {
this.setNumber()
}
}
},
}
}
@@ -1080,14 +1144,38 @@
border-radius: 8rpx;
font-size: 24upx;
margin-left: 56rpx;
background: #F5F5F5;
border: 2rpx solid #F5F5F5;
background: #EFEFEF;
border: 2rpx solid #EFEFEF;
position: relative;
color: #666666;
.shop_sku_box_item_tip{
width: 62rpx;
height: 47rpx;
// background-color: #CECECE;
text-align: right;
position: absolute;
top: 0;
right: 0;
background: linear-gradient(45deg, transparent, transparent 50%, #CECECE 50%, #CECECE 100%);
view{
font-size: 18rpx;
color: #666666;
transform: rotate(45deg);
position: absolute;
top: 5rpx;
right: 3rpx;
}
}
}
.shop_sku_box_item:nth-child(1) {
margin-left: 0;
}
.disabled{
color: #999;
background-color: #F5F5F5;
border: 2rpx solid #F5F5F5;
}
.shop_sku_box_item_noselected {
color: #666;
}