apply.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <!-- 订单详情 -->
  2. <template>
  3. <s-layout title="申请售后">
  4. <!-- 售后商品 -->
  5. <view class="goods-box">
  6. <s-goods-item :img="state.goodsItem.goods_image" :title="state.goodsItem.goods_title"
  7. :skuText="state.goodsItem.goods_sku_text" :price="state.goodsItem.goods_price"
  8. :num="state.goodsItem.goods_num"></s-goods-item>
  9. </view>
  10. <uni-forms ref="form" v-model="formData" :rules="rules" label-position="top">
  11. <!-- 售后类型 -->
  12. <view class="refund-item">
  13. <view class="item-title ss-m-b-20">售后类型</view>
  14. <view class="ss-flex-col">
  15. <radio-group @change="onRefundChange">
  16. <label class="ss-flex ss-col-center ss-p-y-10" v-for="(item, index) in state.refundTypeList" :key="index">
  17. <radio :checked="formData.type === item.value" color="var(--ui-BG-Main)" style="transform: scale(0.8)"
  18. :value="item.value" />
  19. <view class="item-value ss-m-l-8">{{ item.text }}</view>
  20. </label>
  21. </radio-group>
  22. </view>
  23. </view>
  24. <!-- 申请原因 -->
  25. <view class="refund-item ss-flex ss-col-center ss-row-between" @tap="state.showModal = true">
  26. <text class="item-title">申请原因</text>
  27. <view class="ss-flex refund-cause ss-col-center">
  28. <text class="ss-m-r-20" v-if="formData.reason">{{ formData.reason }}</text>
  29. <text class="ss-m-r-20" v-else>请选择申请原因~</text>
  30. <!-- <text class="ss-iconfont _icon-forward" style="color: #666"></text> -->
  31. <text class="cicon-forward" style="height: 28rpx"></text>
  32. </view>
  33. </view>
  34. <view class="refund-item u-m-b-20">
  35. <view class="item-title ss-m-b-20">联系方式</view>
  36. <view class="input-box u-flex">
  37. <uni-easyinput :inputBorder="false" type="number" v-model="formData.mobile" placeholder="请输入您的联系电话"
  38. paddingLeft="10" />
  39. </view>
  40. </view>
  41. <!-- 留言 -->
  42. <view class="refund-item">
  43. <view class="item-title ss-m-b-20">相关描述</view>
  44. <view class="describe-box">
  45. <uni-easyinput :inputBorder="false" class="describe-content" type="textarea" maxlength="120" autoHeight
  46. v-model="formData.content" placeholder="客官~请描述您遇到的问题,建议上传照片"></uni-easyinput>
  47. <view class="upload-img">
  48. <s-uploader v-model:url="formData.images" fileMediatype="image" limit="9" mode="grid"
  49. :imageStyles="{ width: '168rpx', height: '168rpx' }" />
  50. </view>
  51. </view>
  52. </view>
  53. </uni-forms>
  54. <!-- 底部按钮 -->
  55. <su-fixed bottom placeholder>
  56. <view class="foot-wrap">
  57. <view class="foot_box ss-flex ss-col-center ss-row-between ss-p-x-30">
  58. <button class="ss-reset-button contcat-btn" @tap="sheep.$router.go('/pages/chat/index')">联系客服</button>
  59. <button class="ss-reset-button ui-BG-Main-Gradient sub-btn" @tap="submit">提交</button>
  60. </view>
  61. </view>
  62. </su-fixed>
  63. <!-- 申请原因弹窗 -->
  64. <su-popup :show="state.showModal" round="10" :showClose="true" @close="state.showModal = false">
  65. <view class="modal-box page_box">
  66. <view class="modal-head item-title head_box ss-flex ss-row-center ss-col-center">申请原因</view>
  67. <view class="modal-content content_box">
  68. <radio-group @change="onChange">
  69. <label class="radio ss-flex ss-col-center" v-for="item in state.refundReasonList" :key="item.value">
  70. <view class="ss-flex-1 ss-p-20">{{ item.title }}</view>
  71. <radio :value="item.value" color="var(--ui-BG-Main)" :checked="item.value === state.currentValue" />
  72. </label>
  73. </radio-group>
  74. </view>
  75. <view class="modal-foot foot_box ss-flex ss-row-center ss-col-center">
  76. <button class="ss-reset-button close-btn ui-BG-Main-Gradient" @tap="onReason">确定</button>
  77. </view>
  78. </view>
  79. </su-popup>
  80. </s-layout>
  81. </template>
  82. <script setup>
  83. import sheep from '@/sheep';
  84. import { onLoad } from '@dcloudio/uni-app';
  85. import { reactive, ref, unref } from 'vue';
  86. const form = ref(null);
  87. const state = reactive({
  88. showModal: false,
  89. currentValue: 0,
  90. goodsItem: {},
  91. reasonText: '',
  92. //售后类型
  93. refundTypeList: [
  94. {
  95. text: '仅退款',
  96. value: 'refund',
  97. },
  98. {
  99. text: '退/换货',
  100. value: 'return',
  101. },
  102. {
  103. text: '其他',
  104. value: 'other',
  105. },
  106. ],
  107. refundReasonList: [
  108. {
  109. value: '1',
  110. title: '卖家发错货了',
  111. },
  112. {
  113. value: '2',
  114. title: '退运费',
  115. },
  116. {
  117. value: '3',
  118. title: '大小/重量与商品描述不符',
  119. },
  120. {
  121. value: '4',
  122. title: '生产日期/保质期与商品描述不符',
  123. },
  124. {
  125. value: '5',
  126. title: '质量问题',
  127. },
  128. {
  129. value: '6',
  130. title: '我不想要了',
  131. },
  132. ],
  133. });
  134. const formData = reactive({
  135. type: '',
  136. reason: '',
  137. mobile: '',
  138. content: '',
  139. images: [],
  140. });
  141. const rules = reactive({});
  142. // 提交表单
  143. async function submit() {
  144. // #ifdef MP
  145. sheep.$platform.useProvider('wechat').subscribeMessage('order_aftersale_change');
  146. // #endif
  147. let data = {
  148. ...formData,
  149. order_id: state.goodsItem.order_id,
  150. order_item_id: state.goodsItem.id,
  151. };
  152. const res = await sheep.$api.order.aftersale.apply(data);
  153. if (res.error === 0) {
  154. uni.showToast({
  155. title: res.msg,
  156. });
  157. sheep.$router.go('/pages/order/aftersale/list');
  158. }
  159. }
  160. //选择售后类型
  161. function onRefundChange(e) {
  162. formData.type = e.detail.value;
  163. }
  164. //选择申请原因
  165. function onChange(e) {
  166. state.currentValue = e.detail.value;
  167. state.refundReasonList.forEach((item) => {
  168. if (item.value === e.detail.value) {
  169. state.reasonText = item.title;
  170. }
  171. });
  172. }
  173. //确定
  174. function onReason() {
  175. formData.reason = state.reasonText;
  176. state.showModal = false;
  177. }
  178. function onTitle(e, title) {
  179. state.currentValue = e;
  180. state.reasonText = title;
  181. }
  182. onLoad((options) => {
  183. state.goodsItem = JSON.parse(options.item);
  184. });
  185. </script>
  186. <style lang="scss" scoped>
  187. .item-title {
  188. font-size: 30rpx;
  189. font-weight: bold;
  190. color: rgba(51, 51, 51, 1);
  191. // margin-bottom: 20rpx;
  192. }
  193. // 售后项目
  194. .refund-item {
  195. background-color: #fff;
  196. border-bottom: 1rpx solid #f5f5f5;
  197. padding: 30rpx;
  198. &:last-child {
  199. border: none;
  200. }
  201. // 留言
  202. .describe-box {
  203. width: 690rpx;
  204. background: rgba(249, 250, 251, 1);
  205. padding: 30rpx;
  206. box-sizing: border-box;
  207. border-radius: 20rpx;
  208. .describe-content {
  209. height: 200rpx;
  210. font-size: 24rpx;
  211. font-weight: 400;
  212. color: #333;
  213. }
  214. }
  215. // 联系方式
  216. .input-box {
  217. height: 84rpx;
  218. background: rgba(249, 250, 251, 1);
  219. border-radius: 20rpx;
  220. }
  221. }
  222. .goods-box {
  223. background: #fff;
  224. padding: 20rpx;
  225. margin-bottom: 20rpx;
  226. }
  227. .foot-wrap {
  228. height: 100rpx;
  229. width: 100%;
  230. }
  231. .foot_box {
  232. height: 100rpx;
  233. background-color: #fff;
  234. .sub-btn {
  235. width: 336rpx;
  236. line-height: 74rpx;
  237. border-radius: 38rpx;
  238. color: rgba(#fff, 0.9);
  239. font-size: 28rpx;
  240. }
  241. .contcat-btn {
  242. width: 336rpx;
  243. line-height: 74rpx;
  244. background: rgba(238, 238, 238, 1);
  245. border-radius: 38rpx;
  246. font-size: 28rpx;
  247. font-weight: 400;
  248. color: rgba(51, 51, 51, 1);
  249. }
  250. }
  251. .modal-box {
  252. width: 750rpx;
  253. // height: 680rpx;
  254. border-radius: 30rpx 30rpx 0 0;
  255. background: #fff;
  256. .modal-head {
  257. height: 100rpx;
  258. font-size: 30rpx;
  259. }
  260. .modal-content {
  261. font-size: 28rpx;
  262. }
  263. .modal-foot {
  264. .close-btn {
  265. width: 710rpx;
  266. line-height: 80rpx;
  267. border-radius: 40rpx;
  268. color: rgba(#fff, 0.9);
  269. }
  270. }
  271. }
  272. .success-box {
  273. width: 600rpx;
  274. padding: 90rpx 0 64rpx 0;
  275. .cicon-check-round {
  276. font-size: 96rpx;
  277. color: #04b750;
  278. }
  279. .success-title {
  280. font-weight: 500;
  281. color: #333333;
  282. font-size: 32rpx;
  283. }
  284. .success-btn {
  285. width: 492rpx;
  286. height: 70rpx;
  287. background: linear-gradient(90deg, var(--ui-BG-Main-gradient), var(--ui-BG-Main));
  288. border-radius: 35rpx;
  289. }
  290. }
  291. </style>