You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
3.2 KiB
129 lines
3.2 KiB
<template>
|
|
<view id="coupon-goods">
|
|
<view class="commodity-bottom">
|
|
<view class="commodity-out" v-for="(item, index) in storeList" :key="index" :data-id="item.goods_id" @tap="jump">
|
|
<view class="commodity-box">
|
|
<view class="commodity-img">
|
|
<image mode="widthFix" :src="item.img"></image>
|
|
</view>
|
|
<view class="commodity-name">
|
|
{{item.name}}
|
|
</view>
|
|
<view class="commodity-money">
|
|
<view class="money">
|
|
¥{{item.sell_price}}
|
|
</view>
|
|
<view class="discount-tags">
|
|
<span class="tags-item" v-for="(tags, index) in item.discount_tags" :key="index" >{{tags}}</span>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import {pageLogin, getUrl,config} from '@/common/js/utils.js';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
storeList: []
|
|
};
|
|
},
|
|
|
|
onLoad(e) {
|
|
this.queryGoodsList(e.id);
|
|
},
|
|
|
|
components: {},
|
|
props: {},
|
|
methods: {
|
|
// 请求商品列表
|
|
queryGoodsList(id) {
|
|
var token = this.$cookieStorage.get('user_token') || '';
|
|
wx.showLoading({
|
|
title: "加载中",
|
|
mask: true
|
|
});
|
|
this.$http.get({
|
|
api: 'api/store/list/' + id + '/coupon',
|
|
header: {
|
|
Authorization: token
|
|
}
|
|
}).then(res => {
|
|
if (res.statusCode == 200) {
|
|
res = res.data;
|
|
|
|
if (res.status && res.data.length) {
|
|
this.setData({
|
|
storeList: res.data
|
|
});
|
|
} else {
|
|
wx.redirectTo({
|
|
url: '/pages/store/list/list'
|
|
});
|
|
/*wx.showModal({
|
|
content: res.message || '请求失败',
|
|
showCancel: false
|
|
})*/
|
|
}
|
|
} else {
|
|
wx.redirectTo({
|
|
url: '/pages/store/list/list'
|
|
});
|
|
/*wx.showModal({
|
|
content: res.message || '请求失败',
|
|
showCancel: false
|
|
})*/
|
|
}
|
|
|
|
wx.hideLoading();
|
|
}).catch(rej => {
|
|
wx.hideLoading();
|
|
wx.redirectTo({
|
|
url: '/pages/store/list/list'
|
|
});
|
|
/*wx.showModal({
|
|
content: res.message || '请求失败',
|
|
showCancel: false
|
|
})*/
|
|
});
|
|
},
|
|
|
|
jump(e) {
|
|
var id = e.currentTarget.dataset.id;
|
|
wx.navigateTo({
|
|
url: '/pages/store/detail/detail?id=' + id
|
|
});
|
|
},
|
|
|
|
setData: function (obj) {
|
|
let that = this;
|
|
let keys = [];
|
|
let val, data;
|
|
Object.keys(obj).forEach(function (key) {
|
|
keys = key.split('.');
|
|
val = obj[key];
|
|
data = that.$data;
|
|
keys.forEach(function (key2, index) {
|
|
if (index + 1 == keys.length) {
|
|
that.$set(data, key2, val);
|
|
} else {
|
|
if (!data[key2]) {
|
|
that.$set(data, key2, {});
|
|
}
|
|
}
|
|
|
|
data = data[key2];
|
|
});
|
|
});
|
|
}
|
|
},
|
|
computed: {},
|
|
watch: {}
|
|
};
|
|
</script>
|
|
<style rel="stylesheet/less" lang="less">
|
|
@import "goods";
|
|
</style>
|