100 lines
2.9 KiB
JavaScript
100 lines
2.9 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const common_assets = require("../../common/assets.js");
|
|
const api_durian = require("../../api/durian.js");
|
|
if (!Array) {
|
|
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
|
_easycom_uni_popup2();
|
|
}
|
|
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
|
|
if (!Math) {
|
|
(apex + _easycom_uni_popup)();
|
|
}
|
|
const apex = () => "../../components/header/apex.js";
|
|
const _sfc_main = {
|
|
__name: "orchard",
|
|
setup(__props) {
|
|
const {
|
|
proxy
|
|
} = common_vendor.getCurrentInstance();
|
|
const store = common_vendor.useStore();
|
|
const viewData = common_vendor.ref([]);
|
|
const selectItem = common_vendor.ref({});
|
|
const userinfo = common_vendor.computed(() => {
|
|
let result = store.state.userinfo;
|
|
return result;
|
|
});
|
|
buyDurianList();
|
|
common_vendor.onReady(() => {
|
|
});
|
|
function buyDurianList() {
|
|
api_durian.durian.durianList({}).then((rs) => {
|
|
viewData.value = rs.data;
|
|
});
|
|
}
|
|
function exchange(type) {
|
|
api_durian.durian.exchange({
|
|
query: {
|
|
userId: userinfo.value.userId,
|
|
treeId: selectItem.value.id,
|
|
type
|
|
}
|
|
}).then((rs) => {
|
|
if (rs.code === 200) {
|
|
common_vendor.index.showToast({
|
|
title: "兑换成功",
|
|
icon: "success"
|
|
});
|
|
} else {
|
|
common_vendor.index.showToast({
|
|
title: "兑换成功",
|
|
icon: "error"
|
|
});
|
|
}
|
|
});
|
|
}
|
|
function openExchange(item) {
|
|
console.log(item);
|
|
selectItem.value = item;
|
|
proxy.$refs.typeRef.open();
|
|
}
|
|
function openChange() {
|
|
proxy.$refs.ruleRef.open();
|
|
}
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: common_vendor.o$1(openChange),
|
|
b: common_vendor.p({
|
|
title: "榴莲果园"
|
|
}),
|
|
c: common_assets._imports_0$9,
|
|
d: common_vendor.t(userinfo.value.seed),
|
|
e: common_assets._imports_0$8,
|
|
f: common_vendor.t(userinfo.value.fruit),
|
|
g: common_vendor.f(viewData.value, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.t(item.seed),
|
|
b: common_vendor.t(item.gains),
|
|
c: common_vendor.t(item.name),
|
|
d: common_vendor.o$1(($event) => openExchange(item), index),
|
|
e: index
|
|
};
|
|
}),
|
|
h: common_assets._imports_3$2,
|
|
i: common_assets._imports_3$2,
|
|
j: common_vendor.o$1(($event) => exchange("1")),
|
|
k: common_vendor.o$1(($event) => exchange("2")),
|
|
l: common_vendor.sr("typeRef", "5006ab30-1"),
|
|
m: common_vendor.p({
|
|
type: "center"
|
|
}),
|
|
n: common_vendor.sr("ruleRef", "5006ab30-2"),
|
|
o: common_vendor.p({
|
|
type: "center"
|
|
})
|
|
};
|
|
};
|
|
}
|
|
};
|
|
wx.createPage(_sfc_main);
|