|
@@ -39,6 +39,28 @@
|
|
|
<uni-goods-nav :fill="true" :options="options" :button-group="buttonGroup" @click="onClick"
|
|
|
@buttonClick="buttonClick" style="margin-top: 20px;" />
|
|
|
</view>
|
|
|
+ <!-- 规格弹窗 -->
|
|
|
+ <uni-popup ref="popup" background-color="#fff" type="bottom" :is-mask-click="false">
|
|
|
+ <view class="popup">
|
|
|
+ <view class="close">
|
|
|
+ <text @click="toClose" class="iconfont icon-icon-cross-empty"></text>
|
|
|
+ </view>
|
|
|
+ <!-- 规格 -->
|
|
|
+ <view class="specs_1" v-if="popupShow=='1'">
|
|
|
+ <view class="info_1">
|
|
|
+ <scroll-view scroll-y="true" class="scroll-view">
|
|
|
+ <view class="list-scroll-view">
|
|
|
+ <view class="one">
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </scroll-view>
|
|
|
+ </view>
|
|
|
+ <view class="info_2">
|
|
|
+ <button @tap="toMarket">加入购物车</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </uni-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -46,8 +68,6 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- // 系统设置
|
|
|
- config: {},
|
|
|
// 商品id
|
|
|
id: '',
|
|
|
// 当前用户信息
|
|
@@ -56,6 +76,10 @@
|
|
|
info: {},
|
|
|
// 轮播图
|
|
|
fileList: [],
|
|
|
+ // 规格弹框
|
|
|
+ popupShow: '1',
|
|
|
+ // 规格数组
|
|
|
+ specList: [],
|
|
|
// 底部商品导航
|
|
|
options: [{
|
|
|
icon: 'shop',
|
|
@@ -64,7 +88,6 @@
|
|
|
{
|
|
|
icon: 'cart',
|
|
|
text: '购物车',
|
|
|
- info: 2,
|
|
|
infoBackgroundColor: '#007aff',
|
|
|
infoColor: "#f5f5f5"
|
|
|
}
|
|
@@ -73,18 +96,14 @@
|
|
|
text: '加入购物车',
|
|
|
backgroundColor: 'linear-gradient(90deg, #1E83FF, #0053B8)',
|
|
|
color: '#fff'
|
|
|
- }],
|
|
|
+ }]
|
|
|
}
|
|
|
},
|
|
|
onLoad: async function(e) {
|
|
|
const that = this;
|
|
|
that.$set(that, `id`, e.id || '');
|
|
|
- that.searchConfig();
|
|
|
- await that.search();
|
|
|
- },
|
|
|
- onShow: async function() {
|
|
|
- const that = this;
|
|
|
that.searchToken();
|
|
|
+ await that.search();
|
|
|
},
|
|
|
methods: {
|
|
|
searchToken() {
|
|
@@ -100,19 +119,6 @@
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- searchConfig() {
|
|
|
- const that = this;
|
|
|
- try {
|
|
|
- const res = uni.getStorageSync('config');
|
|
|
- if (res) that.$set(that, `config`, res);
|
|
|
- } catch (e) {
|
|
|
- uni.showToast({
|
|
|
- title: err.errmsg,
|
|
|
- icon: 'error',
|
|
|
- duration: 2000
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
// 查询商品详情
|
|
|
async search() {
|
|
|
const that = this;
|
|
@@ -128,11 +134,15 @@
|
|
|
return a.money - b.money
|
|
|
})
|
|
|
if (data) res.data.money = data[0].money
|
|
|
+ that.$set(that, `specList`, data);
|
|
|
that.$set(that, `info`, res.data);
|
|
|
that.$set(that, `fileList`, res.data.file);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ res = await that.$api(`/Cart/num`, 'GET', {
|
|
|
+ user: that.user._id
|
|
|
+ })
|
|
|
+ if (res.errcode == '0') that.$set(that.options[1], `info`, res.data);
|
|
|
},
|
|
|
onClick(e) {
|
|
|
uni.showToast({
|
|
@@ -141,8 +151,15 @@
|
|
|
})
|
|
|
},
|
|
|
buttonClick(e) {
|
|
|
- console.log(e)
|
|
|
- }
|
|
|
+ const that = this;
|
|
|
+ that.$set(that, `popupShow`, '1')
|
|
|
+ that.$refs.popup.open();
|
|
|
+ },
|
|
|
+ // 关闭弹框
|
|
|
+ toClose() {
|
|
|
+ const that = this;
|
|
|
+ that.$refs.popup.close();
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|