This commit is contained in:
魏啾 2024-08-06 14:17:53 +08:00
parent 1133bda264
commit 0fcb19cbdc
1 changed files with 32 additions and 31 deletions

View File

@ -109,9 +109,10 @@
</view> </view>
<view class="goods" @click="clickspecifications(item1,index,index1)" <view class="goods" @click="clickspecifications(item1,index,index1)"
v-for="(item1,index1) in item.products" :key="index1"> v-for="(item1,index1) in item.products" :key="index1">
<image class="goodsImg" v-if="item1.coverImg!=null" :lazy-load="true" <image class="goodsImg" v-if="item1.coverImg!=null" :lazy-load="true"
:src="`${item1.coverImg}?x-oss-process=image/resize,m_lfit,w_150,h_150`" mode="aspectFill"></image> :src="`${item1.coverImg}?x-oss-process=image/resize,m_lfit,w_150,h_150`"
<!-- <image class="goodsImg" v-if="item1.coverImg!=null" :lazy-load="true" mode="aspectFill"></image>
<!-- <image class="goodsImg" v-if="item1.coverImg!=null" :lazy-load="true"
:src="`${item1.coverImg}`" mode="aspectFill"></image> --> :src="`${item1.coverImg}`" mode="aspectFill"></image> -->
<image class="goodsImg" src="@/static/1.gif" mode="" v-else :lazy-load="true"></image> <image class="goodsImg" src="@/static/1.gif" mode="" v-else :lazy-load="true"></image>
<view v-if="item.name=='热销'" class="topSort" :class="'c'+(index1+1)">TOP{{index1+1}} <view v-if="item.name=='热销'" class="topSort" :class="'c'+(index1+1)">TOP{{index1+1}}
@ -276,9 +277,8 @@
{{item.name}} {{item.name}}
</view> </view>
<view class="flex-start"> <view class="flex-start">
<view class="shop_sku_box_item" v-for="(item1,index1) in item.children" :key="index1" <view class="shop_sku_box_item" v-for="(item1,index1) in item.children" :key="index1"
@click="morloe(item1,index,index1,item)" @click="morloe(item1,index,index1,item)" :style="{color:!item1.isGrounding?'#999':''}"
:style="{color:!item1.isGrounding?'#999':''}"
:class=" item.start == index1 ?'shop_sku_box_item_selected':''"> :class=" item.start == index1 ?'shop_sku_box_item_selected':''">
{{item1.info}} {{item1.info}}
</view> </view>
@ -310,7 +310,8 @@
</view> </view>
<view class="addShopping" :class="(amountcartNumber>0&&isSpec)?'active':''" <view class="addShopping" :class="(amountcartNumber>0&&isSpec)?'active':''"
@click="addShopping(specifications,specifications.indexa,specifications.indexb,'+',specifications.tagSnap == null ? '单规格':'')"> @click="addShopping(specifications,specifications.indexa,specifications.indexb,'+',specifications.tagSnap == null ? '单规格':'')">
{{skuBtnText}}</view> {{skuBtnText}}
</view>
</view> </view>
</view> </view>
</u-popup> </u-popup>
@ -344,8 +345,7 @@
cartLists_count: 0, cartLists_count: 0,
shopInfo: {}, // shopInfo: {}, //
shopProductList: {}, // shopProductList: {}, //
specifications: { specifications: {}, //
}, //
socketTicket: null, socketTicket: null,
amountcartNumber: 0, amountcartNumber: 0,
isSpec: true, isSpec: true,
@ -356,7 +356,7 @@
cartListsdatashow: false, // cartListsdatashow: false, //
showCart: false, showCart: false,
lastbottom: '', // lastbottom: '', //
scrollxleft: false, scrollxleft: true,
orderdetailFlag: true, orderdetailFlag: true,
} }
}, },
@ -366,6 +366,11 @@
} else { } else {
this.opacity = true this.opacity = true
} }
// if (e.scrollTop > this.topArr[0]) {
// this.scrollxleft = true
// } else {
// this.scrollxleft = false
// }
this.mainScroll(e) this.mainScroll(e)
}, },
computed: { computed: {
@ -400,7 +405,7 @@
}, },
onUnload() { onUnload() {
if ( this.socketTicket ) { if (this.socketTicket) {
this.socketTicket.Close() this.socketTicket.Close()
uni.$off('message') uni.$off('message')
} }
@ -678,9 +683,9 @@
this.isSpec = true; this.isSpec = true;
let res = await this.api.productquerySpec({ let res = await this.api.productquerySpec({
productId: item1.id, //id productId: item1.id, //id
querySpecList:[], querySpecList: [],
}) })
if( res.code == 0 ){ if (res.code == 0) {
this.specifications.tagSnap = res.data.map((item) => { this.specifications.tagSnap = res.data.map((item) => {
console.log(item) console.log(item)
let data = { let data = {
@ -699,7 +704,7 @@
}) })
} }
this.skuBtnText = `您还没选择${this.specifications.tagSnap[0].name}` this.skuBtnText = `您还没选择${this.specifications.tagSnap[0].name}`
// this.specifications.tagSnap.forEach((val, index, arr) => { //skuidname // this.specifications.tagSnap.forEach((val, index, arr) => { //skuidname
// console.log(val) // console.log(val)
// this.skuidname.push(val.children[0].info) // this.skuidname.push(val.children[0].info)
@ -722,48 +727,48 @@
*/ */
async morloe(e, index, index1, item) { async morloe(e, index, index1, item) {
let _this = this; let _this = this;
if ( !e.isGrounding ) { if (!e.isGrounding) {
return; return;
} }
let querySpecList = []; let querySpecList = [];
this.skuBtnText = "添加到购物车"; this.skuBtnText = "添加到购物车";
this.isSpec = true; this.isSpec = true;
if ( this.specifications.tagSnap[index].start != index1) { if (this.specifications.tagSnap[index].start != index1) {
this.$set(this.specifications.tagSnap[index], 'start', index1) this.$set(this.specifications.tagSnap[index], 'start', index1)
} else { } else {
this.$set(this.specifications.tagSnap[index], 'start', -1) this.$set(this.specifications.tagSnap[index], 'start', -1)
} }
_this.skuidname.splice(index, 1, e.info); //skuidname _this.skuidname.splice(index, 1, e.info); //skuidname
_this.specifications.tagSnap.forEach((v,i)=>{ _this.specifications.tagSnap.forEach((v, i) => {
if ( v.start >= 0 && v.start <= v.children.length) { if (v.start >= 0 && v.start <= v.children.length) {
querySpecList.push({ querySpecList.push({
name: v.name, name: v.name,
value: v.children[v.start].info value: v.children[v.start].info
}) })
} }
}) })
for (let i = 0; i < this.specifications.tagSnap.length; i++) { for (let i = 0; i < this.specifications.tagSnap.length; i++) {
if ( this.specifications.tagSnap[i].start < 0) { if (this.specifications.tagSnap[i].start < 0) {
this.isSpec = false; this.isSpec = false;
this.skuBtnText = `您还没选择${this.specifications.tagSnap[i].name}` this.skuBtnText = `您还没选择${this.specifications.tagSnap[i].name}`
break; // break; //
} }
} }
let res = await _this.api.productquerySpec({ let res = await _this.api.productquerySpec({
productId: item.id, //id productId: item.id, //id
querySpecList: querySpecList, querySpecList: querySpecList,
}) })
if( res.code == 0 ){ if (res.code == 0) {
res.data.forEach((v,e)=>{ res.data.forEach((v, e) => {
_this.$set(this.specifications.tagSnap[e], 'children', v.value) _this.$set(this.specifications.tagSnap[e], 'children', v.value)
// _this.specifications.tagSnap[e].children = v.value // _this.specifications.tagSnap[e].children = v.value
}) })
} }
console.log(_this.specifications.tagSnap) console.log(_this.specifications.tagSnap)
this.$forceUpdate(); this.$forceUpdate();
_this.hodgepodge(item, 2) _this.hodgepodge(item, 2)
}, },
@ -812,7 +817,7 @@
* 结算直接生成订单 * 结算直接生成订单
*/ */
orderdetail() { orderdetail() {
if ( !this.orderdetailFlag ) { if (!this.orderdetailFlag) {
return; return;
} }
this.orderdetailFlag = false; this.orderdetailFlag = false;
@ -965,11 +970,7 @@
let top = e.scrollTop; let top = e.scrollTop;
let index = 0; let index = 0;
// //
if (top + 2 > this.topArr[0]) {
this.scrollxleft = true
} else {
this.scrollxleft = false
}
for (let i = (this.topArr.length - 1); i >= 0; i--) { for (let i = (this.topArr.length - 1); i >= 0; i--) {
/* 在部分安卓设备上因手机逻辑分辨率与rpx单位计算不是整数滚动距离与有误差增加2px来完善该问题 */ /* 在部分安卓设备上因手机逻辑分辨率与rpx单位计算不是整数滚动距离与有误差增加2px来完善该问题 */
if ((top + 2) >= this.topArr[i] - this.HeighT) { if ((top + 2) >= this.topArr[i] - this.HeighT) {