|
|
|
@ -154,18 +154,18 @@
|
|
|
|
|
<view class="flex justify-between align-center goods_box">
|
|
|
|
|
<view class="goods_icon">
|
|
|
|
|
<text>正品保障</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="goods_icon_hr">
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
<view class="goods_icon_hr">
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
<view class="goods_icon">
|
|
|
|
|
|
|
|
|
|
<text v-if="goodsDetail.storehouse === 1">国内仓</text>
|
|
|
|
|
<text v-if="goodsDetail.storehouse === 2">海外直邮</text>
|
|
|
|
|
<text v-if="goodsDetail.storehouse ===3">保税仓</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="goods_icon_hr">
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
<view class="goods_icon_hr">
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
<view class="goods_icon">
|
|
|
|
|
<text v-if="addressList.length > 1">{{addressList[addressList.length-1]}}</text>
|
|
|
|
@ -274,18 +274,18 @@
|
|
|
|
|
<view class="text-black" style="line-height: 80rpx;font-size: 28rpx;padding: 0 20rpx;">图文详情</view>
|
|
|
|
|
<view class="video" v-if="goodsDetail.video">
|
|
|
|
|
<video :src="IMAGE_URL+goodsDetail.video.url" style="width: 100%;display: block;" controls></video>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="detail-pics brandFirstImg" v-if="brandFirstImg">
|
|
|
|
|
<u-lazy-load threshold="-100" :image="IMAGE_URL+brandFirstImg"
|
|
|
|
|
:index="index" :loading-img="IMAGE_URL + '/null05.png'" :error-img="IMAGE_URL + '/null05.png'" ></u-lazy-load>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="detail-pics brandFirstImg" v-if="brandFirstImg">
|
|
|
|
|
<u-lazy-load threshold="-100" :image="IMAGE_URL+brandFirstImg"
|
|
|
|
|
:index="index" :loading-img="IMAGE_URL + '/null05.png'" :error-img="IMAGE_URL + '/null05.png'" ></u-lazy-load>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="detail-pics">
|
|
|
|
|
<u-lazy-load threshold="-100" :image="IMAGE_URL+item.url" v-for="(item,index) in pictures" :key="index"
|
|
|
|
|
:index="index" :loading-img="IMAGE_URL + '/null05.png'" :error-img="IMAGE_URL + '/null05.png'" ></u-lazy-load>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="detail-pics brandLastImg" v-if="brandLastImg">
|
|
|
|
|
<u-lazy-load threshold="-100" :image="IMAGE_URL+brandLastImg"
|
|
|
|
|
:index="index" :loading-img="IMAGE_URL + '/null05.png'" :error-img="IMAGE_URL + '/null05.png'" ></u-lazy-load>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="detail-pics brandLastImg" v-if="brandLastImg">
|
|
|
|
|
<u-lazy-load threshold="-100" :image="IMAGE_URL+brandLastImg"
|
|
|
|
|
:index="index" :loading-img="IMAGE_URL + '/null05.png'" :error-img="IMAGE_URL + '/null05.png'" ></u-lazy-load>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
@ -500,8 +500,8 @@
|
|
|
|
|
dynamics: [], //动态列表,
|
|
|
|
|
showBtn: false, //是否显示发布按钮
|
|
|
|
|
addressList: [],
|
|
|
|
|
address: null,
|
|
|
|
|
brandFirstImg:'',//图文详情第一张图片
|
|
|
|
|
address: null,
|
|
|
|
|
brandFirstImg:'',//图文详情第一张图片
|
|
|
|
|
brandLastImg:'',//图文详情最后一张图片
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
@ -521,6 +521,9 @@
|
|
|
|
|
if (options.q !== undefined) {
|
|
|
|
|
let url = decodeURIComponent(options.q)
|
|
|
|
|
options.id = url.split("/")[6];
|
|
|
|
|
if( url.split("/")[7] != undefined){
|
|
|
|
|
this.$store.commit('setinvite', url.split("/")[7]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (uni.getStorageSync("userInfo").roleLevel) {
|
|
|
|
|
this.roleLevel = uni.getStorageSync("userInfo").roleLevel
|
|
|
|
@ -606,7 +609,7 @@
|
|
|
|
|
this.showSpecs = flag
|
|
|
|
|
},
|
|
|
|
|
// 获取商品详情信息
|
|
|
|
|
getGoodsDetail() {
|
|
|
|
|
getGoodsDetail() {
|
|
|
|
|
|
|
|
|
|
this.$u.post('/api/v1/goods/detail/summary', {
|
|
|
|
|
userID: uni.getStorageSync("userInfo").id,
|
|
|
|
@ -618,25 +621,34 @@
|
|
|
|
|
this.$u.toast(res.data.msg);
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.goodsDetail = res.data.data
|
|
|
|
|
// 商样图片 根据type判断放在什么位置
|
|
|
|
|
if(res.data.data.notice.type === 1){
|
|
|
|
|
this.brandFirstImg = res.data.data.notice.img
|
|
|
|
|
this.brandLastImg = ''
|
|
|
|
|
}else if(res.data.data.notice.type === 2){
|
|
|
|
|
this.brandFirstImg = ''
|
|
|
|
|
this.brandLastImg = res.data.data.notice.img
|
|
|
|
|
}else{
|
|
|
|
|
this.brandFirstImg = res.data.data.notice.img
|
|
|
|
|
this.brandLastImg = res.data.data.notice.img
|
|
|
|
|
this.goodsDetail = res.data.data
|
|
|
|
|
// 商样图片 根据type判断放在什么位置
|
|
|
|
|
if(res.data.data.notice.type === 1){
|
|
|
|
|
this.brandFirstImg = res.data.data.notice.img
|
|
|
|
|
this.brandLastImg = ''
|
|
|
|
|
}else if(res.data.data.notice.type === 2){
|
|
|
|
|
this.brandFirstImg = ''
|
|
|
|
|
this.brandLastImg = res.data.data.notice.img
|
|
|
|
|
}else{
|
|
|
|
|
this.brandFirstImg = res.data.data.notice.img
|
|
|
|
|
this.brandLastImg = res.data.data.notice.img
|
|
|
|
|
}
|
|
|
|
|
// 规格只有一个 默认选中
|
|
|
|
|
if (this.goodsDetail.attributes.length === 1 && this.goodsDetail.attributes[0].children.length === 1) {
|
|
|
|
|
this.selectName[0] = this.goodsDetail.attributes[0].children[0].name
|
|
|
|
|
this.selectArr[0] = this.goodsDetail.attributes[0].children[0].id
|
|
|
|
|
this.subIndex[0] = 0
|
|
|
|
|
}
|
|
|
|
|
if (this.goodsDetail.attributes.length > 1) {
|
|
|
|
|
let arr = []
|
|
|
|
|
if (this.goodsDetail.attributes[0].children[0].id < this.goodsDetail.attributes[1].children[0].id) {
|
|
|
|
|
this.goodsDetail.attributes.forEach((item) => {
|
|
|
|
|
arr.unshift(item)
|
|
|
|
|
})
|
|
|
|
|
this.$set(this.goodsDetail, 'attributes', arr)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log(res.data.data)
|
|
|
|
|
console.log(res.data.data)
|
|
|
|
|
|
|
|
|
|
this.swiperImgList = res.data.data.mainPhotos
|
|
|
|
|
|
|
|
|
@ -664,7 +676,7 @@
|
|
|
|
|
for (let i in this.goodsDetail.sku) {
|
|
|
|
|
this.shopItemInfo[this.goodsDetail.sku[i].combineId.split(",").reverse().join(",")] = this.goodsDetail.sku[i]; //修改数据结构格式,改成键值对的方式,以方便和选中之后的值进行匹配
|
|
|
|
|
}
|
|
|
|
|
console.log(this.shopItemInfo)
|
|
|
|
|
// console.log(this.shopItemInfo)
|
|
|
|
|
this.checkItem();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -679,7 +691,7 @@
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.pictures = res.data.data.list
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -729,10 +741,11 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
//创建预购单 判断是否登录
|
|
|
|
|
|
|
|
|
|
//创建预购单 判断是否登录
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
createOrder() {
|
|
|
|
|
createOrder() {
|
|
|
|
|
console.log(this.sku_id)
|
|
|
|
|
console.log(this.checkedSku)
|
|
|
|
|
if (!this.sku_id) {
|
|
|
|
|
this.$u.toast("请选择商品规格")
|
|
|
|
@ -802,13 +815,13 @@
|
|
|
|
|
this.checkedSku = this.selectName.join(",")
|
|
|
|
|
this.checkItem();
|
|
|
|
|
},
|
|
|
|
|
checkItem() {
|
|
|
|
|
let option = this.goodsDetail.attributes
|
|
|
|
|
checkItem() {
|
|
|
|
|
let option = this.goodsDetail.attributes
|
|
|
|
|
let result = [] //定义数组储存被选中的值
|
|
|
|
|
for (let i in option) {
|
|
|
|
|
result[i] = this.selectArr[i] ? this.selectArr[i] : '';
|
|
|
|
|
}
|
|
|
|
|
// console.log(result)
|
|
|
|
|
console.log(option)
|
|
|
|
|
for (let i in option) {
|
|
|
|
|
let last = result[i]; //把选中的值存放到字符串last去
|
|
|
|
|
for (let k in option[i].children) {
|
|
|
|
@ -827,13 +840,14 @@
|
|
|
|
|
}
|
|
|
|
|
this.$forceUpdate(); //重绘
|
|
|
|
|
},
|
|
|
|
|
isMay(result) {
|
|
|
|
|
isMay(result) {
|
|
|
|
|
console.log(this.shopItemInfo, result)
|
|
|
|
|
for (var i in result) {
|
|
|
|
|
if (result[i] == '') {
|
|
|
|
|
return true; //如果数组里有为空的值,那直接返回true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// console.log(this.shopItemInfo[result])
|
|
|
|
|
console.log(this.shopItemInfo[result])
|
|
|
|
|
return this.shopItemInfo[result].inventory == 0 ? false : true; //匹配选中的数据的库存,若不为空返回true反之返回false
|
|
|
|
|
},
|
|
|
|
|
chooseAddress(e) {
|
|
|
|
@ -886,9 +900,9 @@
|
|
|
|
|
|
|
|
|
|
handClick(val) {
|
|
|
|
|
console.log(val)
|
|
|
|
|
wx.previewImage({
|
|
|
|
|
current: this.swiperList[val], // 当前显示图片的http链接
|
|
|
|
|
urls: this.swiperList // 需要预览的图片http链接列表
|
|
|
|
|
wx.previewImage({
|
|
|
|
|
current: this.swiperList[val], // 当前显示图片的http链接
|
|
|
|
|
urls: this.swiperList // 需要预览的图片http链接列表
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -962,19 +976,19 @@
|
|
|
|
|
|
|
|
|
|
.goods_box {
|
|
|
|
|
.goods_icon {
|
|
|
|
|
text-align: center;
|
|
|
|
|
text-align: center;
|
|
|
|
|
color: #CCCCCC;
|
|
|
|
|
width: 120rpx;
|
|
|
|
|
image {
|
|
|
|
|
width: 52rpx;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.goods_icon_hr{
|
|
|
|
|
flex: 1;
|
|
|
|
|
height: 1rpx;
|
|
|
|
|
border-bottom: 1rpx dashed #CCCCCC;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
.goods_icon_hr{
|
|
|
|
|
flex: 1;
|
|
|
|
|
height: 1rpx;
|
|
|
|
|
border-bottom: 1rpx dashed #CCCCCC;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1388,4 +1402,4 @@
|
|
|
|
|
content: none;
|
|
|
|
|
border-radius: 0;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
</style>
|
|
|
|
|