爱简收旧衣按件回收前端代码仓库
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.
 
 
 
 

142 lines
5.0 KiB

"use strict";
const common_vendor = require("../../common/vendor.js");
const pages_mixins_pullRefreshMixin = require("../mixins/pullRefreshMixin.js");
const _sfc_main = {
mixins: [pages_mixins_pullRefreshMixin.pullRefreshMixin],
data() {
return {
user: {
name: "赵莫艳",
phone: "15888977617",
avatar: "https://img1.baidu.com/it/u=1234567890,1234567890&fm=253&fmt=auto&app=138&f=JPEG?w=400&h=400",
recycleCount: 2412,
totalItems: 32,
totalAmount: "8273.99",
address: "海南省海口市秀英区秀英街道5单元183室"
},
statusBarHeight: 0
};
},
computed: {
navbarStyle() {
return `padding-top: ${this.statusBarHeight}px;`;
}
},
onLoad(options) {
common_vendor.index.getSystemInfo({
success: (res) => {
this.statusBarHeight = res.statusBarHeight || 20;
}
});
const eventChannel = this.getOpenerEventChannel && this.getOpenerEventChannel();
if (eventChannel) {
eventChannel.on("userDetail", (user) => {
this.user = Object.assign({}, this.user, user);
if (user.id) {
this.$api && this.$api("getUserOrderNum", { userId: user.id }, (res) => {
if (res && res.code === 200 && res.result) {
this.user.recycleCount = res.result.unit_num;
this.user.totalItems = res.result.sum;
this.user.totalAmount = res.result.order_money;
}
});
this.$api && this.$api("getAddressList", { userId: user.id }, (res) => {
if (res && res.code === 200 && Array.isArray(res.result)) {
const defaultAddr = res.result.find((addr) => addr.defaultFlag === "Y");
if (defaultAddr) {
this.user.address = defaultAddr.address;
}
}
});
}
});
}
},
methods: {
goBack() {
common_vendor.index.navigateBack();
},
blockUser() {
if (!this.user.id)
return;
this.$api("blackUser", { userId: this.user.id }, (res) => {
if (res && res.code === 200) {
common_vendor.index.showToast({ title: "已拉黑", icon: "success" });
this.user.blocked = true;
} else {
common_vendor.index.showToast({ title: res.msg || "拉黑失败", icon: "none" });
}
});
},
upgradeUser() {
if (!this.user.id)
return;
this.$api("upgrade", { userId: this.user.id }, (res) => {
if (res && res.code === 200) {
common_vendor.index.showToast({ title: "已升级为推广官", icon: "success" });
this.user.role = "推广官";
} else {
common_vendor.index.showToast({ title: res.msg || "升级失败", icon: "none" });
}
});
},
viewOrders() {
common_vendor.index.navigateTo({
url: "/pages/manager/order?historyOrder=true&userId=" + this.user.id
});
},
unblockUser() {
common_vendor.index.showToast({ title: "已解除拉黑", icon: "none" });
this.user.blocked = false;
},
refreshData() {
},
async onRefresh() {
await this.refreshData && this.refreshData();
}
},
onPullDownRefresh() {
this.refreshData && this.refreshData();
common_vendor.index.stopPullDownRefresh();
}
};
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
_easycom_uni_icons2();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
_easycom_uni_icons();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: common_vendor.p({
type: "left",
size: "20"
}),
b: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
c: $data.user.role === "推广官"
}, $data.user.role === "推广官" ? {} : {}, {
d: $data.user.blocked
}, $data.user.blocked ? {} : {}, {
e: common_vendor.t($data.user.name),
f: common_vendor.t($data.user.phone),
g: $data.user.avatar,
h: common_vendor.t($data.user.recycleCount),
i: common_vendor.t($data.user.totalItems),
j: common_vendor.t($data.user.totalAmount),
k: common_vendor.t($data.user.address),
l: common_vendor.o((...args) => $options.viewOrders && $options.viewOrders(...args)),
m: $data.user.blocked
}, $data.user.blocked ? {
n: common_vendor.o((...args) => $options.unblockUser && $options.unblockUser(...args))
} : common_vendor.e({
o: common_vendor.o((...args) => $options.blockUser && $options.blockUser(...args)),
p: $data.user.role !== "推广官"
}, $data.user.role !== "推广官" ? {
q: common_vendor.o((...args) => $options.upgradeUser && $options.upgradeUser(...args))
} : {}));
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-06a2669a"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/manager/user-detail.js.map