|
@@ -97,10 +97,10 @@
|
|
<view class="other">
|
|
<view class="other">
|
|
<view class="money">
|
|
<view class="money">
|
|
<text>¥</text>
|
|
<text>¥</text>
|
|
- <text>{{money}}</text>
|
|
|
|
|
|
+ <text>{{specsInfo.sell_money}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="other_1">
|
|
<view class="other_1">
|
|
- 已选: <text>{{Selected}}</text>
|
|
|
|
|
|
+ 已选: <text>{{specsInfo.name}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="btn">
|
|
<view class="btn">
|
|
@@ -113,20 +113,22 @@
|
|
<text v-for="(item,index) in specs" :key="index" @click="toStyle(item,index)"
|
|
<text v-for="(item,index) in specs" :key="index" @click="toStyle(item,index)"
|
|
:class="{ 'style': isActive==index}">{{item.name}}
|
|
:class="{ 'style': isActive==index}">{{item.name}}
|
|
</text>
|
|
</text>
|
|
- <!-- <text class="group" v-if="item.can_group=='0'" @click="toGroup(item)">参团</text> -->
|
|
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="thr">
|
|
<view class="thr">
|
|
<text>数量</text>
|
|
<text>数量</text>
|
|
<view class="count">
|
|
<view class="count">
|
|
- <uni-number-box :min="1" :max="max" :disabled="disabled" v-model="num" @change="toCount">
|
|
|
|
|
|
+ <uni-number-box :min="1" :max="specsInfo.num" :disabled="disabled" v-model="num"
|
|
|
|
+ @change="toCount">
|
|
</uni-number-box>
|
|
</uni-number-box>
|
|
</view>
|
|
</view>
|
|
- <text>库存{{max}}</text>
|
|
|
|
|
|
+ <text>库存{{specsInfo.num||0}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="btn">
|
|
<view class="btn">
|
|
- <view @click="toBuy(type)" class="button1">{{type=='0'?'加入购物车':'立即购买'}}</view>
|
|
|
|
- <view @click="toGroup" class="button2">参团</view>
|
|
|
|
|
|
+ <text @click="toBuy(type)" :class="{ 'button': specsInfo._id&&specsInfo.can_group=='0'}">
|
|
|
|
+ {{type=='0'?'加入购物车':'立即购买'}}
|
|
|
|
+ </text>
|
|
|
|
+ <text v-if="specsInfo._id&&specsInfo.can_group=='0'" @click="toGroup" class="button2">参团</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
</uni-popup>
|
|
@@ -198,7 +200,7 @@
|
|
// 规格情况
|
|
// 规格情况
|
|
specs: [],
|
|
specs: [],
|
|
// 已选
|
|
// 已选
|
|
- Selected: '',
|
|
|
|
|
|
+ specsInfo: {},
|
|
// 是否显示返回顶部
|
|
// 是否显示返回顶部
|
|
isShow: false,
|
|
isShow: false,
|
|
topItem: '',
|
|
topItem: '',
|
|
@@ -213,10 +215,8 @@
|
|
type: '0',
|
|
type: '0',
|
|
// 选择规格
|
|
// 选择规格
|
|
isActive: -1,
|
|
isActive: -1,
|
|
- money: 0,
|
|
|
|
// 计数器
|
|
// 计数器
|
|
num: 1,
|
|
num: 1,
|
|
- max: 0,
|
|
|
|
// 分享
|
|
// 分享
|
|
share: {},
|
|
share: {},
|
|
};
|
|
};
|
|
@@ -306,29 +306,10 @@
|
|
// 参团
|
|
// 参团
|
|
toGroup() {
|
|
toGroup() {
|
|
const that = this;
|
|
const that = this;
|
|
- if (that.Selected) {
|
|
|
|
- let specs_id;
|
|
|
|
- let specs = that.specs.find(i => i.name == that.Selected)
|
|
|
|
- if (specs.can_group == '0') {
|
|
|
|
- specs_id = specs._id
|
|
|
|
- uni.navigateTo({
|
|
|
|
- url: `/pagesHome/group/index?specs_id=${specs_id}&goods_id=${that.id}`
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- uni.showToast({
|
|
|
|
- title: `该规格暂无团购`,
|
|
|
|
- icon: 'error'
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- uni.showModal({
|
|
|
|
- title: '提示',
|
|
|
|
- content: '请选择规格',
|
|
|
|
- confirmColor: '#ff0000',
|
|
|
|
- showCancel: false,
|
|
|
|
- success: function(res) {}
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ let specs_id = that.specsInfo._id
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: `/pagesHome/group/index?specs_id=${specs_id}&goods_id=${that.id}`
|
|
|
|
+ })
|
|
},
|
|
},
|
|
//主菜单跳转
|
|
//主菜单跳转
|
|
toPath(e) {
|
|
toPath(e) {
|
|
@@ -369,9 +350,7 @@
|
|
toStyle(e, index) {
|
|
toStyle(e, index) {
|
|
const that = this;
|
|
const that = this;
|
|
that.$set(that, `isActive`, index)
|
|
that.$set(that, `isActive`, index)
|
|
- that.$set(that, `Selected`, e.name)
|
|
|
|
- that.$set(that, `max`, e.num)
|
|
|
|
- that.$set(that, `money`, e.sell_money)
|
|
|
|
|
|
+ that.$set(that, `specsInfo`, e)
|
|
that.disabled = false;
|
|
that.disabled = false;
|
|
},
|
|
},
|
|
// 计数器
|
|
// 计数器
|
|
@@ -387,10 +366,8 @@
|
|
success: async function(res) {
|
|
success: async function(res) {
|
|
let user = that.$jwt(res.data);
|
|
let user = that.$jwt(res.data);
|
|
that.$set(that, `user`, user)
|
|
that.$set(that, `user`, user)
|
|
- if (that.Selected) {
|
|
|
|
- let specs_id;
|
|
|
|
- let specs = that.specs.find(i => i.name == that.Selected)
|
|
|
|
- if (specs) specs_id = specs._id
|
|
|
|
|
|
+ if (that.specsInfo._id) {
|
|
|
|
+ let specs_id = that.specsInfo._id
|
|
let data = {
|
|
let data = {
|
|
customer: user._id,
|
|
customer: user._id,
|
|
shop: that.shop._id,
|
|
shop: that.shop._id,
|
|
@@ -478,7 +455,8 @@
|
|
that.$set(that, `info`, res.data.goods)
|
|
that.$set(that, `info`, res.data.goods)
|
|
that.$set(that, `specs`, res.data.specs)
|
|
that.$set(that, `specs`, res.data.specs)
|
|
that.$set(that, `shop`, res.data.shop)
|
|
that.$set(that, `shop`, res.data.shop)
|
|
- if (res.data.specs.length > 0) that.$set(that, `money`, res.data.specs[0].sell_money)
|
|
|
|
|
|
+ if (res.data.specs.length > 0) that.$set(that.specsInfo, `sell_money`, res.data.specs[0]
|
|
|
|
+ .sell_money)
|
|
that.$set(that, `bannerList`, res.data.goods.file)
|
|
that.$set(that, `bannerList`, res.data.goods.file)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -870,8 +848,8 @@
|
|
position: fixed;
|
|
position: fixed;
|
|
bottom: 0;
|
|
bottom: 0;
|
|
|
|
|
|
- .button1 {
|
|
|
|
- width: 50vw;
|
|
|
|
|
|
+ text {
|
|
|
|
+ width: 100vw;
|
|
padding: 4vw 0;
|
|
padding: 4vw 0;
|
|
background-color: var(--fFB1Color);
|
|
background-color: var(--fFB1Color);
|
|
text-align: center;
|
|
text-align: center;
|
|
@@ -879,6 +857,10 @@
|
|
color: var(--mainColor);
|
|
color: var(--mainColor);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ .button {
|
|
|
|
+ width: 50vw;
|
|
|
|
+ }
|
|
|
|
+
|
|
.button2 {
|
|
.button2 {
|
|
width: 50vw;
|
|
width: 50vw;
|
|
padding: 4vw 0;
|
|
padding: 4vw 0;
|