|
@@ -43,7 +43,7 @@
|
|
|
{{item.name}}
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="list list_1" v-if="info.group_persons>info.persons.length">
|
|
|
+ <view class="list list_1" v-if="info.person_limit>info.persons.length">
|
|
|
<button type="default" size="mini" @tap.stop="toOpen">参团</button>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -51,6 +51,21 @@
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <uni-popup ref="popup" background-color="#fff" type="bottom">
|
|
|
+ <view class="content">
|
|
|
+ <view class="one">
|
|
|
+ <text>数量</text>
|
|
|
+ <view class="count">
|
|
|
+ <uni-number-box :min="1" :max="info.goodsSpec.num" v-model="num" @change="toCount">
|
|
|
+ </uni-number-box>
|
|
|
+ </view>
|
|
|
+ <text>库存{{info.goodsSpec.num||0}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="btn">
|
|
|
+ <text @click="onSubmit" class="button">确认参团</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </uni-popup>
|
|
|
</mobile-frame>
|
|
|
</template>
|
|
|
|
|
@@ -62,7 +77,8 @@
|
|
|
user: {},
|
|
|
info: {},
|
|
|
// 分享
|
|
|
- share: {}
|
|
|
+ share: {},
|
|
|
+ num: 1,
|
|
|
};
|
|
|
},
|
|
|
onLoad: function(e) {
|
|
@@ -75,6 +91,56 @@
|
|
|
that.search();
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 计数器
|
|
|
+ toCount(e) {
|
|
|
+ const that = this;
|
|
|
+ that.num = e;
|
|
|
+ },
|
|
|
+ // 确认开团 立即参团
|
|
|
+ async onSubmit() {
|
|
|
+ const that = this;
|
|
|
+ let user = that.user;
|
|
|
+ if (user._id) {
|
|
|
+ let data = {
|
|
|
+ customer: user._id,
|
|
|
+ shop: that.info.shop,
|
|
|
+ goods: that.info.goods._id,
|
|
|
+ goodsSpec: that.info.goodsSpec._id,
|
|
|
+ num: that.num,
|
|
|
+ type: '1',
|
|
|
+ group: that.id
|
|
|
+ }
|
|
|
+ let arr = await that.$api(`/util/checkCanBuy`, 'POST', data)
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ if (arr.data.result == true) {
|
|
|
+ that.clearPage();
|
|
|
+ if (that.id) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pagesHome/order/order?key=${arr.data.key}&group_id=${e._id}`
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pagesHome/order/order?key=${arr.data.key}`
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: arr.data.msg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: arr.errmsg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/login/index`
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
watchLogin() {
|
|
|
const that = this;
|
|
|
uni.getStorage({
|
|
@@ -90,6 +156,7 @@
|
|
|
if (that.id) {
|
|
|
let res = await that.$api(`/group/${that.id}`, `GET`);
|
|
|
if (res.errcode == '0') {
|
|
|
+ res.data.persons = res.data.persons.filter(i => i.status == '0')
|
|
|
that.$set(that, `info`, res.data);
|
|
|
let share = {
|
|
|
title: res.data.goods.name,
|
|
@@ -108,7 +175,7 @@
|
|
|
// 参团
|
|
|
toOpen() {
|
|
|
const that = this;
|
|
|
- console.log(that.info);
|
|
|
+ that.$refs.popup.open();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -276,4 +343,42 @@
|
|
|
flex-direction: column;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .content {
|
|
|
+ height: 60vw;
|
|
|
+
|
|
|
+ .one {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-start;
|
|
|
+ align-items: center;
|
|
|
+ margin: 0 2vw;
|
|
|
+ padding: 2vw 0;
|
|
|
+
|
|
|
+ text {
|
|
|
+ margin: 0 2vw 0 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ text:last-child {
|
|
|
+ margin: 0 0 0 2vw;
|
|
|
+ font-size: var(--font12Size);
|
|
|
+ color: var(--f85Color);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .btn {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ position: fixed;
|
|
|
+ bottom: 0;
|
|
|
+
|
|
|
+ .button {
|
|
|
+ width: 100vw;
|
|
|
+ padding: 4vw 0;
|
|
|
+ background-color: var(--fFB1Color);
|
|
|
+ text-align: center;
|
|
|
+ font-size: var(--font18Szie);
|
|
|
+ color: var(--mainColor);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
</style>
|