306 lines
11 KiB
JavaScript
306 lines
11 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const api_config = require("../../api/config.js");
|
|
const api_request = require("../../api/request.js");
|
|
const api_house_order = require("../../api/house_order.js");
|
|
if (!Array) {
|
|
const _easycom_nut_cell2 = common_vendor.resolveComponent("nut-cell");
|
|
const _easycom_nut_cell_group2 = common_vendor.resolveComponent("nut-cell-group");
|
|
const _easycom_nut_button2 = common_vendor.resolveComponent("nut-button");
|
|
const _easycom_nut_input2 = common_vendor.resolveComponent("nut-input");
|
|
const _easycom_nut_form_item2 = common_vendor.resolveComponent("nut-form-item");
|
|
const _easycom_nut_textarea2 = common_vendor.resolveComponent("nut-textarea");
|
|
const _easycom_nut_switch2 = common_vendor.resolveComponent("nut-switch");
|
|
const _easycom_shmily_drag_image2 = common_vendor.resolveComponent("shmily-drag-image");
|
|
const _easycom_nut_form2 = common_vendor.resolveComponent("nut-form");
|
|
(_easycom_nut_cell2 + _easycom_nut_cell_group2 + _easycom_nut_button2 + _easycom_nut_input2 + _easycom_nut_form_item2 + _easycom_nut_textarea2 + _easycom_nut_switch2 + _easycom_shmily_drag_image2 + _easycom_nut_form2)();
|
|
}
|
|
const _easycom_nut_cell = () => "../../uni_modules/nutui-uni/components/cell/cell.js";
|
|
const _easycom_nut_cell_group = () => "../../uni_modules/nutui-uni/components/cellgroup/cellgroup.js";
|
|
const _easycom_nut_button = () => "../../uni_modules/nutui-uni/components/button/button.js";
|
|
const _easycom_nut_input = () => "../../uni_modules/nutui-uni/components/input/input.js";
|
|
const _easycom_nut_form_item = () => "../../uni_modules/nutui-uni/components/formitem/formitem.js";
|
|
const _easycom_nut_textarea = () => "../../uni_modules/nutui-uni/components/textarea/textarea.js";
|
|
const _easycom_nut_switch = () => "../../uni_modules/nutui-uni/components/switch/switch.js";
|
|
const _easycom_shmily_drag_image = () => "../../uni_modules/shmily-drag-image/components/shmily-drag-image/shmily-drag-image.js";
|
|
const _easycom_nut_form = () => "../../uni_modules/nutui-uni/components/form/form.js";
|
|
if (!Math) {
|
|
(_easycom_nut_cell + _easycom_nut_cell_group + _easycom_nut_button + _easycom_nut_input + _easycom_nut_form_item + _easycom_nut_textarea + _easycom_nut_switch + _easycom_shmily_drag_image + _easycom_nut_form)();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "store",
|
|
setup(__props) {
|
|
const isBucket = common_vendor.ref(false);
|
|
const isAudit = common_vendor.ref(false);
|
|
const form = common_vendor.reactive({
|
|
shop_name: "",
|
|
shop_desc: "",
|
|
shop_phone: "",
|
|
is_audit: 0,
|
|
bulletin_txt: "",
|
|
service_txt: "",
|
|
pay_imgs: [],
|
|
wechat_imgs: [],
|
|
address_info: {}
|
|
});
|
|
const onIsAuditChange = (val) => {
|
|
form.is_audit = Number(isAudit.value);
|
|
common_vendor.index.__f__("log", "at pages/config/store.vue:117", form);
|
|
};
|
|
const chooseAddress = () => {
|
|
common_vendor.index.chooseAddress({
|
|
success(res) {
|
|
common_vendor.index.__f__("log", "at pages/config/store.vue:124", res);
|
|
form.address_info = {
|
|
address_id: res.addressID || 1,
|
|
user_name: res.userName,
|
|
tel_number: res.telNumber,
|
|
city_name: res.cityName || "",
|
|
county_name: res.countyName || "",
|
|
detail_info: res.detailInfo || "",
|
|
detail_info_new: res.detailInfoNew || "",
|
|
national_code: res.nationalCode || "",
|
|
national_code_full: res.nationalCodeFull || "",
|
|
postal_code: res.postalCode || "",
|
|
province_name: res.provinceName || "",
|
|
street_name: res.streetName || ""
|
|
};
|
|
}
|
|
});
|
|
};
|
|
const getConfig = () => {
|
|
api_config.fetchGetConfig().then((res) => {
|
|
common_vendor.index.__f__("log", "at pages/config/store.vue:149", "res=====>", res);
|
|
form.shop_name = res.appConfig.shop_name;
|
|
form.shop_desc = res.appConfig.shop_desc;
|
|
form.shop_phone = res.appConfig.shop_phone;
|
|
form.bulletin_txt = res.appConfig.bulletin_txt;
|
|
form.service_txt = res.appConfig.service_txt;
|
|
form.address_info = res.appConfig.address_info;
|
|
form.is_audit = res.appConfig.is_audit;
|
|
isAudit.value = res.appConfig.is_audit == 1;
|
|
if (res.appConfig.bucket) {
|
|
isBucket.value = true;
|
|
}
|
|
let pay_imgs = JSON.parse(res.appConfig.pay_imgs);
|
|
let wechat_imgs = JSON.parse(res.appConfig.wechat_imgs);
|
|
pay_imgs.forEach((item) => {
|
|
form.pay_imgs.push({
|
|
id: item.image_id,
|
|
file_path: item.file_path
|
|
});
|
|
});
|
|
wechat_imgs.forEach((item) => {
|
|
form.wechat_imgs.push({
|
|
id: item.image_id,
|
|
file_path: item.file_path
|
|
});
|
|
});
|
|
common_vendor.index.__f__("log", "at pages/config/store.vue:180", "form=====>", form);
|
|
});
|
|
};
|
|
const onSubmit = () => {
|
|
api_config.fetchSetConfig(form).then((res) => {
|
|
common_vendor.index.showToast({
|
|
icon: "none",
|
|
title: "更新商城配置成功"
|
|
});
|
|
setTimeout(() => {
|
|
common_vendor.index.redirectTo({
|
|
url: "/pages/config/store",
|
|
success: (res2) => {
|
|
},
|
|
fail: () => {
|
|
},
|
|
complete: () => {
|
|
}
|
|
});
|
|
}, 500);
|
|
});
|
|
};
|
|
const saveAddress = () => {
|
|
api_house_order.houseFetchUpdateAddress({
|
|
address: form.address_info
|
|
}).then((res) => {
|
|
common_vendor.index.showToast({
|
|
icon: "none",
|
|
title: "保存收货地址成功"
|
|
});
|
|
setTimeout(() => {
|
|
common_vendor.index.redirectTo({
|
|
url: "/pages/config/store",
|
|
success: (res2) => {
|
|
},
|
|
fail: () => {
|
|
},
|
|
complete: () => {
|
|
}
|
|
});
|
|
}, 500);
|
|
});
|
|
};
|
|
common_vendor.onMounted(() => {
|
|
getConfig();
|
|
});
|
|
const addPayImg = () => {
|
|
common_vendor.index.chooseImage({
|
|
count: 9 - (form.pay_imgs.length || 0),
|
|
sourceType: ["album", "camera"],
|
|
success: (res) => {
|
|
res.tempFiles.forEach((file) => {
|
|
common_vendor.index.uploadFile({
|
|
url: api_request.getUploadImageUrl(),
|
|
filePath: file.path,
|
|
name: "iFile",
|
|
formData: {
|
|
group_id: 1
|
|
},
|
|
success: (res2) => {
|
|
let data = JSON.parse(res2.data).data;
|
|
form.pay_imgs.push({
|
|
id: parseInt(data.file_id),
|
|
file_path: data.file_path
|
|
});
|
|
}
|
|
});
|
|
});
|
|
}
|
|
});
|
|
};
|
|
const addWechatImg = () => {
|
|
common_vendor.index.chooseImage({
|
|
count: 9 - (form.wechat_imgs.length || 0),
|
|
sourceType: ["album", "camera"],
|
|
success: (res) => {
|
|
res.tempFiles.forEach((file) => {
|
|
common_vendor.index.uploadFile({
|
|
url: api_request.getUploadImageUrl(),
|
|
filePath: file.path,
|
|
name: "iFile",
|
|
formData: {
|
|
group_id: 1
|
|
},
|
|
success: (res2) => {
|
|
let data = JSON.parse(res2.data).data;
|
|
form.wechat_imgs.push({
|
|
id: parseInt(data.file_id),
|
|
file_path: data.file_path
|
|
});
|
|
}
|
|
});
|
|
});
|
|
}
|
|
});
|
|
};
|
|
return (_ctx, _cache) => {
|
|
var _a, _b;
|
|
return common_vendor.e({
|
|
a: !((_a = form.address_info) == null ? void 0 : _a.address_id)
|
|
}, !((_b = form.address_info) == null ? void 0 : _b.address_id) ? {
|
|
b: common_vendor.o(chooseAddress),
|
|
c: common_vendor.p({
|
|
title: "收货地址",
|
|
["is-link"]: true
|
|
})
|
|
} : {
|
|
d: common_vendor.o(chooseAddress),
|
|
e: common_vendor.p({
|
|
title: form.address_info.user_name + " " + form.address_info.tel_number,
|
|
["is-link"]: true,
|
|
["sub-title"]: form.address_info.province_name + form.address_info.city_name + form.address_info.county_name + form.address_info.street_name + form.address_info.detail_info_new
|
|
})
|
|
}, {
|
|
f: common_vendor.o(($event) => saveAddress()),
|
|
g: common_vendor.p({
|
|
type: "primary",
|
|
block: true
|
|
}),
|
|
h: common_vendor.o(($event) => form.shop_name = $event),
|
|
i: common_vendor.p({
|
|
placeholder: "请输入店铺名称",
|
|
type: "text",
|
|
modelValue: form.shop_name
|
|
}),
|
|
j: common_vendor.p({
|
|
label: "商城名称"
|
|
}),
|
|
k: common_vendor.o(($event) => form.shop_desc = $event),
|
|
l: common_vendor.p({
|
|
autosize: true,
|
|
placeholder: "请输入店铺介绍",
|
|
type: "text",
|
|
modelValue: form.shop_desc
|
|
}),
|
|
m: common_vendor.p({
|
|
label: "商城介绍"
|
|
}),
|
|
n: common_vendor.o(($event) => form.shop_phone = $event),
|
|
o: common_vendor.p({
|
|
placeholder: "请输入手机号码",
|
|
type: "text",
|
|
modelValue: form.shop_phone
|
|
}),
|
|
p: common_vendor.p({
|
|
label: "手机号码"
|
|
}),
|
|
q: common_vendor.o(($event) => form.bulletin_txt = $event),
|
|
r: common_vendor.p({
|
|
autosize: true,
|
|
placeholder: "请输入首页公告",
|
|
type: "text",
|
|
modelValue: form.bulletin_txt
|
|
}),
|
|
s: common_vendor.p({
|
|
label: "首页公告"
|
|
}),
|
|
t: common_vendor.o(($event) => form.service_txt = $event),
|
|
v: common_vendor.p({
|
|
autosize: true,
|
|
placeholder: "请输入服务描述",
|
|
type: "text",
|
|
modelValue: form.service_txt
|
|
}),
|
|
w: common_vendor.p({
|
|
label: "服务描述"
|
|
}),
|
|
x: common_vendor.o(onIsAuditChange),
|
|
y: common_vendor.o(($event) => isAudit.value = $event),
|
|
z: common_vendor.p({
|
|
modelValue: isAudit.value
|
|
}),
|
|
A: common_vendor.p({
|
|
label: "是否审核模式"
|
|
}),
|
|
B: isBucket.value
|
|
}, isBucket.value ? {
|
|
C: common_vendor.o(($event) => form.pay_imgs = $event),
|
|
D: common_vendor.p({
|
|
number: 9,
|
|
["add-image"]: addPayImg,
|
|
keyName: "file_path",
|
|
modelValue: form.pay_imgs
|
|
})
|
|
} : {}, {
|
|
E: isBucket.value
|
|
}, isBucket.value ? {
|
|
F: common_vendor.o(($event) => form.wechat_imgs = $event),
|
|
G: common_vendor.p({
|
|
number: 9,
|
|
["add-image"]: addWechatImg,
|
|
keyName: "file_path",
|
|
modelValue: form.wechat_imgs
|
|
})
|
|
} : {}, {
|
|
H: common_vendor.o(onSubmit),
|
|
I: common_vendor.p({
|
|
type: "primary",
|
|
block: true
|
|
})
|
|
});
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-5e515d66"]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/config/store.js.map
|