|
@@ -1,19 +1,19 @@
|
|
<template>
|
|
<template>
|
|
<view class="virtual">
|
|
<view class="virtual">
|
|
|
|
|
|
- <view class="box" v-for="(item,index) in goodsData" :key="index">
|
|
|
|
- <view class="goods-item" v-for="i in item.goods" :key="i.mainId" @click="handleItem(i,item.name)">
|
|
|
|
|
|
+ <view class="box" :key="index">
|
|
|
|
+ <view class="goods-item" v-for="(item,index) in goodsData" :key="index" @click="handleItem(item,item.name)">
|
|
<image class="icon" :src="i.mainImg" mode=""></image>
|
|
<image class="icon" :src="i.mainImg" mode=""></image>
|
|
<view class="goods-info">
|
|
<view class="goods-info">
|
|
<view class="goods-title">
|
|
<view class="goods-title">
|
|
- {{i.name}}
|
|
|
|
|
|
+ {{item.item_name}}
|
|
</view>
|
|
</view>
|
|
<view class="goods-desc">
|
|
<view class="goods-desc">
|
|
- {{item.name}}
|
|
|
|
|
|
+ {{item.item_name}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="price">
|
|
<view class="price">
|
|
- ¥{{i.calcPrice}}
|
|
|
|
|
|
+ ¥{{Number(item.channel_price).toFixed(2)}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -25,7 +25,7 @@
|
|
<image class="icon" :src="chooseInfo.mainImg" mode=""></image>
|
|
<image class="icon" :src="chooseInfo.mainImg" mode=""></image>
|
|
<view class="goods-info">
|
|
<view class="goods-info">
|
|
<view class="goods-title">
|
|
<view class="goods-title">
|
|
- {{chooseInfo.name}}
|
|
|
|
|
|
+ {{chooseInfo.item_name}}
|
|
</view>
|
|
</view>
|
|
<view class="goods-desc">
|
|
<view class="goods-desc">
|
|
{{chooseInfo.catalogName}}
|
|
{{chooseInfo.catalogName}}
|
|
@@ -34,7 +34,7 @@
|
|
<view class="price">
|
|
<view class="price">
|
|
<u-loading-icon v-if="loadingPrice" text="获取价格中"></u-loading-icon>
|
|
<u-loading-icon v-if="loadingPrice" text="获取价格中"></u-loading-icon>
|
|
<template v-else>
|
|
<template v-else>
|
|
- ¥{{chooseInfo.price}}
|
|
|
|
|
|
+ ¥{{chooseInfo.channel_price}}
|
|
</template>
|
|
</template>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -83,9 +83,17 @@
|
|
handleItem(item,catalogName) {
|
|
handleItem(item,catalogName) {
|
|
console.log(item,catalogName);
|
|
console.log(item,catalogName);
|
|
this.chooseInfo = JSON.parse(JSON.stringify(item) )
|
|
this.chooseInfo = JSON.parse(JSON.stringify(item) )
|
|
- this.chooseInfo.catalogName = catalogName
|
|
|
|
- this.show = true
|
|
|
|
- this.getVirtualInfo(item.mainId)
|
|
|
|
|
|
+ this.chooseInfo.catalogName = catalogName ||'无'
|
|
|
|
+ // this.show = true
|
|
|
|
+ let that = this
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url:`/detail/virtualGoods/detail`,
|
|
|
|
+ success: function(res) {
|
|
|
|
+ // 通过eventChannel向被打开页面传送数据
|
|
|
|
+ res.eventChannel.emit('data', that.chooseInfo)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ // this.getVirtualInfo(item.mainId)
|
|
},
|
|
},
|
|
open() {
|
|
open() {
|
|
},
|
|
},
|
|
@@ -99,87 +107,20 @@
|
|
getVirtuallist().then(res=>{
|
|
getVirtuallist().then(res=>{
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
if(res.state == 'Success'){
|
|
if(res.state == 'Success'){
|
|
- this.goodsData = res.content
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- getVirtualInfo(commodityId){
|
|
|
|
- this.loadingPrice = true
|
|
|
|
- getVirtualInfo({commodityId}).then(res=>{
|
|
|
|
- this.loadingPrice = false
|
|
|
|
- if(res.state == 'Success'){
|
|
|
|
- this.chooseInfo.price = res.content.realPrice
|
|
|
|
|
|
+ this.goodsData = res.content.products
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- // 创建订单
|
|
|
|
- handleBuy() {
|
|
|
|
- if (uni.getStorageSync('token')) {
|
|
|
|
- if(JSON.parse(uni.getStorageSync('userInfo')).setMealCode != 0){
|
|
|
|
- if(!this.form.account) return uni.showToast({
|
|
|
|
- title:'请输入充值账号',
|
|
|
|
- icon:'none'
|
|
|
|
- })
|
|
|
|
- let that = this
|
|
|
|
- uni.getSystemInfo({
|
|
|
|
- success(res){
|
|
|
|
- console.log(res.osName);
|
|
|
|
- if(res.osName == 'ios'){
|
|
|
|
- that.show = false
|
|
|
|
- that.iosShow = true
|
|
|
|
- }else{
|
|
|
|
- let info = {
|
|
|
|
- goodsId:that.chooseInfo.mainId,
|
|
|
|
- goodsName:that.chooseInfo.name,
|
|
|
|
- realPrice:that.chooseInfo.calcPrice,
|
|
|
|
- goodsImg:that.chooseInfo.mainImg,
|
|
|
|
- goodsDescribe:that.chooseInfo.catalogName,
|
|
|
|
- shopId:SHOP_ID,
|
|
|
|
- extend:JSON.stringify({account:that.form.account})
|
|
|
|
- }
|
|
|
|
- uni.navigateTo({
|
|
|
|
- url:`/detail/virtualGoods/pay`,
|
|
|
|
- success: function(res) {
|
|
|
|
- // 通过eventChannel向被打开页面传送数据
|
|
|
|
- res.eventChannel.emit('pay', info)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }else{
|
|
|
|
- uni.showModal({
|
|
|
|
- title:'此商品需要开通会员才能购买',
|
|
|
|
- cancelText:'下次再说',
|
|
|
|
- confirmText:'立即开通',
|
|
|
|
- success(res) {
|
|
|
|
- if(res.confirm){
|
|
|
|
- uni.navigateTo({
|
|
|
|
- url:'/my/memberCenter/index'
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- uni.showModal({
|
|
|
|
- title:'请登录',
|
|
|
|
- confirmText:'去登录',
|
|
|
|
- success(res){
|
|
|
|
- console.log(res);
|
|
|
|
- if(res.confirm){
|
|
|
|
- uni.navigateTo({
|
|
|
|
- url:'/login/login/login?redirect=/detail/virtualGoods/index'
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ // getVirtualInfo(commodityId){
|
|
|
|
+ // this.loadingPrice = true
|
|
|
|
+ // getVirtualInfo({commodityId}).then(res=>{
|
|
|
|
+ // this.loadingPrice = false
|
|
|
|
+ // if(res.state == 'Success'){
|
|
|
|
+ // this.chooseInfo.price = res.content.realPrice
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // },
|
|
|
|
+
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
this.getVirtuallist()
|
|
this.getVirtuallist()
|
|
@@ -279,67 +220,6 @@
|
|
align-self: center;
|
|
align-self: center;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- .content{
|
|
|
|
- padding: 24rpx;
|
|
|
|
- .popup-title{
|
|
|
|
- font-size: 32rpx;
|
|
|
|
- font-weight: bold;
|
|
|
|
- color: #222222;
|
|
|
|
- }
|
|
|
|
- .goods-box{
|
|
|
|
- display: flex;
|
|
|
|
- margin-top: 28rpx;
|
|
|
|
- .icon{
|
|
|
|
- width: 160rpx;
|
|
|
|
- height: 160rpx;
|
|
|
|
- border-radius: 16rpx;
|
|
|
|
- background: #F0F0F0;
|
|
|
|
- }
|
|
|
|
- .goods-info{
|
|
|
|
- display: flex;
|
|
|
|
- flex-direction: column;
|
|
|
|
- justify-content: space-around;
|
|
|
|
- flex: 1;
|
|
|
|
- margin-left: 20rpx;
|
|
|
|
- .goods-title{
|
|
|
|
- color: #222222;
|
|
|
|
- font-weight: bold;
|
|
|
|
- font-size: 36rpx;
|
|
|
|
- }
|
|
|
|
- .goods-desc{
|
|
|
|
- font-size: 28rpx;
|
|
|
|
- color: #AAAAAA;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- .price{
|
|
|
|
- color: $uni-color-primary;
|
|
|
|
- font-size: 36rpx;
|
|
|
|
- font-weight: bold;
|
|
|
|
- align-self: center;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- .notice{
|
|
|
|
- font-size: 24rpx;
|
|
|
|
- color: #AAAAAA;
|
|
|
|
- padding: 26rpx 0;
|
|
|
|
- border-bottom: 2rpx solid #F0F0F0;
|
|
|
|
- }
|
|
|
|
- .goods-describe{
|
|
|
|
- color: #222222;
|
|
|
|
- font-size: 24rpx;
|
|
|
|
- max-height: 480rpx;
|
|
|
|
- padding-top: 28rpx;
|
|
|
|
- overflow: auto;
|
|
|
|
- }
|
|
|
|
- .btn{
|
|
|
|
- width: 688rpx;
|
|
|
|
- height: 80rpx;
|
|
|
|
- line-height: 80rpx;
|
|
|
|
- background: linear-gradient(283deg, #F8D48C 0%, #FBDDA6 100%);
|
|
|
|
- border-radius: 46rpx;
|
|
|
|
- margin-top: 54rpx;
|
|
|
|
- font-size: 28rpx;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|