|
@@ -35,11 +35,20 @@
|
|
|
</view>
|
|
|
<view class="buy-num" v-if="goodData.productType != 2">
|
|
|
<view class="buy-text">购买数量:</view>
|
|
|
- <view>
|
|
|
+ <!-- <view style="display: flex;">
|
|
|
<uni-icons type="minus-filled" size="20" color="#A67A54" @click="number>1?number--:''"></uni-icons>
|
|
|
<text class="buy-select">{{number}}</text>
|
|
|
+ <u-input
|
|
|
+ v-model="number"
|
|
|
+ type="number"
|
|
|
+ height="40"
|
|
|
+ placeholder=" "
|
|
|
+ :clearable="false"
|
|
|
+ input-align="center"
|
|
|
+ :custom-style="{width:'40px'}"/>
|
|
|
<uni-icons type="plus-filled" size="20" color="#A67A54" @click="number++"></uni-icons>
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
+ <CnumberBox @getNum="getNum" :isDisabled="true" minNum="1"></CnumberBox>
|
|
|
</view>
|
|
|
<view class="tab-box">
|
|
|
<view class="tab-col" :class="tabIndex == 1 ? 'tab-col-active' :''" @click="tabIndex = 1">产品介绍</view>
|
|
@@ -76,7 +85,7 @@
|
|
|
</view>
|
|
|
<uni-goods-nav :fill="true" :options="goodData.productType == 4 ? [] : options" @click="goToShop" @buttonClick="showPopup"
|
|
|
style="width: 100%; position: fixed; bottom: 0px;" :buttonGroup="goodData.productType == 2 ? buttonGroup2 : (goodData.productType == 4 ? (minePlant ? buttonGroup4 : buttonGroup3) : buttonGroup1)" />
|
|
|
- <uni-popup ref="popup" type="bottom">
|
|
|
+ <!-- <uni-popup ref="popup" type="bottom">
|
|
|
<view class="popup-box">
|
|
|
<view class="popup-good-info-box">
|
|
|
<image mode="aspectFill" class="popup-good-img" v-if="goodData.imgs.length" :src="goodData.imgs[0].imgPath"></image>
|
|
@@ -95,7 +104,7 @@
|
|
|
</view>
|
|
|
<uni-goods-nav :fill="true" :options="[]" :buttonGroup="buttonGroup1" @buttonClick="submitData" style="width: 100%; position: absolute; bottom: 0px;left:0px" />
|
|
|
</view>
|
|
|
- </uni-popup>
|
|
|
+ </uni-popup> -->
|
|
|
<u-top-tips ref="uTips"></u-top-tips>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -103,7 +112,11 @@
|
|
|
<script>
|
|
|
const NET = require('@/utils/request')
|
|
|
const API = require('@/config/api')
|
|
|
+ import CnumberBox from '@/pagesGood/CnumberBox.vue'
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ CnumberBox
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
// 从我的种植进入minePlant为true
|
|
@@ -135,6 +148,12 @@
|
|
|
options: [{
|
|
|
icon: 'shop',
|
|
|
text: '店铺',
|
|
|
+ },{
|
|
|
+ icon: 'cart',
|
|
|
+ text: '购物车',
|
|
|
+ info: 0,
|
|
|
+ infoBackgroundColor: '#52A63A',
|
|
|
+ infoColor:""
|
|
|
}],
|
|
|
buttonGroup1: [{
|
|
|
text: '加入购物车',
|
|
@@ -213,6 +232,10 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 获取子组件的购买数量
|
|
|
+ getNum(num) {
|
|
|
+ this.number = num
|
|
|
+ },
|
|
|
// 获取拍卖详情
|
|
|
getAuctionData() {
|
|
|
NET.request(API.getAuctionDetail + this.goodId, {}, 'GET').then(res => {
|
|
@@ -225,10 +248,16 @@
|
|
|
})
|
|
|
},
|
|
|
// 跳转商铺页
|
|
|
- goToShop() {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pagesGood/shopDetails?goodId=' + this.goodId
|
|
|
- });
|
|
|
+ goToShop(e) {
|
|
|
+ if (e.index == 0) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pagesGood/shopDetails?goodId=' + this.goodId
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: 'pages/cart/cart'
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
// 跳转评价页
|
|
|
goToEvaluate() {
|
|
@@ -253,21 +282,26 @@
|
|
|
url: '/pagesGood/goodDetails?goodId=' + item.productId + '&goodType=' + item.productType
|
|
|
});
|
|
|
},
|
|
|
- // 弹出购物弹窗
|
|
|
+ // 弹出购物弹窗->需求变更,不需要购物车弹窗,直接加入购物车
|
|
|
showPopup(e) {
|
|
|
uni.removeStorageSync('defaultAddress');
|
|
|
this.setGoodStorage()
|
|
|
if (this.goodData.productType == 2) {
|
|
|
+ //拍卖商品
|
|
|
uni.navigateTo({
|
|
|
url: '/pagesGood/auctionDetail?goodId=' + this.goodId
|
|
|
});
|
|
|
} else if (this.goodData.productType == 4) {
|
|
|
+ //共享种植商品
|
|
|
if (this.minePlant) {
|
|
|
+ // 如果是已买到的共享种植
|
|
|
if (e.index == 0) {
|
|
|
+ // 去视察
|
|
|
uni.navigateTo({
|
|
|
url: '/pagesGood/plantVideo?productId=' + this.goodId
|
|
|
});
|
|
|
} else {
|
|
|
+ // 去委托种植
|
|
|
uni.navigateTo({
|
|
|
url: '/pagesMain/entrustList?productId=' + this.goodData.productId + '&tenantCode=' + this.goodData.tenantCode +
|
|
|
'&productName=' + this.goodData.productName + '&areaSize=' + this.orderId + '&orderId=' + this.orderId
|
|
@@ -283,7 +317,37 @@
|
|
|
// }
|
|
|
}
|
|
|
} else {
|
|
|
- this.$refs.popup.open()
|
|
|
+ // 需求变更,不需要购物车弹窗,直接加入购物车
|
|
|
+ // this.$refs.popup.open()
|
|
|
+ if (e.index == 0) {
|
|
|
+ NET.request(API.addCart, {
|
|
|
+ productId: this.goodId,
|
|
|
+ productName: this.goodData.productName,
|
|
|
+ imgUrl: this.goodData.imgs.length ? this.goodData.imgs[0].imgPath : '',
|
|
|
+ bizPrice: this.goodData.bizPrice,
|
|
|
+ originalPrice: this.goodData.originalPrice,
|
|
|
+ productType: this.goodData.productType,
|
|
|
+ tenantCode: this.goodData.tenantCode,
|
|
|
+ buyNum: this.number
|
|
|
+ }, 'POST').then(res => {
|
|
|
+ this.$refs.uTips.show({
|
|
|
+ title: '加入购物车成功',
|
|
|
+ type: 'success',
|
|
|
+ })
|
|
|
+ this.$refs.popup.close()
|
|
|
+ }).catch(error => {
|
|
|
+ this.$refs.uTips.show({
|
|
|
+ title: '加入购物车失败',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ // 立即购买
|
|
|
+ this.setGoodStorage()
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pagesGood/orderPay?flag=2&orderType=1'
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// 存入商品信息缓存
|
|
@@ -310,36 +374,36 @@
|
|
|
},
|
|
|
// 提交操作
|
|
|
submitData(e) {
|
|
|
- if (e.index) {
|
|
|
- // 立即购买
|
|
|
- this.setGoodStorage()
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pagesGood/orderPay?flag=2&orderType=1'
|
|
|
- });
|
|
|
- } else {
|
|
|
- // 加入购物车
|
|
|
- NET.request(API.addCart, {
|
|
|
- productId: this.goodId,
|
|
|
- productName: this.goodData.productName,
|
|
|
- imgUrl: this.goodData.imgs.length ? this.goodData.imgs[0].imgPath : '',
|
|
|
- bizPrice: this.goodData.bizPrice,
|
|
|
- originalPrice: this.goodData.originalPrice,
|
|
|
- productType: this.goodData.productType,
|
|
|
- tenantCode: this.goodData.tenantCode,
|
|
|
- buyNum: this.number
|
|
|
- }, 'POST').then(res => {
|
|
|
- this.$refs.uTips.show({
|
|
|
- title: '加入购物车成功',
|
|
|
- type: 'success',
|
|
|
- })
|
|
|
- this.$refs.popup.close()
|
|
|
- }).catch(error => {
|
|
|
- this.$refs.uTips.show({
|
|
|
- title: '加入购物车失败',
|
|
|
- type: 'warning',
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
+ // if (e.index) {
|
|
|
+ // // 立即购买
|
|
|
+ // this.setGoodStorage()
|
|
|
+ // uni.navigateTo({
|
|
|
+ // url: '/pagesGood/orderPay?flag=2&orderType=1'
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // // 加入购物车
|
|
|
+ // NET.request(API.addCart, {
|
|
|
+ // productId: this.goodId,
|
|
|
+ // productName: this.goodData.productName,
|
|
|
+ // imgUrl: this.goodData.imgs.length ? this.goodData.imgs[0].imgPath : '',
|
|
|
+ // bizPrice: this.goodData.bizPrice,
|
|
|
+ // originalPrice: this.goodData.originalPrice,
|
|
|
+ // productType: this.goodData.productType,
|
|
|
+ // tenantCode: this.goodData.tenantCode,
|
|
|
+ // buyNum: this.number
|
|
|
+ // }, 'POST').then(res => {
|
|
|
+ // this.$refs.uTips.show({
|
|
|
+ // title: '加入购物车成功',
|
|
|
+ // type: 'success',
|
|
|
+ // })
|
|
|
+ // this.$refs.popup.close()
|
|
|
+ // }).catch(error => {
|
|
|
+ // this.$refs.uTips.show({
|
|
|
+ // title: '加入购物车失败',
|
|
|
+ // type: 'warning',
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // }
|
|
|
},
|
|
|
},
|
|
|
}
|