zh
liuyongli 3 years ago
parent 60cf65d4e6
commit 68c711e1e4

@ -61,7 +61,12 @@
if (options && options.fromPage) {
this.fromPage = options.fromPage
}
this.getAddresslist();
// if (this.siteList == 0) {
// this.$u.toast("")
// return
// }
},
methods: {
//
@ -174,6 +179,10 @@
});
},
getAddresslist() {
// if (this.siteList.length == 0) {
// this.$u.toast("")
// return
// }
this.$u.post('/api/v1/users/address/list', {
UserID: uni.getStorageSync("userInfo").id
}).then(res => {
@ -183,7 +192,7 @@
return
}
this.siteList = res.data.data
console.log(this.siteList)
console.log('ll',this.siteList)
if (this.siteList.length == 0) {
this.isNull = true
} else {

@ -29,7 +29,7 @@
<text :class="goods.goodsChecked?'cuIcon-roundcheckfill text-red':'cuIcon-round text-gray'" @tap="checkGoods(shopIndex,goodsIndex)"></text>
</view>
<navigator :url="'/pages/goodsDetail/goodsDetail?id='+goods.goodsId" class="cart-goods-pic">
<u-lazy-load threshold="-100" :image="judgeCover(goods.mainPhotoUrl)" :index="index" :loading-img="IMAGE_URL + '/wxapp/null05.png'" height="200" border-radius="10" :error-img="IMAGE_URL + '/wxapp/null05.png'" img-mode="aspectFill"></u-lazy-load>
<u-lazy-load threshold="-100" :image="goods.img" :index="index" :loading-img="IMAGE_URL + '/wxapp/null05.png'" height="200" border-radius="10" :error-img="IMAGE_URL + '/wxapp/null05.png'" img-mode="aspectFill"></u-lazy-load>
</navigator>
<view class="cart-goods-msg flex-sub">
<view class="msg-top flex flex-direction justify-between clear align-start">
@ -97,6 +97,9 @@
},
onShow() {
this.getCartGoods()
console.log('商品数量',this.cartGoods.length);
var num = this.cartGoods.length
uni.setStorageSync('num',num)
},
methods: {
//
@ -144,7 +147,8 @@
for (let i = 0; i < this.cartGoods.length; i++) {
this.cartGoods[i].shopChecked = false
for (let j = 0; j < this.cartGoods[i].children.length; j++) {
this.cartGoods[i].children[j].goodsChecked = false
this.cartGoods[i].children[j].goodsChecked = false;
this.cartGoods[i].children[j].img = this.judgeCover(this.cartGoods[i].children[j].mainPhotoUrl);
}
}
}

@ -36,7 +36,12 @@
</view>
<navigator :url="'/pages/goodsDetail/goodsDetail?id='+goods.goodsId"
class="cart-goods-pic">
<u-lazy-load threshold="-100" :image="judgeCover(goods.mainPhotoUrl)" :index="index"
<!-- <u-lazy-load threshold="-100" :image="((goods.mainPhotoUrl.split('/'))[0] === 'http:'||(goods.mainPhotoUrl.split('/'))[0] === 'https:')?goods.mainPhotoUrl:(IMAGE_URL+goods.mainPhotoUrl)"
:index="index"
:loading-img="IMAGE_URL + '/wxapp/null05.png'" height="200" border-radius="10"
:error-img="IMAGE_URL + '/wxapp/null05.png'" img-mode="aspectFill">
</u-lazy-load> -->
<u-lazy-load threshold="-100" :image="goods.img" :index="index"
:loading-img="IMAGE_URL + '/wxapp/null05.png'" height="200" border-radius="10"
:error-img="IMAGE_URL + '/wxapp/null05.png'" img-mode="aspectFill">
</u-lazy-load>
@ -57,9 +62,9 @@
style="text-decoration: line-through;font-size: 20rpx;margin-left: 5rpx;color: #898989;">¥{{goods.originalPrice}}</text>
</view>
<!-- 用change事件初次加载会请求多次 -->
<uni-number-box v-model="goods.quantity" :min="1" :max="50" :input-width="72"
<u-number-box v-model="goods.quantity" :min="1" :max="50" :input-width="72"
:size="24" @change="changeNum(goods.shoppingTrolleyId,goods.quantity)">
</uni-number-box>
</u-number-box>
</view>
</view>
@ -126,7 +131,7 @@
this.getGoodsList()
},
methods: {
//
//
judgeCover(val) {
if (!val) {
return
@ -181,13 +186,13 @@
this.cartGoods[i].shopChecked = false
for (let j = 0; j < this.cartGoods[i].children.length; j++) {
this.cartGoods[i].children[j].goodsChecked = false;
this.cartGoods[i].children[j].img = this.judgeCover(this.cartGoods[i].children[j].mainPhotoUrl);
}
}
}
this.getSelectedGoods()
this.$forceUpdate()
console.log(this.cartGoods)
console.log('列表',this.cartGoods.length)
});
},
//
@ -277,6 +282,7 @@
this.totalCommission = totalCommission.toFixed(2)
// console.log(selectGoodsIds)
},
delGoods() {
if (this.selectGoodsIds.length == 0) {
this.$u.toast("至少选择一件商品");

@ -55,12 +55,12 @@
parentId: null,
keyword: "",
topPic: "",
pageId:0
pageId: 0
}
},
onLoad(options) {
console.log(options)
this.pageId=options.id
this.pageId = options.id
// if (options.index==0) {
// this.current = 3
// }else if(options.index==1){
@ -88,9 +88,9 @@
}
this.JDCateList = res.data.data
this.cateList = res.data.data
this.cateList.forEach((item,index)=>{
if(item.id==this.pageId){
this.current=index
this.cateList.forEach((item, index) => {
if (item.id == this.pageId) {
this.current = index
}
})
this.subCateList = res.data.data[0].sub
@ -105,9 +105,9 @@
return
}
this.cateList = res.data.data
this.cateList.forEach((item,index)=>{
if(item.id==this.pageId){
this.current=index
this.cateList.forEach((item, index) => {
if (item.id == this.pageId) {
this.current = index
}
})
this.parentId = this.cateList[this.current].id
@ -135,21 +135,34 @@
toSearch(id) {
// id,
// canneljingdong
let url = null
if (id) {
url = "/pages/search/search?cate_id=" + id +(this.JDCateList?'&channel=jingdong':'')
uni.navigateTo({
url
url: "/pages/search/search?cate_id=" + id
})
} else {
url: "/pages/search/search?keyword=" + this.keyword +(this.JDCateList?'&channel=jingdong':'')
uni.navigateTo({
url,
url: "/pages/search/search?keyword=" + this.keyword,
success: () => {
this.keyword = ""
}
})
}
// let url = url
// if (id) {
// url = "/pages/search/search?cate_id=" + id +(this.JDCateList?'&channel=jingdong':'')
// uni.navigateTo({
// url
// })
// } else {
// url: "/pages/search/search?keyword=" + this.keyword +(this.JDCateList?'&channel=jingdong':'')
// uni.navigateTo({
// url,
// success: () => {
// this.keyword = ""
// }
// })
// console.log("")
// }
},
//
async swichMenu(index, id) {

@ -255,7 +255,7 @@
// }
// })
let orderId = res.data.data.id
this.$u.post('/api/v1/pay/wxpay/order/create', {
this.$u.post('/api/v1/pay/wxminipay/order/create', {
userId: uni.getStorageSync("userInfo").id,
orderId
// wxType:"recook-weapp"

@ -321,7 +321,7 @@
</view>
<scroll-view scroll-x="true">
<view class="rec-con flex">
<view class="rec-item" v-for="(item,index) in goodsDetail.recommend"
<view class="rec-item" v-for="(item,index) in goodsDetail.recommends"
:key="index">
<!-- <image :src="item.mainPhotoUrl" mode=""></image> -->
<navigator class="item-image"
@ -376,7 +376,8 @@
<navigator url="../../packageA/goodsCart/index"
style="width: 100rpx;text-align: center;">
<text class="cuIcon-cart" style="font-size: 48rpx;"></text>
<text class="cuIcon-badge">{{salesVolumeInc}}</text>
<text class="cuIcon-badge"
v-if="shoppingTrolleyCount>0">{{shoppingTrolleyCount}}</text>
<view style="font-size: 20rpx;">购物车</view>
</navigator>
<template v-if="goodsDetail.isFavorite">
@ -671,13 +672,16 @@
address: "",
detail: "",
},
badgeCount:0
shoppingTrolleyCount: 0,
}
},
components: {
dynamics
},
onLoad(options) {
// var num = uni.getStorageSync('num');
// console.log('',num)
console.log('goodsDetail页面参数', options);
var pages = getCurrentPages();
//
@ -735,7 +739,7 @@
},
mounted() {
// this.getRegions()
console.log(uni.getStorageSync("userInfo").id)
// console.log(uni.getStorageSync("userInfo").id)
},
methods: {
//
@ -1012,6 +1016,7 @@
return
}
this.goodsDetail = res.data.data
this.shoppingTrolleyCount = res.data.data.shoppingTrolleyCount
// type
if (res.data.data.notice.type === 1) {
this.brandFirstImg = res.data.data.notice.img
@ -1104,8 +1109,6 @@
});
},
setBadge(cartArray){},
//
addcart() {
if (uni.getStorageSync("auth").token) {
@ -1128,6 +1131,7 @@
uni.showToast({
title: "已加入购物车"
})
this.shoppingTrolleyCount += this.buyNum
this.specModel(false)
})
} else {
@ -1152,15 +1156,39 @@
},
//
createOrder() {
console.log(this.sku_id)
console.log(this.checkedSku)
console.log('qq',this.sku_id)
console.log('aa',this.checkedSku)
// console.log('qq',this.sku_id)
// console.log('aa',this.checkedSku)
console.log('aaddd',this.addressList.length)
// if (this.addressList.length === 0 ) {
if (this.sku_id != '' && !this.selectedAddress) {
// this.$u.toast('');
uni.navigateTo({
url: '/packageA/address/index?fromPage=goodsDetail'
})
return
}
// else{
if (!this.sku_id) {
this.$u.toast("请选择商品规格")
return
} else if (this.jcookStockState != 1) {
}
// else if(this.sku_id != '' && !this.selectedAddress){
// uni.navigateTo({
// url: '/packageA/address/index?fromPage=goodsDetail'
// })
// return
// }
else if (this.jcookStockState != 1) {
this.$u.toast("当前无货")
return
}
// }
let sendData = {
UserID: uni.getStorageSync("userInfo").id,
SkuID: this.sku_id,
@ -1379,14 +1407,15 @@
</script>
<style lang="scss">
.cuIcon-badge{
.cuIcon-badge {
position: absolute;
top: 0;
left: 80rpx;
border-radius: 20rpx;
color: #f56c6c;
border-radius: 50rpx;
color: #ffffff;
background-color: #f71b1b;
display: inline-block;
font-size: 22rpx;
font-size: 24rpx;
height: 30rpx;
line-height: 30rpx;
padding: 0 10rpx;
@ -1395,6 +1424,7 @@
border: 2rpx solid #f56c6c;
}
.parameter-box {
.parameter-list {
display: flex;

Loading…
Cancel
Save