apply.vue 8.9 KB

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