| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- Component({
- properties: {
- visible: { type: Boolean, value: false },
- initialReason: { type: String, value: "" },
- },
- data: {
- selectedReason: "",
- reasons: [
- "商品信息描述不符",
- "与商家协商一致退款",
- "质量问题",
- "少件(含缺少配件)",
- "包装/商品破损/污渍",
- "未按约定时间发货",
- "发票问题",
- "卖家发错货",
- ],
- },
- observers: {
- visible(v: boolean) {
- if (v) {
- this.setData({ selectedReason: this.data.initialReason || "" });
- }
- },
- },
- methods: {
- onPopupVisibleChange(e: WechatMiniprogram.CustomEvent<{ visible: boolean }>) {
- if (!e?.detail?.visible) {
- this.triggerEvent("close");
- }
- },
- onClose() {
- this.triggerEvent("close");
- },
- onSelectReason(e: any) {
- const reason = e.detail?.value;
- if (reason) {
- this.setData({ selectedReason: reason });
- }
- },
- onNext() {
- const reason = this.data.selectedReason;
- if (!reason) {
- wx.showToast({ title: "请选择退款原因", icon: "none" });
- return;
- }
- this.triggerEvent("next", { reason });
- },
- },
- });
|