205 lines
6.8 KiB
JavaScript
205 lines
6.8 KiB
JavaScript
"use strict";
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
const common_vendor = require("../../../common/vendor.js");
|
|
const logic_pay = require("../../../logic/pay.js");
|
|
const utils_commUtils = require("../../../utils/commUtils.js");
|
|
const utils_http = require("../../../utils/http.js");
|
|
const _sfc_main = {
|
|
__name: "OrderItem",
|
|
props: {
|
|
id: String,
|
|
userId: String,
|
|
reservationTime: String,
|
|
serviceHours: String,
|
|
personalServiceId: String,
|
|
personalServiceUserId: String,
|
|
price: Number,
|
|
isPay: Boolean,
|
|
feedback: String,
|
|
star: Number,
|
|
state: String,
|
|
paymentMethod: String,
|
|
qrcode: String,
|
|
createTime: String,
|
|
updateTime: String,
|
|
address: Object,
|
|
pet: Object,
|
|
user: Object,
|
|
psUser: Object,
|
|
serviceInfo: Object,
|
|
isTake: false
|
|
},
|
|
setup(__props) {
|
|
const props = __props;
|
|
const shopRemark = common_vendor.ref("");
|
|
const scan = () => __async(this, null, function* () {
|
|
const scan2 = yield utils_commUtils.scanCodeAsync();
|
|
if (scan2.result) {
|
|
try {
|
|
const res = yield utils_http.httpPost("/order/scan/" + props.id, {}, { qrcode: scan2.result });
|
|
if (res.code == 200) {
|
|
utils_commUtils.toast("支付成功");
|
|
common_vendor.index.$emit("refresh");
|
|
} else {
|
|
utils_commUtils.toast(res.message);
|
|
}
|
|
} catch (e) {
|
|
utils_commUtils.toast(e.data.codeStr);
|
|
}
|
|
} else {
|
|
utils_commUtils.toast("扫码失败");
|
|
}
|
|
});
|
|
const orderPay = () => __async(this, null, function* () {
|
|
try {
|
|
const res = yield logic_pay.payOrder(props.id);
|
|
if (res.code == 200) {
|
|
utils_commUtils.toast("支付成功");
|
|
} else {
|
|
utils_commUtils.toast(res.message);
|
|
}
|
|
} catch (e) {
|
|
console.log(e);
|
|
utils_commUtils.toast(e.data.codeStr);
|
|
}
|
|
});
|
|
const cancel = () => __async(this, null, function* () {
|
|
const res = yield utils_http.httpPost("/order/cancel/" + props.id);
|
|
if (res.code == 200) {
|
|
utils_commUtils.toast("取消成功");
|
|
common_vendor.index.$emit("refresh");
|
|
} else {
|
|
utils_commUtils.toast(res.message);
|
|
}
|
|
});
|
|
const toOrderDetail = () => {
|
|
common_vendor.index.navigateTo({
|
|
url: `/pages/order/order-detail?id=${props.id}`
|
|
});
|
|
};
|
|
const bookingCancel = () => __async(this, null, function* () {
|
|
try {
|
|
const res = yield utils_commUtils.showModalAsync({
|
|
title: "取消订单",
|
|
content: "",
|
|
editable: true,
|
|
placeholderText: "请输入取消原因!"
|
|
});
|
|
if (res.confirm) {
|
|
shopRemark.value = res.content;
|
|
const response = yield utils_http.httpPost(
|
|
"/order/bookingCancel/" + props.id,
|
|
{},
|
|
{ shopRemark: shopRemark.value }
|
|
);
|
|
if (response.code == 200) {
|
|
utils_commUtils.toast("取消订单成功!");
|
|
common_vendor.index.$emit("refresh");
|
|
} else {
|
|
utils_commUtils.toast(response.message);
|
|
}
|
|
} else if (res.cancel) {
|
|
utils_commUtils.toast("取消操作已取消");
|
|
}
|
|
} catch (e) {
|
|
utils_commUtils.toast("请求失败,请稍后再试");
|
|
console.error(e);
|
|
}
|
|
});
|
|
const confirm = () => __async(this, null, function* () {
|
|
try {
|
|
const res = yield utils_http.httpPost("/order/confirm/" + props.id);
|
|
if (res.code == 200) {
|
|
utils_commUtils.toast("确认订单成功!");
|
|
common_vendor.index.$emit("refresh");
|
|
} else {
|
|
utils_commUtils.toast(res.message);
|
|
}
|
|
} catch (e) {
|
|
utils_commUtils.toast(e.data.message);
|
|
}
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: __props.serviceInfo && __props.serviceInfo.serviceName
|
|
}, __props.serviceInfo && __props.serviceInfo.serviceName ? {
|
|
b: common_vendor.t(__props.serviceInfo.serviceName)
|
|
} : {}, {
|
|
c: common_vendor.t(__props.state),
|
|
d: __props.serviceInfo && __props.serviceInfo.type
|
|
}, __props.serviceInfo && __props.serviceInfo.type ? {
|
|
e: common_vendor.t(__props.serviceInfo.type)
|
|
} : {}, {
|
|
f: __props.serviceInfo && __props.serviceInfo.address
|
|
}, __props.serviceInfo && __props.serviceInfo.address ? {
|
|
g: common_vendor.t(__props.serviceInfo.address)
|
|
} : {}, {
|
|
h: common_vendor.t(__props.reservationTime),
|
|
i: common_vendor.t(__props.serviceHours),
|
|
j: common_vendor.unref(utils_commUtils.imgUrl)(__props.pet.profileUrl),
|
|
k: common_vendor.t(__props.pet.name),
|
|
l: common_vendor.t(__props.pet.breed),
|
|
m: common_vendor.t(__props.user.nickname),
|
|
n: common_vendor.t(__props.user.phone),
|
|
o: __props.address
|
|
}, __props.address ? {
|
|
p: common_vendor.t(__props.address.province),
|
|
q: common_vendor.t(__props.address.city),
|
|
r: common_vendor.t(__props.address.district),
|
|
s: common_vendor.t(__props.address.detailAddress)
|
|
} : {}, {
|
|
t: common_vendor.t(__props.paymentMethod),
|
|
v: common_vendor.t(__props.isPay ? "已支付" : "未支付"),
|
|
w: common_vendor.t(__props.price),
|
|
x: common_vendor.t(__props.price),
|
|
y: common_vendor.t(__props.serviceHours),
|
|
z: !__props.isTake
|
|
}, !__props.isTake ? {
|
|
A: common_vendor.o(toOrderDetail)
|
|
} : {}, {
|
|
B: !__props.isTake
|
|
}, !__props.isTake ? {
|
|
C: common_vendor.o(cancel)
|
|
} : {}, {
|
|
D: !__props.isTake
|
|
}, !__props.isTake ? {
|
|
E: common_vendor.o(orderPay)
|
|
} : {}, {
|
|
F: __props.isTake
|
|
}, __props.isTake ? {
|
|
G: common_vendor.o(bookingCancel)
|
|
} : {}, {
|
|
H: __props.isTake
|
|
}, __props.isTake ? {
|
|
I: common_vendor.o(confirm)
|
|
} : {}, {
|
|
J: __props.state && __props.state.includes("已预约") && __props.user.userInfo.isPetNursery
|
|
}, __props.state && __props.state.includes("已预约") && __props.user.userInfo.isPetNursery ? {
|
|
K: common_vendor.o(scan)
|
|
} : {});
|
|
};
|
|
}
|
|
};
|
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f8ac76fa"]]);
|
|
wx.createComponent(Component);
|
|
//# sourceMappingURL=OrderItem.js.map
|