feat:退款
This commit is contained in:
1 parent
45559b8c35
commit
c3eaafa5d0
2 files changed
+172
-153
No files matched your search
@@ -25,8 +25,8 @@ VITE_IMAGE_BASE_PATH = https://stgl.pj.gov.cn/api # 信创线上
|
|||||||
# ******************** start 开发环境 start ********************
|
# ******************** start 开发环境 start ********************
|
||||||
# VITE_APP_DEV_SERVICE = http://59.202.170.152:81/api # 信创线上
|
# VITE_APP_DEV_SERVICE = http://59.202.170.152:81/api # 信创线上
|
||||||
# VITE_APP_DEV_SERVICE = https://stgl.pj.gov.cn/app-api
|
# VITE_APP_DEV_SERVICE = https://stgl.pj.gov.cn/app-api
|
||||||
VITE_APP_DEV_SERVICE = http://192.168.101.29:9999 # 邓-本地
|
# VITE_APP_DEV_SERVICE = http://192.168.101.29:9999 # 邓-本地
|
||||||
# VITE_APP_DEV_SERVICE = http://127.0.0.1:9999
|
VITE_APP_DEV_SERVICE = http://127.0.0.1:9999
|
||||||
# VITE_APP_DEV_SERVICE = http://123.156.230.15:8089/api
|
# VITE_APP_DEV_SERVICE = http://123.156.230.15:8089/api
|
||||||
# VITE_APP_DEV_SERVICE = http://localhost:9999
|
# VITE_APP_DEV_SERVICE = http://localhost:9999
|
||||||
# ******************** end 开发环境 end ********************
|
# ******************** end 开发环境 end ********************
|
||||||
|
|||||||
+170
-151
@@ -1,188 +1,207 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive } from "vue";
|
import { ref, reactive } from "vue"
|
||||||
import { onLoad, onShow } from "@dcloudio/uni-app";
|
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||||
import { isEmpty } from "radash"
|
import { isEmpty } from "radash"
|
||||||
|
|
||||||
import { hooks, router } from "@@/index"
|
import { hooks, router } from "@@/index"
|
||||||
import { orderApi, refundApi, commonApi } from "@@/api"
|
import { orderApi, refundApi, commonApi } from "@@/api"
|
||||||
|
|
||||||
import { filePath } from "@@/utils/file";
|
import { filePath } from "@@/utils/file"
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
payType: [
|
payType: [
|
||||||
{ text: "仅退款", disabled: false, visible: true, type: "10", value: "10" },
|
{ text: "仅退款", disabled: false, visible: true, type: "10", value: "10" },
|
||||||
{ text: "退款退货", disabled: true, visible: false, type: "20", value: "20" },
|
{ text: "退款退货", disabled: true, visible: false, type: "20", value: "20" },
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
const state = reactive<any>({
|
const state = reactive<any>({
|
||||||
detailId: null,
|
detailId: null,
|
||||||
detail: {},
|
detail: {},
|
||||||
shopCarList: [],
|
shopCarList: [],
|
||||||
setting: {},
|
setting: {},
|
||||||
selectList: []
|
selectList: [],
|
||||||
})
|
})
|
||||||
|
|
||||||
const applyForm = reactive<any>({
|
const applyForm = reactive<any>({
|
||||||
way: data.payType[0].type,
|
way: data.payType[0].type,
|
||||||
remark: "",
|
remark: "",
|
||||||
reason: "",
|
reason: "",
|
||||||
reasonStr: "",
|
reasonStr: "",
|
||||||
})
|
})
|
||||||
|
|
||||||
onLoad((options: any) => {
|
onLoad((options: any) => {
|
||||||
if (!isEmpty(options.id)) {
|
if (!isEmpty(options.id)) {
|
||||||
state.detailId = options.id
|
state.detailId = options.id
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
getDetail()
|
getDetail()
|
||||||
getSetting()
|
getSetting()
|
||||||
getShopCarList()
|
getShopCarList()
|
||||||
})
|
})
|
||||||
|
|
||||||
const getSetting = async () => {
|
const getSetting = async () => {
|
||||||
const _pa = {};
|
const _pa = {}
|
||||||
const { data } = await commonApi.setting(_pa)
|
const { data } = await commonApi.setting(_pa)
|
||||||
state.setting = data
|
state.setting = data
|
||||||
state.selectList = data.afterSaleRefundReasons?.split(",").map(v => {
|
state.selectList = data.afterSaleRefundReasons?.split(",").map((v) => {
|
||||||
return {
|
return {
|
||||||
id: v,
|
id: v,
|
||||||
title: v,
|
title: v,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const getDetail = async () => {
|
const getDetail = async () => {
|
||||||
if (isEmpty(state.detailId)) return
|
if (isEmpty(state.detailId)) return
|
||||||
const _pa = { id: state.detailId };
|
const _pa = { id: state.detailId }
|
||||||
const { data } = await orderApi.detail(_pa)
|
const { data } = await orderApi.detail(_pa)
|
||||||
state.detail = data
|
state.detail = data
|
||||||
}
|
}
|
||||||
const getShopCarList = async () => {
|
const getShopCarList = async () => {
|
||||||
if (isEmpty(state.detailId)) return
|
if (isEmpty(state.detailId)) return
|
||||||
const _pa = { orderId: state.detailId };
|
const _pa = { orderId: state.detailId }
|
||||||
const { data } = await orderApi.shopCarList(_pa)
|
const { data } = await orderApi.shopCarList(_pa)
|
||||||
state.shopCarList = data
|
state.shopCarList = data
|
||||||
}
|
}
|
||||||
|
|
||||||
const radioChange = (e: any) => {
|
const radioChange = (e: any) => {
|
||||||
switch (e) {
|
switch (e) {
|
||||||
case "10":
|
case "10":
|
||||||
state.selectList = state.setting.afterSaleRefundReasons.map(v => {
|
state.selectList = state.setting.afterSaleRefundReasons.map((v) => {
|
||||||
return {
|
return {
|
||||||
id: v,
|
id: v,
|
||||||
title: v,
|
title: v,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
case "20":
|
case "20":
|
||||||
state.selectList = state.setting.afterSaleReturnReasons.map(v => {
|
state.selectList = state.setting.afterSaleReturnReasons.map((v) => {
|
||||||
return {
|
return {
|
||||||
id: v,
|
id: v,
|
||||||
title: v,
|
title: v,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const doSubmit = async () => {
|
const doSubmit = async () => {
|
||||||
if (isEmpty(applyForm.reasonStr)) {
|
if (isEmpty(applyForm.reasonStr)) {
|
||||||
uni.showToast({ title: '请选择申请原因', icon: "none" });
|
uni.showToast({ title: "请选择申请原因", icon: "none" })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const _pa = {
|
const _pa = {
|
||||||
way: applyForm.way,
|
way: applyForm.way,
|
||||||
refundPrice: state.detail.practicalTotalPrice,
|
refundPrice: state.detail.practicalTotalPrice,
|
||||||
orderId: state.detailId,
|
orderId: state.detailId,
|
||||||
images: [],
|
images: [],
|
||||||
applyReason: applyForm.reasonStr,
|
applyReason: applyForm.reasonStr,
|
||||||
applyDescription: applyForm.remark,
|
applyDescription: applyForm.remark,
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
uni.showLoading({ title: '申请中...', mask: false });
|
uni.showLoading({ title: "申请中...", mask: false })
|
||||||
const data = await refundApi.create(_pa)
|
const data = await refundApi.create(_pa)
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
uni.showToast({ title: '申请成功', icon: "none" });
|
uni.showToast({ title: "申请成功", icon: "none" })
|
||||||
router.jump("/pages/order/detail", { id: state.detailId }, 2)
|
router.jump("/pages/order/detail", { id: state.detailId }, 2)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error)
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<crud-layout title="申请售后" mainIsScroll bg="/static/page/blue-bg.png">
|
<crud-layout title="申请售后" mainIsScroll bg="/static/page/blue-bg.png">
|
||||||
<view class="h-30rpx" />
|
<view class="h-30rpx" />
|
||||||
<view class="flex-col justify-center card p-x-20rpx p-y-30rpx m-b-20rpx">
|
<view class="flex-col justify-center card p-x-20rpx p-y-30rpx m-b-20rpx">
|
||||||
<view class="m-t-15rpx">
|
<view class="m-t-15rpx">
|
||||||
<view class="flex-row items-start justify-between" v-for="(v, i) in state.shopCarList" :key="i"
|
<view
|
||||||
@tap.stop="router.jump('/pages/merchant/product-detail', { id: v.productId })">
|
class="flex-row items-start justify-between"
|
||||||
<view class="flex-row items-center">
|
v-for="(v, i) in state.shopCarList"
|
||||||
<image class="w-160rpx h-160rpx rounded-8rpx" :src="filePath(v.productPic)" mode="aspectFill" />
|
:key="i"
|
||||||
<view class="flex-col m-l-15rpx second-text-26">
|
@tap.stop="router.jump('/pages/merchant/product-detail', { id: v.productId })"
|
||||||
<view class="sub-text-28">{{ v.productName }}</view>
|
>
|
||||||
<view class="m-t-5rpx">¥ {{ hooks.useMoney(v.productPrice) }}</view>
|
<view class="flex-row items-center">
|
||||||
<view class="m-t-5rpx">x {{ v.productCount }}</view>
|
<image class="w-160rpx h-160rpx rounded-8rpx" :src="filePath(v.productPic)" mode="aspectFill" />
|
||||||
</view>
|
<view class="flex-col m-l-15rpx second-text-26">
|
||||||
</view>
|
<view class="sub-text-28">{{ v.productName }}</view>
|
||||||
<view class="flex-row-center">
|
<view class="m-t-5rpx">¥ {{ hooks.useMoney(v.productPrice) }}</view>
|
||||||
<view class="sub-text-32">¥ {{ hooks.useMoney(v.totalPrice) }}</view>
|
<view class="m-t-5rpx">x {{ v.productCount }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="m-y-15rpx h-1px bg-#999 bg-opacity-5" />
|
<view class="flex-row-center">
|
||||||
<view class="flex-row items-center justify-between">
|
<view class="sub-text-32">¥ {{ hooks.useMoney(v.totalPrice) }}</view>
|
||||||
<view class="sub-text-28">实付款</view>
|
</view>
|
||||||
<view class="flex-row items-end">
|
</view>
|
||||||
<view class="sub-text-28">¥</view>
|
<view class="m-y-15rpx h-1px bg-#999 bg-opacity-5" />
|
||||||
<view class="m-l-5rpx sub-text-28">{{ hooks.useMoney(state.detail.payPrice) }}</view>
|
<view class="flex-row items-center justify-between">
|
||||||
</view>
|
<view class="sub-text-28">实付款</view>
|
||||||
</view>
|
<view class="flex-row items-end">
|
||||||
</view>
|
<view class="sub-text-28">¥</view>
|
||||||
</view>
|
<view class="m-l-5rpx sub-text-28">{{ hooks.useMoney(state.detail.payPrice) }}</view>
|
||||||
<view class="card p-x-20rpx p-y-30rpx m-b-20rpx">
|
</view>
|
||||||
<view class="sub-text-28">售后类型</view>
|
</view>
|
||||||
<view class="m-t-20rpx">
|
</view>
|
||||||
<tm-radio-group @change="radioChange" direction="column" gap="20" v-model="applyForm.way">
|
</view>
|
||||||
<tm-radio :disabled="v.disabled" v-for="(v, i) in data.payType" :key="i" v-show="v.visible"
|
<view class="card p-x-20rpx p-y-30rpx m-b-20rpx">
|
||||||
:value="v.type" :label="v.text" />
|
<view class="sub-text-28">售后类型</view>
|
||||||
</tm-radio-group>
|
<view class="m-t-20rpx">
|
||||||
</view>
|
<tm-radio-group @change="radioChange" direction="column" gap="20" v-model="applyForm.way">
|
||||||
</view>
|
<tm-radio
|
||||||
<view class="flex-row items-center justify-between card p-x-20rpx p-y-30rpx m-b-20rpx">
|
:disabled="v.disabled"
|
||||||
<view class="sub-text-28">退款金额</view>
|
v-for="(v, i) in data.payType"
|
||||||
<view class="sub-text-28 color-red!">¥{{ hooks.useMoney(state.detail.payPrice) }}</view>
|
:key="i"
|
||||||
</view>
|
v-show="v.visible"
|
||||||
<view class="card p-x-20rpx p-y-30rpx m-b-20rpx">
|
:value="v.type"
|
||||||
<tm-picker rang-key="title" rang-text="title" v-model="applyForm.reason"
|
:label="v.text"
|
||||||
v-model:model-str="applyForm.reasonStr" :list="state.selectList">
|
/>
|
||||||
<view class="flex-row items-center justify-between">
|
</tm-radio-group>
|
||||||
<view class="sub-text-28">申请原因</view>
|
</view>
|
||||||
<view class="flex-row items-center second-text-24">
|
</view>
|
||||||
<text>{{ applyForm.reasonStr || '请选择申请原因' }} </text>
|
<view class="flex-row items-center justify-between card p-x-20rpx p-y-30rpx m-b-20rpx">
|
||||||
<text class="m-l-10rpx color-#b1b1b1 iconfont icon-xiangxiajiantouxiao" />
|
<view class="sub-text-28">退款金额</view>
|
||||||
</view>
|
<view class="sub-text-28 color-red!">¥{{ hooks.useMoney(state.detail.payPrice) }}</view>
|
||||||
</view>
|
</view>
|
||||||
</tm-picker>
|
<view class="card p-x-20rpx p-y-30rpx m-b-20rpx">
|
||||||
</view>
|
<tm-picker
|
||||||
<view class="flex-col justify-center card p-x-20rpx p-y-30rpx m-b-20rpx">
|
rang-key="title"
|
||||||
<view class="sub-text-28">相关描述</view>
|
rang-text="title"
|
||||||
<view class="m-t-20rpx">
|
v-model="applyForm.reason"
|
||||||
<tm-input v-model="applyForm.remark" type="textarea" :showClear="false"
|
v-model:model-str="applyForm.reasonStr"
|
||||||
placeholder="客官~请描述您遇到的问题"></tm-input>
|
:list="state.selectList"
|
||||||
</view>
|
>
|
||||||
</view>
|
<view class="flex-row items-center justify-between">
|
||||||
<view class="h-30rpx" />
|
<view class="sub-text-28">申请原因</view>
|
||||||
<template #main-bottom>
|
<view class="flex-row items-center second-text-24">
|
||||||
<view v-if="state.detailType != 'view'"
|
<text>{{ applyForm.reasonStr || "请选择申请原因" }} </text>
|
||||||
class="bg-#0094ff p-y-20rpx text-center rounded-40rpx m-x-30rpx m-y-30rpx sub-text-30 color-white!"
|
<text class="m-l-10rpx color-#b1b1b1 iconfont icon-xiangxiajiantouxiao" />
|
||||||
@tap="doSubmit">
|
</view>
|
||||||
提交申请
|
</view>
|
||||||
</view>
|
</tm-picker>
|
||||||
</template>
|
</view>
|
||||||
</crud-layout>
|
<view class="flex-col justify-center card p-x-20rpx p-y-30rpx m-b-20rpx">
|
||||||
|
<view class="sub-text-28">相关描述</view>
|
||||||
|
<view class="m-t-20rpx">
|
||||||
|
<tm-input
|
||||||
|
v-model="applyForm.remark"
|
||||||
|
type="textarea"
|
||||||
|
:showClear="false"
|
||||||
|
placeholder="客官~请描述您遇到的问题"
|
||||||
|
></tm-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="h-30rpx" />
|
||||||
|
<template #main-bottom>
|
||||||
|
<view
|
||||||
|
v-if="state.detailType != 'view'"
|
||||||
|
class="bg-#0094ff p-y-20rpx text-center rounded-40rpx m-x-30rpx m-y-30rpx sub-text-30 color-white!"
|
||||||
|
@tap="doSubmit"
|
||||||
|
>
|
||||||
|
提交申请
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</crud-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
Reference in new issue
Block a user