apply.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <!-- 订单详情 -->
  2. <template>
  3. <s-layout :title="$t('order.aftersale.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">{{$t('order.aftersale.type')}}</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">{{$t('order.aftersale.reason')}}</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>{{$t('order.aftersale.chooseReason')}}</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">{{$t('order.aftersale.contact')}}</view>
  36. <view class="input-box u-flex">
  37. <uni-easyinput :inputBorder="false" type="number" v-model="formData.mobile" :placeholder="$t('order.aftersale.enterContact')"
  38. paddingLeft="10" />
  39. </view>
  40. </view>
  41. <!-- 留言 -->
  42. <view class="refund-item">
  43. <view class="item-title ss-m-b-20">{{$t('order.aftersale.desc')}}</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="$t('order.aftersale.descPlaceholrder')"></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')">{{$t('order.aftersale.service')}}</button>
  59. <button class="ss-reset-button ui-BG-Main-Gradient sub-btn" @tap="submit">{{$t('order.aftersale.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">{{$t('order.aftersale.reason')}}</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">{{$t('order.aftersale.confirm')}}</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: $t('order.aftersale.refundOnly'),
  96. value: 'refund',
  97. },
  98. {
  99. text: $t('order.aftersale.returnOrExchange'),
  100. value: 'return',
  101. },
  102. {
  103. text: $t('order.aftersale.other'),
  104. value: 'other',
  105. },
  106. ],
  107. refundReasonList: [
  108. {
  109. value: '1',
  110. title: $t('order.aftersale.sendWrong'),
  111. },
  112. {
  113. value: '2',
  114. title: $t('order.aftersale.returnShipping'),
  115. },
  116. {
  117. value: '3',
  118. title: $t('order.aftersale.descNotMatch1'),
  119. },
  120. {
  121. value: '4',
  122. title: $t('order.aftersale.descNotMatch2'),
  123. },
  124. {
  125. value: '5',
  126. title: $t('order.aftersale.qualityIssues'),
  127. },
  128. {
  129. value: '6',
  130. title: $t('order.aftersale.notWant'),
  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.code === 1) {
  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. onLoad((options) => {
  179. state.goodsItem = JSON.parse(options.item);
  180. });
  181. </script>
  182. <style lang="scss" scoped>
  183. .item-title {
  184. font-size: 30rpx;
  185. font-weight: bold;
  186. color: rgba(51, 51, 51, 1);
  187. // margin-bottom: 20rpx;
  188. }
  189. // 售后项目
  190. .refund-item {
  191. background-color: #fff;
  192. border-bottom: 1rpx solid #f5f5f5;
  193. padding: 30rpx;
  194. &:last-child {
  195. border: none;
  196. }
  197. // 留言
  198. .describe-box {
  199. width: 690rpx;
  200. background: rgba(249, 250, 251, 1);
  201. padding: 30rpx;
  202. box-sizing: border-box;
  203. border-radius: 20rpx;
  204. .describe-content {
  205. height: 200rpx;
  206. font-size: 24rpx;
  207. font-weight: 400;
  208. color: #333;
  209. }
  210. }
  211. // 联系方式
  212. .input-box {
  213. height: 84rpx;
  214. background: rgba(249, 250, 251, 1);
  215. border-radius: 20rpx;
  216. }
  217. }
  218. .goods-box {
  219. background: #fff;
  220. padding: 20rpx;
  221. margin-bottom: 20rpx;
  222. }
  223. .foot-wrap {
  224. height: 100rpx;
  225. width: 100%;
  226. }
  227. .foot_box {
  228. height: 100rpx;
  229. background-color: #fff;
  230. .sub-btn {
  231. width: 336rpx;
  232. line-height: 74rpx;
  233. border-radius: 38rpx;
  234. color: rgba(#fff, 0.9);
  235. font-size: 28rpx;
  236. }
  237. .contcat-btn {
  238. width: 336rpx;
  239. line-height: 74rpx;
  240. background: rgba(238, 238, 238, 1);
  241. border-radius: 38rpx;
  242. font-size: 28rpx;
  243. font-weight: 400;
  244. color: rgba(51, 51, 51, 1);
  245. }
  246. }
  247. .modal-box {
  248. width: 750rpx;
  249. // height: 680rpx;
  250. border-radius: 30rpx 30rpx 0 0;
  251. background: #fff;
  252. .modal-head {
  253. height: 100rpx;
  254. font-size: 30rpx;
  255. }
  256. .modal-content {
  257. font-size: 28rpx;
  258. }
  259. .modal-foot {
  260. .close-btn {
  261. width: 710rpx;
  262. line-height: 80rpx;
  263. border-radius: 40rpx;
  264. color: rgba(#fff, 0.9);
  265. }
  266. }
  267. }
  268. .success-box {
  269. width: 600rpx;
  270. padding: 90rpx 0 64rpx 0;
  271. .cicon-check-round {
  272. font-size: 96rpx;
  273. color: #04b750;
  274. }
  275. .success-title {
  276. font-weight: 500;
  277. color: #333333;
  278. font-size: 32rpx;
  279. }
  280. .success-btn {
  281. width: 492rpx;
  282. height: 70rpx;
  283. background: linear-gradient(90deg, var(--ui-BG-Main-gradient), var(--ui-BG-Main));
  284. border-radius: 35rpx;
  285. }
  286. }
  287. </style>