140 lines
3.7 KiB
JavaScript
140 lines
3.7 KiB
JavaScript
"use strict";
|
|
const api_news = require("../../../api/news.js");
|
|
const api_index = require("../../../api/index.js");
|
|
const common_vendor = require("../../../common/vendor.js");
|
|
const common_assets = require("../../../common/assets.js");
|
|
const _sfc_main = {
|
|
inject: ["util"],
|
|
data() {
|
|
return {
|
|
randomAmount: void 0,
|
|
sendType: null,
|
|
blessing: "恭喜发财",
|
|
money: 0.01,
|
|
username: null,
|
|
receivedNumber: 8,
|
|
SumNumber: 10,
|
|
receivedMoney: 5.43,
|
|
SumMoney: 10,
|
|
receivedList: [],
|
|
//动画效果
|
|
radius: "100% 100% 0 0"
|
|
};
|
|
},
|
|
methods: {
|
|
grabredLog() {
|
|
let {
|
|
bagId
|
|
} = this.$route.query;
|
|
api_news.redEnvelope.grabredLog({
|
|
bagId
|
|
}).then((res) => {
|
|
let index = 0;
|
|
let max = 0;
|
|
res.rows.length > 0 && res.rows.forEach((element, index2) => {
|
|
const {
|
|
userNickname,
|
|
userPortrait,
|
|
amount,
|
|
createTime
|
|
} = element;
|
|
if (amount > max) {
|
|
max = element.amount;
|
|
}
|
|
this.receivedList.push({
|
|
userNickname,
|
|
face: this.util.format_url(userPortrait),
|
|
createTime,
|
|
amount,
|
|
islucky: false
|
|
});
|
|
});
|
|
this.receivedList[index].islucky = true;
|
|
});
|
|
},
|
|
// 获取他人信息
|
|
getUserinfo(userId) {
|
|
api_index.api.video.getUserInfo({
|
|
query: {
|
|
userId
|
|
}
|
|
}).then((res) => {
|
|
this.username = res.data.userNickname;
|
|
});
|
|
},
|
|
getRedbag() {
|
|
let {
|
|
bagId
|
|
} = this.$route.query;
|
|
api_news.redEnvelope.getRedbag({
|
|
bagId
|
|
}).then((res) => {
|
|
var _a;
|
|
const {
|
|
all,
|
|
num,
|
|
residue,
|
|
score,
|
|
balance,
|
|
sendType,
|
|
userId
|
|
} = res.data;
|
|
this.receivedNumber = all - num;
|
|
this.SumNumber = all;
|
|
this.randomAmount = (_a = res.data) == null ? void 0 : _a.randomAmount;
|
|
this.sendType = sendType;
|
|
switch (sendType) {
|
|
case 1:
|
|
this.SumMoney = score;
|
|
break;
|
|
case 2:
|
|
this.SumMoney = balance;
|
|
break;
|
|
}
|
|
this.receivedMoney = this.SumMoney - residue;
|
|
this.getUserinfo(userId);
|
|
});
|
|
}
|
|
},
|
|
mounted() {
|
|
this.getRedbag();
|
|
this.grabredLog();
|
|
},
|
|
onPageScroll(e) {
|
|
if (e.scrollTop > 100) {
|
|
return;
|
|
}
|
|
let radiusTmp = 100 - e.scrollTop;
|
|
this.radius = radiusTmp + "% " + radiusTmp + "% 0 0";
|
|
}
|
|
};
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return common_vendor.e({
|
|
a: common_vendor.t($data.blessing),
|
|
b: $data.randomAmount
|
|
}, $data.randomAmount ? {
|
|
c: common_vendor.t($data.randomAmount)
|
|
} : {}, {
|
|
d: common_assets._imports_0$2,
|
|
e: `${$data.radius}`,
|
|
f: common_vendor.t($data.username),
|
|
g: common_vendor.t(`已领取${$data.receivedNumber}/${$data.SumNumber} 个,共${$data.receivedMoney}/${$data.SumMoney}${$data.sendType == 1 ? "积分" : "元"}`),
|
|
h: $data.receivedList.length > 0
|
|
}, $data.receivedList.length > 0 ? {
|
|
i: common_vendor.f($data.receivedList, (row, index, i0) => {
|
|
return common_vendor.e({
|
|
a: row.face,
|
|
b: common_vendor.t(row.userNickname),
|
|
c: common_vendor.t(`${row.amount}${$data.sendType == 1 ? "积分" : "元"}`),
|
|
d: common_vendor.t(row.createTime),
|
|
e: row.islucky
|
|
}, row.islucky ? {} : {}, {
|
|
f: index
|
|
});
|
|
})
|
|
} : {});
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
_sfc_main.__runtimeHooks = 1;
|
|
wx.createPage(MiniProgramPage);
|