金诚优选前端代码
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.
 
 
 
 
 

153 lines
3.6 KiB

<template>
<view id="pointstore-record">
<view class="contents">
<view>
<view class="no-list" v-if="reveal">
暂无数据
</view>
<view class="record-box" v-for="(item, idx) in recordList" :key="idx" >
<view class="item mx-1px-bottom" :data-no="item.order_no" v-for="(item, index) in recordList[idx]" :key="index" @tap="jump">
<view class="left">
<view class="name">
{{item.items[0].item_name}}
</view>
<view class="time">
{{item.submit_time}}
</view>
</view>
<view class="right">
-{{item.redeem_point}}
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
/**
* Created by lcfevr on 2018/4/16.
*/
import {pageLogin, getUrl,config,is} from '@/common/js/utils.js';
export default {
data() {
return {
page: 1,
recordList: [],
meta: '',
show: false,
reveal: false
};
},
onLoad() {
this.recordListF(this.page);
},
components: {},
props: {},
methods: {
jump(e) {
console.log(e);
wx.navigateTo({
url: '/pages/pointStore/orderdetail/orderdetail?no=' + e.currentTarget.dataset.no
});
},
recordListF(page = 1) {
var token = this.$cookieStorage.get('user_token');
var oauth = token;
wx.showLoading({
title: '加载中',
mask: true
});
this.$http.get({
api: 'api/order/point/list',
header: {
Authorization: oauth
},
data: {
page: page
}
}).then(res => {
if (res.statusCode == 200) {
res = res.data;
if (res.status) {
// 商品列表页赋值
this.setData({
// [`recordList.${page - 1}`]: res.data,
meta: res.meta
});
this.$set(this.recordList, page -1, res.data);
if (res.data != '') {
this.setData({
reveal: false
});
} else {
this.setData({
reveal: true
});
}
} else {
wx.showModal({
title: '',
content: res.message,
showCancel: false
});
}
} else {
wx.showModal({
content: res.message || '请求失败',
showCancel: false
});
}
this.setData({
show: false
});
wx.hideLoading();
}).catch(rej => {
wx.showModal({
content: "请求失败",
showCancel: false
});
this.setData({
show: false
});
wx.hideLoading();
});
},
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 "record";
</style>