Commit 0fb654a4 by liimin

feat(packageMine): 优化订单申请页面并添加退款原因选择功能

- 重新格式化并优化了 afterSale_step_two.js 文件的代码结构
- 在 constants/mine.js 中添加了 RefundReason 常量,用于退款原因选择
- 在 afterSale_step_two.wxml 中添加了退款原因选择的 radio group 组件
- 更新了 app.json,添加了 useExtendedLib 配置项以使用 weui 库
1 parent 2c75d019
......@@ -8,9 +8,7 @@
"pages/webView/webView",
"pages/Login/Login"
],
"requiredPrivateInfos": [
"getLocation"
],
"requiredPrivateInfos": ["getLocation"],
"lazyCodeLoading": "requiredComponents",
"window": {
"backgroundTextStyle": "light",
......@@ -22,7 +20,8 @@
"selectedColor": "#8A303A",
"backgroundColor": "#FFFFFF",
"borderStyle": "white",
"list": [{
"list": [
{
"pagePath": "pages/tab/index/index",
"text": "首页",
"iconPath": "assets/images/home.png",
......@@ -42,7 +41,8 @@
}
]
},
"subpackages": [{
"subpackages": [
{
"root": "packageIndex",
"pages": [
"pages/bannerJumpPage/bannerJumpPage",
......@@ -88,7 +88,7 @@
"authorize": "/components/Authorize/Authorize",
"popup": "/components/Popup/Popup",
"goods-action": "/components/GoodsAction/GoodsAction",
"glsx-privacy":"glsx-applet-component/GlsxPrivacy/index"
"glsx-privacy": "glsx-applet-component/GlsxPrivacy/index"
},
"style": "v2",
"resolveAlias": {
......@@ -100,7 +100,9 @@
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
},
"plugins": {
"plugins": {},
"useExtendedLib": {
"weui": true
},
"__usePrivacyCheck__": true
}
\ No newline at end of file
}
......@@ -6,7 +6,7 @@ export const ToolList = Object.freeze([
},
]);
export const ORDER_LIST =[
export const ORDER_LIST = [
{
text: "全部",
code: 0,
......@@ -35,4 +35,55 @@ export const ORDER_LIST =[
image: "aftermarket",
code: 5,
},
]
\ No newline at end of file
];
export const RefundReason = [
{
text: "商品无货",
value: 1,
},
{
text: "发货时间问题",
value: 2,
},
{
text: "不想要了/不喜欢",
value: 3,
},
{
text: "商品信息填写错误",
value: 4,
},
{
text: "地址信息填写错误",
value: 5,
},
{
text: "商品降价",
value: 6,
},
{
text: "其他",
value: 7,
},
{
text: "尺码不合适",
value: 8,
},
{
text: "无理由退货",
value: 9,
},
{
text: "发票问题",
value: 10,
},
{
text: "商品与页面描述不符",
value: 11,
},
{
text: "发错货",
value: 12,
},
];
import {
afterSaleMixin
} from '~/mixins/index'
import { afterSaleMixin } from "~/mixins/index";
import { RefundReason } from "~/constants/mine.js";
console.log("🚀 ~ RefundReason:", RefundReason)
Page({
behaviors: [afterSaleMixin],
/**
* 页面的初始数据
*/
data: {
imgUrls: []
imgUrls: [],
RefundReason: Object.freeze(RefundReason),
},
previewImage(e) {
let params = e.currentTarget.dataset
wx.p.wxApi.previewImage(params)
let params = e.currentTarget.dataset;
wx.p.wxApi.previewImage(params);
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let imgUrls = []
wx.p.router.getRouterParams(options).then(params => {
if (params.imgUrls) imgUrls = params.imgUrls
let imgUrls = [];
wx.p.router.getRouterParams(options).then((params) => {
if (params.imgUrls) imgUrls = params.imgUrls;
this.setData({
orderObj: params,
imgUrls,
maxRefundCount: params.refundCount
})
})
maxRefundCount: params.refundCount,
});
});
},
showPopup(){
showPopup() {
this.setData({
showPopup: true
})
showPopup: true,
});
},
confirmPopup(){
confirmPopup() {
this.setData({
showPopup: false
})
showPopup: false,
});
},
input(e) {
this.setData({
'orderObj.remark': e.detail.value
})
"orderObj.remark": e.detail.value,
});
},
changeRefundCount(e){
console.log("🚀 ~ changeRefundCount ~ e:", e)
changeRefundCount(e) {
console.log("🚀 ~ changeRefundCount ~ e:", e);
this.setData({
'orderObj.refundCount': e.detail
})
"orderObj.refundCount": e.detail,
});
},
noScroll() {},
showRefundCount() {
this.setData({
showRefundCount: true
})
showRefundCount: true,
});
},
blur(e) {
const rex = /^(([1-9]{1}\d*)|(0{1}))(\.\d{2})$/
console.log(e)
let {
value
} = e.detail
let {
maxPrice
} = this.data
if (value > maxPrice) value = maxPrice
if (value < 0) value = 0
if (!rex.test(value)) value = maxPrice
const rex = /^(([1-9]{1}\d*)|(0{1}))(\.\d{2})$/;
console.log(e);
let { value } = e.detail;
let { maxPrice } = this.data;
if (value > maxPrice) value = maxPrice;
if (value < 0) value = 0;
if (!rex.test(value)) value = maxPrice;
this.setData({
'orderObj.refundPrice': Number(value).toFixed(2),
showPriceInput: false
})
"orderObj.refundPrice": Number(value).toFixed(2),
showPriceInput: false,
});
},
del(e) {
let {
index
} = e.currentTarget.dataset
let {
imgUrls
} = this.data
imgUrls.splice(index, 1)
let { index } = e.currentTarget.dataset;
let { imgUrls } = this.data;
imgUrls.splice(index, 1);
this.setData({
imgUrls
})
imgUrls,
});
},
upLoad() {
let _this = this
let {
imgUrls
} = this.data
let _this = this;
let { imgUrls } = this.data;
wx.chooseImage({
count: 1
}).then(res => {
let [tempFiles] = res.tempFilePaths
let imgType = tempFiles.split('.')[1]
let type = imgType == 'unknown' ? 'jpg' : imgType
count: 1,
}).then((res) => {
let [tempFiles] = res.tempFilePaths;
let imgType = tempFiles.split(".")[1];
let type = imgType == "unknown" ? "jpg" : imgType;
wx.getFileSystemManager().readFile({
filePath: tempFiles, //选择图片返回的相对路径
encoding: 'base64', //编码格式
encoding: "base64", //编码格式
success(_res) {
wx.p.wxApi.showLoading('上传中...')
wx.p.api.common.uploadImg({
file: `${type}@${_res.data}`
wx.p.wxApi.showLoading("上传中...");
wx.p.api.common
.uploadImg({
file: `${type}@${_res.data}`,
})
.then(img => {
wx.p.wxApi.hideLoading()
console.log(img)
imgUrls.push(img)
.then((img) => {
wx.p.wxApi.hideLoading();
console.log(img);
imgUrls.push(img);
_this.setData({
imgUrls
})
})
}
})
})
imgUrls,
});
});
},
});
});
},
confirm() {
let {
orderObj,
imgUrls
} = this.data
orderObj.imgUrls = imgUrls
console.log(orderObj)
wx.p.api.shopmallApi.afterSale(orderObj).then(({
code,
data,
message
}) => {
if (code == '0') {
wx.p.wxApi.showToast('申请成功!')
let { orderObj, imgUrls } = this.data;
orderObj.imgUrls = imgUrls;
console.log(orderObj);
wx.p.api.shopmallApi.afterSale(orderObj).then(({ code, data, message }) => {
if (code == "0") {
wx.p.wxApi.showToast("申请成功!");
setTimeout(() => {
wx.p.router.back(prevPage => {
prevPage.clearData && prevPage.clearData()
}, 2)
}, 1.5 * 1000)
wx.p.router.back((prevPage) => {
prevPage.clearData && prevPage.clearData();
}, 2);
}, 1.5 * 1000);
} else {
wx.p.wxApi.showToast(message)
wx.p.wxApi.showToast(message);
}
})
});
},
/**
* 生命周期函数--监听页面初次渲染完成
......@@ -166,5 +152,5 @@ Page({
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {}
})
\ No newline at end of file
onReachBottom: function () {},
});
......@@ -65,6 +65,15 @@
<view class="btn text-center" bindtap="confirm">提交</view>
</view>
<popup show="{{showPopup}}" only="{{false}}" title="请选择退款原因" bindconfirm="confirmPopup">
<view class="page-section">
<radio-group bindchange="radioChange">
<label class="weui-cell weui-check__label" wx:for="{{RefundReason}}" wx:key="{{item.value}}">
<view class="weui-cell__hd">
<radio value="{{item.value}}" checked="true" />
</view>
<view class="weui-cell__bd">{{item.text}}</view>
</label>
</radio-group>
</view>
</popup>
<glsx-privacy appletName="海马刀"></glsx-privacy>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!