|
@@ -3,13 +3,8 @@
|
|
<s-layout title="申请售后">
|
|
<s-layout title="申请售后">
|
|
<!-- 售后产品 -->
|
|
<!-- 售后产品 -->
|
|
<view class="goods-box">
|
|
<view class="goods-box">
|
|
- <s-goods-item
|
|
|
|
- :img="state.item.picUrl"
|
|
|
|
- :num="state.item.count"
|
|
|
|
- :price="state.item.price"
|
|
|
|
- :skuText="state.item.properties?.map((property) => property.valueName).join(' ')"
|
|
|
|
- :title="state.item.spuName"
|
|
|
|
- />
|
|
|
|
|
|
+ <s-goods-item :img="state.item.picUrl" :num="state.item.count" :price="state.item.price"
|
|
|
|
+ :skuText="state.item.properties?.map((property) => property.valueName).join(' ')" :title="state.item.spuName" />
|
|
</view>
|
|
</view>
|
|
|
|
|
|
<uni-forms ref="form" v-model="formData" :rules="rules" label-position="top">
|
|
<uni-forms ref="form" v-model="formData" :rules="rules" label-position="top">
|
|
@@ -18,17 +13,9 @@
|
|
<view class="item-title ss-m-b-20">售后类型</view>
|
|
<view class="item-title ss-m-b-20">售后类型</view>
|
|
<view class="ss-flex-col">
|
|
<view class="ss-flex-col">
|
|
<radio-group @change="onRefundChange">
|
|
<radio-group @change="onRefundChange">
|
|
- <label
|
|
|
|
- v-for="(item, index) in state.wayList"
|
|
|
|
- :key="index"
|
|
|
|
- class="ss-flex ss-col-center ss-p-y-10"
|
|
|
|
- >
|
|
|
|
- <radio
|
|
|
|
- :checked="formData.type === item.value"
|
|
|
|
- :value="item.value"
|
|
|
|
- color="var(--ui-BG-Main)"
|
|
|
|
- style="transform: scale(0.8)"
|
|
|
|
- />
|
|
|
|
|
|
+ <label v-for="(item, index) in state.wayList" :key="index" class="ss-flex ss-col-center ss-p-y-10">
|
|
|
|
+ <radio :checked="formData.type === item.value" :value="item.value" color="var(--ui-BG-Main)"
|
|
|
|
+ style="transform: scale(0.8)" />
|
|
<view class="item-value ss-m-l-8">{{ item.text }}</view>
|
|
<view class="item-value ss-m-l-8">{{ item.text }}</view>
|
|
</label>
|
|
</label>
|
|
</radio-group>
|
|
</radio-group>
|
|
@@ -55,24 +42,12 @@
|
|
<view class="refund-item">
|
|
<view class="refund-item">
|
|
<view class="item-title ss-m-b-20">相关描述</view>
|
|
<view class="item-title ss-m-b-20">相关描述</view>
|
|
<view class="describe-box">
|
|
<view class="describe-box">
|
|
- <uni-easyinput
|
|
|
|
- v-model="formData.applyDescription"
|
|
|
|
- :inputBorder="false"
|
|
|
|
- autoHeight
|
|
|
|
- class="describe-content"
|
|
|
|
- maxlength="120"
|
|
|
|
- placeholder="客官~请描述您遇到的问题,建议上传照片"
|
|
|
|
- type="textarea"
|
|
|
|
- />
|
|
|
|
|
|
+ <uni-easyinput v-model="formData.applyDescription" :inputBorder="false" autoHeight class="describe-content"
|
|
|
|
+ maxlength="120" placeholder="客官~请描述您遇到的问题,建议上传照片" type="textarea" />
|
|
<!-- TODO 芋艿:上传的测试 -->
|
|
<!-- TODO 芋艿:上传的测试 -->
|
|
<view class="upload-img">
|
|
<view class="upload-img">
|
|
- <s-uploader
|
|
|
|
- v-model:url="formData.applyPicUrls"
|
|
|
|
- :imageStyles="{ width: '168rpx', height: '168rpx' }"
|
|
|
|
- fileMediatype="image"
|
|
|
|
- limit="9"
|
|
|
|
- mode="grid"
|
|
|
|
- />
|
|
|
|
|
|
+ <s-uploader v-model:url="formData.applyPicUrls" :imageStyles="{ width: '168rpx', height: '168rpx' }"
|
|
|
|
+ fileMediatype="image" limit="9" mode="grid" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -100,11 +75,7 @@
|
|
<radio-group @change="onChange">
|
|
<radio-group @change="onChange">
|
|
<label v-for="item in state.reasonList" :key="item" class="radio ss-flex ss-col-center">
|
|
<label v-for="item in state.reasonList" :key="item" class="radio ss-flex ss-col-center">
|
|
<view class="ss-flex-1 ss-p-20">{{ item }}</view>
|
|
<view class="ss-flex-1 ss-p-20">{{ item }}</view>
|
|
- <radio
|
|
|
|
- :checked="item === state.currentValue"
|
|
|
|
- :value="item"
|
|
|
|
- color="var(--ui-BG-Main)"
|
|
|
|
- />
|
|
|
|
|
|
+ <radio :checked="item === state.currentValue" :value="item" color="var(--ui-BG-Main)" />
|
|
</label>
|
|
</label>
|
|
</radio-group>
|
|
</radio-group>
|
|
</view>
|
|
</view>
|
|
@@ -119,232 +90,232 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
- import sheep from '@/sheep';
|
|
|
|
- import { onLoad } from '@dcloudio/uni-app';
|
|
|
|
- import { reactive, ref } from 'vue';
|
|
|
|
- import OrderApi from '@/sheep/api/trade/order';
|
|
|
|
- import TradeConfigApi from '@/sheep/api/trade/config';
|
|
|
|
- import { fen2yuan } from '@/sheep/hooks/useGoods';
|
|
|
|
- import AfterSaleApi from '@/sheep/api/trade/afterSale';
|
|
|
|
-
|
|
|
|
- const form = ref(null);
|
|
|
|
- const state = reactive({
|
|
|
|
- orderId: 0, // 订单编号
|
|
|
|
- itemId: 0, // 订单项编号
|
|
|
|
- order: {}, // 订单
|
|
|
|
- item: {}, // 订单项
|
|
|
|
- config: {}, // 交易配置
|
|
|
|
-
|
|
|
|
- // 售后类型
|
|
|
|
- wayList: [
|
|
|
|
- {
|
|
|
|
- text: '仅退款',
|
|
|
|
- value: '10',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- text: '退款退货',
|
|
|
|
- value: '20',
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- reasonList: [], // 可选的申请原因数组
|
|
|
|
- showModal: false, // 是否显示申请原因弹窗
|
|
|
|
- currentValue: '', // 当前选择的售后原因
|
|
|
|
- });
|
|
|
|
- let formData = reactive({
|
|
|
|
- way: '',
|
|
|
|
- applyReason: '',
|
|
|
|
- applyDescription: '',
|
|
|
|
- applyPicUrls: [],
|
|
|
|
- });
|
|
|
|
- const rules = reactive({});
|
|
|
|
-
|
|
|
|
- // 提交表单
|
|
|
|
- async function submit() {
|
|
|
|
- let data = {
|
|
|
|
- orderItemId: state.itemId,
|
|
|
|
- refundPrice: state.item.payPrice,
|
|
|
|
- ...formData,
|
|
|
|
- };
|
|
|
|
- const { code } = await AfterSaleApi.createAfterSale(data);
|
|
|
|
- if (code === 0) {
|
|
|
|
- uni.showToast({
|
|
|
|
- title: '申请成功',
|
|
|
|
- });
|
|
|
|
- sheep.$router.redirect('/pages/order/aftersale/list');
|
|
|
|
- }
|
|
|
|
|
|
+import sheep from '@/sheep';
|
|
|
|
+import { onLoad } from '@dcloudio/uni-app';
|
|
|
|
+import { reactive, ref } from 'vue';
|
|
|
|
+import OrderApi from '@/sheep/api/trade/order';
|
|
|
|
+import TradeConfigApi from '@/sheep/api/trade/config';
|
|
|
|
+import { fen2yuan } from '@/sheep/hooks/useGoods';
|
|
|
|
+import AfterSaleApi from '@/sheep/api/trade/afterSale';
|
|
|
|
+
|
|
|
|
+const form = ref(null);
|
|
|
|
+const state = reactive({
|
|
|
|
+ orderId: 0, // 订单编号
|
|
|
|
+ itemId: 0, // 订单项编号
|
|
|
|
+ order: {}, // 订单
|
|
|
|
+ item: {}, // 订单项
|
|
|
|
+ config: {}, // 交易配置
|
|
|
|
+
|
|
|
|
+ // 售后类型
|
|
|
|
+ wayList: [
|
|
|
|
+ {
|
|
|
|
+ text: '仅退款',
|
|
|
|
+ value: '10',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ text: '退款退货',
|
|
|
|
+ value: '20',
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ reasonList: [], // 可选的申请原因数组
|
|
|
|
+ showModal: false, // 是否显示申请原因弹窗
|
|
|
|
+ currentValue: '', // 当前选择的售后原因
|
|
|
|
+});
|
|
|
|
+let formData = reactive({
|
|
|
|
+ way: '',
|
|
|
|
+ applyReason: '',
|
|
|
|
+ applyDescription: '',
|
|
|
|
+ applyPicUrls: [],
|
|
|
|
+});
|
|
|
|
+const rules = reactive({});
|
|
|
|
+
|
|
|
|
+// 提交表单
|
|
|
|
+async function submit() {
|
|
|
|
+ let data = {
|
|
|
|
+ orderItemId: state.itemId,
|
|
|
|
+ refundPrice: state.item.payPrice,
|
|
|
|
+ ...formData,
|
|
|
|
+ };
|
|
|
|
+ const { code } = await AfterSaleApi.createAfterSale(data);
|
|
|
|
+ if (code === 0) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: '申请成功',
|
|
|
|
+ });
|
|
|
|
+ sheep.$router.redirect('/pages/order/aftersale/list');
|
|
}
|
|
}
|
|
-
|
|
|
|
- // 选择售后类型
|
|
|
|
- function onRefundChange(e) {
|
|
|
|
- formData.way = e.detail.value;
|
|
|
|
- // 清理理由
|
|
|
|
- state.reasonList =
|
|
|
|
- formData.way === '10'
|
|
|
|
- ? state.config.afterSaleRefundReasons || []
|
|
|
|
- : state.config.afterSaleReturnReasons || [];
|
|
|
|
- formData.applyReason = '';
|
|
|
|
- state.currentValue = '';
|
|
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 选择售后类型
|
|
|
|
+function onRefundChange(e) {
|
|
|
|
+ formData.way = e.detail.value;
|
|
|
|
+ // 清理理由
|
|
|
|
+ state.reasonList =
|
|
|
|
+ formData.way === '10'
|
|
|
|
+ ? state.config.afterSaleRefundReasons || []
|
|
|
|
+ : state.config.afterSaleReturnReasons || [];
|
|
|
|
+ formData.applyReason = '';
|
|
|
|
+ state.currentValue = '';
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 选择申请原因
|
|
|
|
+function onChange(e) {
|
|
|
|
+ state.currentValue = e.detail.value;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 确定
|
|
|
|
+function onReason() {
|
|
|
|
+ formData.applyReason = state.currentValue;
|
|
|
|
+ state.showModal = false;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+onLoad(async (options) => {
|
|
|
|
+ // 解析参数
|
|
|
|
+ if (!options.orderId || !options.itemId) {
|
|
|
|
+ sheep.$helper.toast(`缺少订单信息,请检查`);
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
+ state.orderId = options.orderId;
|
|
|
|
+ state.itemId = parseInt(options.itemId);
|
|
|
|
|
|
- // 选择申请原因
|
|
|
|
- function onChange(e) {
|
|
|
|
- state.currentValue = e.detail.value;
|
|
|
|
|
|
+ // 读取订单信息
|
|
|
|
+ const { code, data } = await OrderApi.getOrderDetail(state.orderId);
|
|
|
|
+ if (code !== 0) {
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
+ state.order = data;
|
|
|
|
+ state.item = data.items.find((item) => item.id === state.itemId) || {};
|
|
|
|
|
|
- // 确定
|
|
|
|
- function onReason() {
|
|
|
|
- formData.applyReason = state.currentValue;
|
|
|
|
- state.showModal = false;
|
|
|
|
|
|
+ // 设置选项
|
|
|
|
+ if (state.order.status === 10) {
|
|
|
|
+ state.wayList.splice(1, 1);
|
|
}
|
|
}
|
|
|
|
|
|
- onLoad(async (options) => {
|
|
|
|
- // 解析参数
|
|
|
|
- if (!options.orderId || !options.itemId) {
|
|
|
|
- sheep.$helper.toast(`缺少订单信息,请检查`);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- state.orderId = options.orderId;
|
|
|
|
- state.itemId = parseInt(options.itemId);
|
|
|
|
-
|
|
|
|
- // 读取订单信息
|
|
|
|
- const { code, data } = await OrderApi.getOrderDetail(state.orderId);
|
|
|
|
- if (code !== 0) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- state.order = data;
|
|
|
|
- state.item = data.items.find((item) => item.id === state.itemId) || {};
|
|
|
|
-
|
|
|
|
- // 设置选项
|
|
|
|
- if (state.order.status === 10) {
|
|
|
|
- state.wayList.splice(1, 1);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 读取配置
|
|
|
|
- state.config = (await TradeConfigApi.getTradeConfig()).data;
|
|
|
|
- });
|
|
|
|
|
|
+ // 读取配置
|
|
|
|
+ state.config = (await TradeConfigApi.getTradeConfig()).data;
|
|
|
|
+});
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
- .item-title {
|
|
|
|
- font-size: 30rpx;
|
|
|
|
- font-weight: bold;
|
|
|
|
- color: rgba(51, 51, 51, 1);
|
|
|
|
- // margin-bottom: 20rpx;
|
|
|
|
|
|
+.item-title {
|
|
|
|
+ font-size: 30rpx;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ color: rgba(51, 51, 51, 1);
|
|
|
|
+ // margin-bottom: 20rpx;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 售后项目
|
|
|
|
+.refund-item {
|
|
|
|
+ background-color: #fff;
|
|
|
|
+ border-bottom: 1rpx solid #f5f5f5;
|
|
|
|
+ padding: 30rpx;
|
|
|
|
+
|
|
|
|
+ &:last-child {
|
|
|
|
+ border: none;
|
|
}
|
|
}
|
|
|
|
|
|
- // 售后项目
|
|
|
|
- .refund-item {
|
|
|
|
- background-color: #fff;
|
|
|
|
- border-bottom: 1rpx solid #f5f5f5;
|
|
|
|
|
|
+ // 留言
|
|
|
|
+ .describe-box {
|
|
|
|
+ width: 690rpx;
|
|
|
|
+ background: rgba(249, 250, 251, 1);
|
|
padding: 30rpx;
|
|
padding: 30rpx;
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+ border-radius: 20rpx;
|
|
|
|
|
|
- &:last-child {
|
|
|
|
- border: none;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 留言
|
|
|
|
- .describe-box {
|
|
|
|
- width: 690rpx;
|
|
|
|
- background: rgba(249, 250, 251, 1);
|
|
|
|
- padding: 30rpx;
|
|
|
|
- box-sizing: border-box;
|
|
|
|
- border-radius: 20rpx;
|
|
|
|
-
|
|
|
|
- .describe-content {
|
|
|
|
- height: 200rpx;
|
|
|
|
- font-size: 24rpx;
|
|
|
|
- font-weight: 400;
|
|
|
|
- color: #333;
|
|
|
|
- }
|
|
|
|
|
|
+ .describe-content {
|
|
|
|
+ height: 200rpx;
|
|
|
|
+ font-size: 24rpx;
|
|
|
|
+ font-weight: 400;
|
|
|
|
+ color: #333;
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
- // 联系方式
|
|
|
|
- .input-box {
|
|
|
|
- height: 84rpx;
|
|
|
|
- background: rgba(249, 250, 251, 1);
|
|
|
|
- border-radius: 20rpx;
|
|
|
|
- }
|
|
|
|
|
|
+ // 联系方式
|
|
|
|
+ .input-box {
|
|
|
|
+ height: 84rpx;
|
|
|
|
+ background: rgba(249, 250, 251, 1);
|
|
|
|
+ border-radius: 20rpx;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.goods-box {
|
|
|
|
+ background: #fff;
|
|
|
|
+ padding: 20rpx;
|
|
|
|
+ margin-bottom: 20rpx;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.foot-wrap {
|
|
|
|
+ height: 100rpx;
|
|
|
|
+ width: 100%;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.foot_box {
|
|
|
|
+ height: 100rpx;
|
|
|
|
+ background-color: #fff;
|
|
|
|
+
|
|
|
|
+ .sub-btn {
|
|
|
|
+ width: 336rpx;
|
|
|
|
+ line-height: 74rpx;
|
|
|
|
+ border-radius: 38rpx;
|
|
|
|
+ color: rgba(#fff, 0.9);
|
|
|
|
+ font-size: 28rpx;
|
|
}
|
|
}
|
|
|
|
|
|
- .goods-box {
|
|
|
|
- background: #fff;
|
|
|
|
- padding: 20rpx;
|
|
|
|
- margin-bottom: 20rpx;
|
|
|
|
|
|
+ .contcat-btn {
|
|
|
|
+ width: 336rpx;
|
|
|
|
+ line-height: 74rpx;
|
|
|
|
+ background: rgba(238, 238, 238, 1);
|
|
|
|
+ border-radius: 38rpx;
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
+ font-weight: 400;
|
|
|
|
+ color: rgba(51, 51, 51, 1);
|
|
}
|
|
}
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.modal-box {
|
|
|
|
+ width: 750rpx;
|
|
|
|
+ // height: 680rpx;
|
|
|
|
+ border-radius: 30rpx 30rpx 0 0;
|
|
|
|
+ background: #fff;
|
|
|
|
|
|
- .foot-wrap {
|
|
|
|
|
|
+ .modal-head {
|
|
height: 100rpx;
|
|
height: 100rpx;
|
|
- width: 100%;
|
|
|
|
|
|
+ font-size: 30rpx;
|
|
}
|
|
}
|
|
|
|
|
|
- .foot_box {
|
|
|
|
- height: 100rpx;
|
|
|
|
- background-color: #fff;
|
|
|
|
|
|
+ .modal-content {
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
+ }
|
|
|
|
|
|
- .sub-btn {
|
|
|
|
- width: 336rpx;
|
|
|
|
- line-height: 74rpx;
|
|
|
|
- border-radius: 38rpx;
|
|
|
|
|
|
+ .modal-foot {
|
|
|
|
+ .close-btn {
|
|
|
|
+ width: 710rpx;
|
|
|
|
+ line-height: 80rpx;
|
|
|
|
+ border-radius: 40rpx;
|
|
color: rgba(#fff, 0.9);
|
|
color: rgba(#fff, 0.9);
|
|
- font-size: 28rpx;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- .contcat-btn {
|
|
|
|
- width: 336rpx;
|
|
|
|
- line-height: 74rpx;
|
|
|
|
- background: rgba(238, 238, 238, 1);
|
|
|
|
- border-radius: 38rpx;
|
|
|
|
- font-size: 28rpx;
|
|
|
|
- font-weight: 400;
|
|
|
|
- color: rgba(51, 51, 51, 1);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+}
|
|
|
|
|
|
- .modal-box {
|
|
|
|
- width: 750rpx;
|
|
|
|
- // height: 680rpx;
|
|
|
|
- border-radius: 30rpx 30rpx 0 0;
|
|
|
|
- background: #fff;
|
|
|
|
-
|
|
|
|
- .modal-head {
|
|
|
|
- height: 100rpx;
|
|
|
|
- font-size: 30rpx;
|
|
|
|
- }
|
|
|
|
|
|
+.success-box {
|
|
|
|
+ width: 600rpx;
|
|
|
|
+ padding: 90rpx 0 64rpx 0;
|
|
|
|
|
|
- .modal-content {
|
|
|
|
- font-size: 28rpx;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- .modal-foot {
|
|
|
|
- .close-btn {
|
|
|
|
- width: 710rpx;
|
|
|
|
- line-height: 80rpx;
|
|
|
|
- border-radius: 40rpx;
|
|
|
|
- color: rgba(#fff, 0.9);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ .cicon-check-round {
|
|
|
|
+ font-size: 96rpx;
|
|
|
|
+ color: #04b750;
|
|
}
|
|
}
|
|
|
|
|
|
- .success-box {
|
|
|
|
- width: 600rpx;
|
|
|
|
- padding: 90rpx 0 64rpx 0;
|
|
|
|
-
|
|
|
|
- .cicon-check-round {
|
|
|
|
- font-size: 96rpx;
|
|
|
|
- color: #04b750;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- .success-title {
|
|
|
|
- font-weight: 500;
|
|
|
|
- color: #333333;
|
|
|
|
- font-size: 32rpx;
|
|
|
|
- }
|
|
|
|
|
|
+ .success-title {
|
|
|
|
+ font-weight: 500;
|
|
|
|
+ color: #333333;
|
|
|
|
+ font-size: 32rpx;
|
|
|
|
+ }
|
|
|
|
|
|
- .success-btn {
|
|
|
|
- width: 492rpx;
|
|
|
|
- height: 70rpx;
|
|
|
|
- background: linear-gradient(90deg, var(--ui-BG-Main-gradient), var(--ui-BG-Main));
|
|
|
|
- border-radius: 35rpx;
|
|
|
|
- }
|
|
|
|
|
|
+ .success-btn {
|
|
|
|
+ width: 492rpx;
|
|
|
|
+ height: 70rpx;
|
|
|
|
+ background: linear-gradient(90deg, var(--ui-BG-Main-gradient), var(--ui-BG-Main));
|
|
|
|
+ border-radius: 35rpx;
|
|
}
|
|
}
|
|
|
|
+}
|
|
</style>
|
|
</style>
|