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 @@ ...@@ -8,9 +8,7 @@
"pages/webView/webView", "pages/webView/webView",
"pages/Login/Login" "pages/Login/Login"
], ],
"requiredPrivateInfos": [ "requiredPrivateInfos": ["getLocation"],
"getLocation"
],
"lazyCodeLoading": "requiredComponents", "lazyCodeLoading": "requiredComponents",
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
...@@ -22,7 +20,8 @@ ...@@ -22,7 +20,8 @@
"selectedColor": "#8A303A", "selectedColor": "#8A303A",
"backgroundColor": "#FFFFFF", "backgroundColor": "#FFFFFF",
"borderStyle": "white", "borderStyle": "white",
"list": [{ "list": [
{
"pagePath": "pages/tab/index/index", "pagePath": "pages/tab/index/index",
"text": "首页", "text": "首页",
"iconPath": "assets/images/home.png", "iconPath": "assets/images/home.png",
...@@ -42,7 +41,8 @@ ...@@ -42,7 +41,8 @@
} }
] ]
}, },
"subpackages": [{ "subpackages": [
{
"root": "packageIndex", "root": "packageIndex",
"pages": [ "pages": [
"pages/bannerJumpPage/bannerJumpPage", "pages/bannerJumpPage/bannerJumpPage",
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
"authorize": "/components/Authorize/Authorize", "authorize": "/components/Authorize/Authorize",
"popup": "/components/Popup/Popup", "popup": "/components/Popup/Popup",
"goods-action": "/components/GoodsAction/GoodsAction", "goods-action": "/components/GoodsAction/GoodsAction",
"glsx-privacy":"glsx-applet-component/GlsxPrivacy/index" "glsx-privacy": "glsx-applet-component/GlsxPrivacy/index"
}, },
"style": "v2", "style": "v2",
"resolveAlias": { "resolveAlias": {
...@@ -100,7 +100,9 @@ ...@@ -100,7 +100,9 @@
"desc": "你的位置信息将用于小程序位置接口的效果展示" "desc": "你的位置信息将用于小程序位置接口的效果展示"
} }
}, },
"plugins": { "plugins": {},
"useExtendedLib": {
"weui": true
}, },
"__usePrivacyCheck__": true "__usePrivacyCheck__": true
}
\ No newline at end of file \ No newline at end of file
}
...@@ -6,7 +6,7 @@ export const ToolList = Object.freeze([ ...@@ -6,7 +6,7 @@ export const ToolList = Object.freeze([
}, },
]); ]);
export const ORDER_LIST =[ export const ORDER_LIST = [
{ {
text: "全部", text: "全部",
code: 0, code: 0,
...@@ -35,4 +35,55 @@ export const ORDER_LIST =[ ...@@ -35,4 +35,55 @@ export const ORDER_LIST =[
image: "aftermarket", image: "aftermarket",
code: 5, code: 5,
}, },
]
\ No newline at end of file \ 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 { import { afterSaleMixin } from "~/mixins/index";
afterSaleMixin import { RefundReason } from "~/constants/mine.js";
} from '~/mixins/index' console.log("🚀 ~ RefundReason:", RefundReason)
Page({ Page({
behaviors: [afterSaleMixin], behaviors: [afterSaleMixin],
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
imgUrls: [] imgUrls: [],
RefundReason: Object.freeze(RefundReason),
}, },
previewImage(e) { previewImage(e) {
let params = e.currentTarget.dataset let params = e.currentTarget.dataset;
wx.p.wxApi.previewImage(params) wx.p.wxApi.previewImage(params);
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
let imgUrls = [] let imgUrls = [];
wx.p.router.getRouterParams(options).then(params => { wx.p.router.getRouterParams(options).then((params) => {
if (params.imgUrls) imgUrls = params.imgUrls if (params.imgUrls) imgUrls = params.imgUrls;
this.setData({ this.setData({
orderObj: params, orderObj: params,
imgUrls, imgUrls,
maxRefundCount: params.refundCount maxRefundCount: params.refundCount,
}) });
}) });
}, },
showPopup(){ showPopup() {
this.setData({ this.setData({
showPopup: true showPopup: true,
}) });
}, },
confirmPopup(){ confirmPopup() {
this.setData({ this.setData({
showPopup: false showPopup: false,
}) });
}, },
input(e) { input(e) {
this.setData({ this.setData({
'orderObj.remark': e.detail.value "orderObj.remark": e.detail.value,
}) });
}, },
changeRefundCount(e){ changeRefundCount(e) {
console.log("🚀 ~ changeRefundCount ~ e:", e) console.log("🚀 ~ changeRefundCount ~ e:", e);
this.setData({ this.setData({
'orderObj.refundCount': e.detail "orderObj.refundCount": e.detail,
}) });
}, },
noScroll() {}, noScroll() {},
showRefundCount() { showRefundCount() {
this.setData({ this.setData({
showRefundCount: true showRefundCount: true,
}) });
}, },
blur(e) { blur(e) {
const rex = /^(([1-9]{1}\d*)|(0{1}))(\.\d{2})$/ const rex = /^(([1-9]{1}\d*)|(0{1}))(\.\d{2})$/;
console.log(e) console.log(e);
let { let { value } = e.detail;
value let { maxPrice } = this.data;
} = e.detail if (value > maxPrice) value = maxPrice;
let { if (value < 0) value = 0;
maxPrice if (!rex.test(value)) value = maxPrice;
} = this.data
if (value > maxPrice) value = maxPrice
if (value < 0) value = 0
if (!rex.test(value)) value = maxPrice
this.setData({ this.setData({
'orderObj.refundPrice': Number(value).toFixed(2), "orderObj.refundPrice": Number(value).toFixed(2),
showPriceInput: false showPriceInput: false,
}) });
}, },
del(e) { del(e) {
let { let { index } = e.currentTarget.dataset;
index let { imgUrls } = this.data;
} = e.currentTarget.dataset imgUrls.splice(index, 1);
let {
imgUrls
} = this.data
imgUrls.splice(index, 1)
this.setData({ this.setData({
imgUrls imgUrls,
}) });
}, },
upLoad() { upLoad() {
let _this = this let _this = this;
let { let { imgUrls } = this.data;
imgUrls
} = this.data
wx.chooseImage({ wx.chooseImage({
count: 1 count: 1,
}).then(res => { }).then((res) => {
let [tempFiles] = res.tempFilePaths let [tempFiles] = res.tempFilePaths;
let imgType = tempFiles.split('.')[1] let imgType = tempFiles.split(".")[1];
let type = imgType == 'unknown' ? 'jpg' : imgType let type = imgType == "unknown" ? "jpg" : imgType;
wx.getFileSystemManager().readFile({ wx.getFileSystemManager().readFile({
filePath: tempFiles, //选择图片返回的相对路径 filePath: tempFiles, //选择图片返回的相对路径
encoding: 'base64', //编码格式 encoding: "base64", //编码格式
success(_res) { success(_res) {
wx.p.wxApi.showLoading('上传中...') wx.p.wxApi.showLoading("上传中...");
wx.p.api.common.uploadImg({ wx.p.api.common
file: `${type}@${_res.data}` .uploadImg({
file: `${type}@${_res.data}`,
}) })
.then(img => { .then((img) => {
wx.p.wxApi.hideLoading() wx.p.wxApi.hideLoading();
console.log(img) console.log(img);
imgUrls.push(img) imgUrls.push(img);
_this.setData({ _this.setData({
imgUrls imgUrls,
}) });
}) });
} },
}) });
}) });
}, },
confirm() { confirm() {
let { let { orderObj, imgUrls } = this.data;
orderObj, orderObj.imgUrls = imgUrls;
imgUrls console.log(orderObj);
} = this.data wx.p.api.shopmallApi.afterSale(orderObj).then(({ code, data, message }) => {
orderObj.imgUrls = imgUrls if (code == "0") {
console.log(orderObj) wx.p.wxApi.showToast("申请成功!");
wx.p.api.shopmallApi.afterSale(orderObj).then(({
code,
data,
message
}) => {
if (code == '0') {
wx.p.wxApi.showToast('申请成功!')
setTimeout(() => { setTimeout(() => {
wx.p.router.back(prevPage => { wx.p.router.back((prevPage) => {
prevPage.clearData && prevPage.clearData() prevPage.clearData && prevPage.clearData();
}, 2) }, 2);
}, 1.5 * 1000) }, 1.5 * 1000);
} else { } else {
wx.p.wxApi.showToast(message) wx.p.wxApi.showToast(message);
} }
}) });
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
...@@ -166,5 +152,5 @@ Page({ ...@@ -166,5 +152,5 @@ Page({
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () {}
})
\ No newline at end of file \ No newline at end of file
onReachBottom: function () {},
});
...@@ -65,6 +65,15 @@ ...@@ -65,6 +65,15 @@
<view class="btn text-center" bindtap="confirm">提交</view> <view class="btn text-center" bindtap="confirm">提交</view>
</view> </view>
<popup show="{{showPopup}}" only="{{false}}" title="请选择退款原因" bindconfirm="confirmPopup"> <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> </popup>
<glsx-privacy appletName="海马刀"></glsx-privacy> <glsx-privacy appletName="海马刀"></glsx-privacy>
\ No newline at end of file \ 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!