Commit 21ea4a44 authored by wildfirecode13's avatar wildfirecode13

1

parent 2e19bc8d
{
"success": 0,
"data": {
"channel": "aliqua sint fugiat non do",
"strategyCode": "anim",
"code": "amet",
"image": "ea nulla aute eu",
"name": "in",
"type": -27273675.128173023
},
"code": "quis nostrud fugiat pariatur",
"message":"欢乐币不足"
}
\ No newline at end of file
......@@ -11,7 +11,7 @@
"type": 4112149.6368029267,
"_id": "2",
"value": 51585947.06940037,
"status": 2
"status": 1
},
{
"hasStock": false,
......@@ -21,7 +21,7 @@
"type": 4112149.6368029267,
"_id": "2",
"value": 51585947.06940037,
"status": 2
"status": 1
},
{
"hasStock": false,
......
This diff is collapsed.
......@@ -5,6 +5,10 @@ const EXCHANGE_STATUS = {
};
import resList from '../../resconfig/resList'; //import API from '../../api';
import API from '../../api';
const app = getApp();
const { tbcc } = app;
const { commonToast } = tbcc.tb;
let flag = 0;
Page({
data: {
......@@ -17,43 +21,47 @@ Page({
resList: resList
});
this.updateData();
this.getExchangeGoodList();
},
async handleClick(e) {
if (flag) return;
flag = 1;
const { item:{_id} } = e.target.dataset;
const { item: { _id } } = e.target.dataset;
const { success, data, message } = await API.exchangeGood({ _id }).catch(res => {
commonToast(res && res.message);
flag = 0;
}) || {};
if (success && data) {
commonToast('兑换成功')
}
await this.getExchangeGoodList();
flag = 0;
},
async onItemExchange(_id) {
const { success, data, message } = await API.exchangeGood({ _id }).catch(res => {
commonToast(res && res.message)
}) || {};
// async onItemExchange(_id) {
// const { success, data, message } = await API.exchangeGood({ _id }).catch(res => {
// commonToast(res && res.message)
// }) || {};
// API.exchangeGood({ _id })
// .then(() => {
// _list.forEach(item => {
// if (item._id == _id) {
// item.exchanged = true;
// }
// })
// console.log('_list', _list)
// this.setData({ list: [] });
// // this.updateData();
// })
// .catch(res => {
// });
},
// // API.exchangeGood({ _id })
// // .then(() => {
// // _list.forEach(item => {
// // if (item._id == _id) {
// // item.exchanged = true;
// // }
// // })
// // console.log('_list', _list)
// // this.setData({ list: [] });
// // // this.updateData();
// // })
// // .catch(res => {
// // });
// },
async updateData() {
async getExchangeGoodList() {
const { data: { list, happyCoin } } = await API.exchangeGoodList();
list.forEach(item => {
item.exchanged = item.status == EXCHANGE_STATUS.DONE;
......
const resList = {
'6768cd2f-8a8e-4a49-9f20-29a4fdefe142': {
name: 'exchanged_bg',
ext: '.png',
uuid: '6768cd2f-8a8e-4a49-9f20-29a4fdefe142',
url: '//yun.duiba.com.cn/spark/assets/3e668721c6b9582be3b62f7e1e1a7b20cdb597ce.png'
},
'5fbf3c28-003e-46c6-833d-968eaeb820cf': {
name: 'exchanged_imgbg',
ext: '.png',
uuid: '5fbf3c28-003e-46c6-833d-968eaeb820cf',
url: '//yun.duiba.com.cn/spark/assets/adbbe665822e7e67c405ee5a62b56859521ab715.png'
},
'e170173f-d814-4e58-a5b0-95c2d80b9673': {
name: 'exchanged_close',
ext: '.png',
uuid: 'e170173f-d814-4e58-a5b0-95c2d80b9673',
url: '//yun.duiba.com.cn/spark/assets/2b22fec0227db9f7df6ee42e5161939aa4f9a06f.png'
},
'9df943b3-e90f-4593-b144-d5d47bba5c4d': {
name: 'exchanged_btn',
ext: '.png',
uuid: '9df943b3-e90f-4593-b144-d5d47bba5c4d',
url: '//yun.duiba.com.cn/spark/assets/5193855f40ff72dea9f48022083a6a35240b6dc6.png'
},
'0c446868-16d2-47f1-a0d6-27dadff681f2': {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment