添加新文件

This commit is contained in:
hejiangming
2025-05-07 10:09:55 +08:00
parent 007b002b81
commit 7e7a096151
776 changed files with 92603 additions and 0 deletions
@@ -0,0 +1,323 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const api_raffle = require("../../api/raffle.js");
const api_address = require("../../api/address.js");
const api_common = require("../../api/common.js");
const Address = () => "../../components/address.js";
const _sfc_main = {
components: {
Address
},
data() {
return {
form: {
id: 0,
name: null,
// 收货人
mobile: null,
// 手机号码
regionStr: null,
// 所属地区
countryId: null,
// 国家ID
provinceId: null,
// 省份ID
cityId: null,
// 城市ID
areaId: null,
// 区域ID
address: null
// 详细地址
},
regionShow: false,
regionColumns: [],
regionLoading: false,
addressShow: false,
// 收件地址选择
selectAddress: {},
// 选中的地址
prizeForm: {
id: 0,
addressId: 0,
//
remark: ""
// 备注
}
};
},
onLoad(option) {
const id = option.id;
if (id && id !== 0) {
this.prizeForm.id = id;
}
},
methods: {
// 选择地址的弹框
async regionShowCheck(status) {
if (status) {
const nation = await this.getRegion(0);
const province = nation && nation.length !== 0 ? await this.getRegion(nation[0].id) : [];
const city = province && province.length !== 0 ? await this.getRegion(province[0].id) : [];
const area = city && city.length !== 0 ? await this.getRegion(city[0].id) : [];
this.regionColumns = [nation, province, city, area];
} else {
this.regionColumns = [[], [], [], []];
}
this.regionShow = status;
},
// 数据交互
async getRegion(pId) {
this.regionLoading = true;
const params = {
parentId: pId
};
const resp = await api_common.getCascadeRegion(params);
const arrOption = [];
if (resp.bizcode === 100) {
const data = resp.data;
if (data && data.length !== 0) {
data.map((item) => {
arrOption.push({
id: item.id,
label: item.name,
pId
});
});
}
}
this.regionLoading = false;
return arrOption;
},
// 地区改变
async regionChange(e) {
const {
columnIndex,
index,
picker
} = e;
const selectData = this.regionColumns[columnIndex][index];
const resultData = await this.getRegion(selectData.id);
if (resultData && resultData.length !== 0) {
const index2 = columnIndex + 1;
this.regionColumns[index2] = resultData;
}
},
// 提交地址
regionConfirm(e) {
const {
columnIndex,
value,
values,
index
} = e;
const regionStr = [];
const regionId = [];
value.map((item) => {
if (item) {
regionStr.push(item.label);
regionId.push(item.id);
}
});
this.form.regionStr = regionStr;
if (regionId && regionId.length !== 0) {
this.form.countryId = regionId[0] ? regionId[0] : null;
this.form.provinceId = regionId[1] ? regionId[1] : null;
this.form.cityId = regionId[2] ? regionId[2] : null;
this.form.areaId = regionId[3] ? regionId[3] : null;
}
this.regionShowCheck(false);
},
// 添加地址
async addAddress() {
const params = {
...this.form
};
if (!params.name) {
this.$refs.uToastRef.show({
type: "error",
message: "请输入收货人"
});
return;
}
if (!params.mobile) {
this.$refs.uToastRef.show({
type: "error",
message: "请输入收货人手机号"
});
return;
}
if (!params.regionStr) {
this.$refs.uToastRef.show({
type: "error",
message: "请选择所在地区"
});
return;
}
if (!params.address) {
this.$refs.uToastRef.show({
type: "error",
message: "请输入详细地址"
});
return;
}
const selectAddress = this.selectAddress;
if (selectAddress && selectAddress.id !== 0) {
params.id = selectAddress.id;
} else {
delete params.id;
}
if (!params.areaId || params.areaId === 0) {
delete params.areaId;
}
delete params.regionStr;
const res = await api_address.editAddress(params);
if (res && res.bizcode === 100) {
const goodsParams = {
...this.prizeForm,
addressId: res.data
};
const goodsRes = await api_raffle.takeGoods(goodsParams);
if (goodsRes && goodsRes.bizcode === 100) {
this.$refs.uToastRef.show({
type: "success",
message: "领取成功"
});
setTimeout(() => {
common_vendor.index.navigateTo({
url: "/pages/mine_winning_record/mine_winning_record"
});
}, 1500);
}
}
},
// 地址类型
checkAddressShow(status, type, addIndex, index) {
this.addressShow = status;
},
// 地址选中
getAddressValueFunc(item) {
this.selectAddress = item;
},
// 地址选中OK
addressOk() {
const item = this.selectAddress;
common_vendor.index.__f__("log", "at pages/get_prize/get_prize.vue:291", "item", item);
this.form.name = item.name;
this.form.mobile = item.phone;
this.form.countryId = item.countryId;
this.form.provinceId = item.provinceId;
this.form.cityId = item.cityId;
this.form.areaId = item.areaId;
this.form.address = item.address;
const regionStr = [];
if (item.countryName) {
regionStr.push(item.countryName);
}
if (item.provinceName) {
regionStr.push(item.provinceName);
}
if (item.cityName) {
regionStr.push(item.cityName);
}
if (item.areaName) {
regionStr.push(item.areaName);
}
this.form.regionStr = regionStr;
this.addressShow = false;
}
}
};
if (!Array) {
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
const _easycom_up_image2 = common_vendor.resolveComponent("up-image");
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_up_toast2 = common_vendor.resolveComponent("up-toast");
const _easycom_up_picker2 = common_vendor.resolveComponent("up-picker");
const _component_Address = common_vendor.resolveComponent("Address");
const _easycom_up_popup2 = common_vendor.resolveComponent("up-popup");
(_easycom_up_input2 + _easycom_up_image2 + _easycom_up_textarea2 + _easycom_up_toast2 + _easycom_up_picker2 + _component_Address + _easycom_up_popup2)();
}
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
const _easycom_up_image = () => "../../uni_modules/uview-plus/components/u-image/u-image.js";
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_up_toast = () => "../../uni_modules/uview-plus/components/u-toast/u-toast.js";
const _easycom_up_picker = () => "../../uni_modules/uview-plus/components/u-picker/u-picker.js";
const _easycom_up_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
if (!Math) {
(_easycom_up_input + _easycom_up_image + _easycom_up_textarea + _easycom_up_toast + _easycom_up_picker + _easycom_up_popup)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.o(($event) => $data.form.name = $event),
b: common_vendor.p({
placeholder: "收货人",
border: "surround",
customStyle: {
"border": "0rpx"
},
modelValue: $data.form.name
}),
c: common_vendor.o(($event) => $data.form.mobile = $event),
d: common_vendor.p({
placeholder: "请填写收货人手机号",
border: "surround",
customStyle: {
"border": "0rpx"
},
type: "number",
modelValue: $data.form.mobile
}),
e: common_vendor.t($data.form.regionStr && $data.form.regionStr.join("/") || "所在地区"),
f: common_vendor.p({
src: "/static/common/right_soild.png",
width: "14",
height: "14",
bgColor: "#f1f6ff00"
}),
g: common_vendor.o(($event) => $options.regionShowCheck(true)),
h: common_vendor.o(($event) => $data.form.address = $event),
i: common_vendor.p({
placeholder: "门牌号、小区、楼栋号、单元室等",
border: "surround",
customStyle: {
"border": "0rpx",
"height": "100rpx"
},
modelValue: $data.form.address
}),
j: common_vendor.o(($event) => $data.prizeForm.remark = $event),
k: common_vendor.p({
placeholder: "请输入内容",
modelValue: $data.prizeForm.remark
}),
l: common_vendor.o(($event) => $data.addressShow = true),
m: common_vendor.o((...args) => $options.addAddress && $options.addAddress(...args)),
n: common_vendor.sr("uToastRef", "7383e91f-5"),
o: common_vendor.sr("uPickerRef", "7383e91f-6"),
p: common_vendor.o($options.regionConfirm),
q: common_vendor.o($options.regionChange),
r: common_vendor.o(($event) => $data.regionShow = false),
s: common_vendor.o(($event) => $data.regionShow = false),
t: common_vendor.p({
show: $data.regionShow,
columns: $data.regionColumns,
loading: $data.regionLoading,
keyName: "label",
itemHeight: "34"
}),
v: common_vendor.o($options.getAddressValueFunc),
w: common_vendor.o((...args) => $options.addressOk && $options.addressOk(...args)),
x: common_vendor.o(($event) => $options.checkAddressShow(false)),
y: common_vendor.o(($event) => $data.addressShow = $event),
z: common_vendor.p({
round: 10,
closeOnClickOverlay: false,
closeable: true,
safeAreaInsetBottom: false,
show: $data.addressShow
})
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/get_prize/get_prize.js.map