apply.vue 8.8 KB

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