order-refund.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <view>
  3. <!-- 商品区 -->
  4. <view class="padding margin-lr margin-tb-sm bg-main border-radius">
  5. <view class="goods-area" v-for="(item, index) in order_detail" :key="index">
  6. <view class="dflex">
  7. <view class="img">
  8. <image :src="item.goodsMasterImg"></image>
  9. </view>
  10. <view class="margin-left-sm">
  11. <text class="clamp-2">{{ item.goodsName }}</text>
  12. <view class="ft-dark fs-xs padding-top-xs">
  13. <text class="margin-right">× {{ item.goodsCount }}</text>
  14. {{ item.goods_sku_name || '&nbsp;&nbsp;' }}
  15. </view>
  16. <view class="margin-top-sm">
  17. <text class="price">{{ item.goodsTotalAmt }}</text>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <!-- 退款区 -->
  24. <view class="padding-lr-xs padding-bottom-sm">
  25. <use-list-title title="货物状态" type="round" color="#333" :tip="goods_state" iconfont=" "
  26. @goto="openActionSheet(1)"></use-list-title>
  27. </view>
  28. <view class="padding-lr-xs">
  29. <use-list-title title="退款原因" type="round" color="#333" :tip="reason" iconfont=" "
  30. @goto="openActionSheet(2)"></use-list-title>
  31. </view>
  32. <view class="refund-area padding margin-lr margin-tb-sm bg-main border-radius">
  33. <view class="dflex-b">
  34. <text class="item margin-right-sm">退款金额:</text>
  35. <text class="price">{{refund_money}}</text>
  36. </view>
  37. </view>
  38. <!-- 上传凭证 -->
  39. <view class="padding margin-lr margin-tb-sm bg-main border-radius">
  40. <!-- 退款说明 -->
  41. <textarea v-model="desc" class="ft-black w-full margin-0 padding-0 fs-sm"
  42. placeholder="请填写退款说明(选填)"></textarea>
  43. <!-- 上传图片 -->
  44. <!-- <use-upload class="pos-r" @upload="refundImgs"></use-upload> -->
  45. </view>
  46. <!-- 提交操作 -->
  47. <view class="padding w-full margin-top">
  48. <view class="dflex-b">
  49. <view class="tac padding-tb-sm flex1 bg-base-tuikuan" @click="submit">提交申请</view>
  50. </view>
  51. </view>
  52. <!-- 操作菜单 -->
  53. <use-action-sheet v-model="actionSheetShow" :list="actionSheetList" :tips="actionSheetTips"
  54. @click="actionSheetClick" @close="actionSheetClose"></use-action-sheet>
  55. </view>
  56. </template>
  57. <script>
  58. import {
  59. orderinfo,
  60. refund
  61. } from '../../../utils/api_order.js'
  62. import useListTitle from '../../../components/use-list-title/use-list-title.vue'
  63. import useUpload from '../../../components/use-upload/use-upload.vue'
  64. import useActionSheet from '../../../components/use-action-sheet/use-action-sheet.vue'
  65. export default {
  66. components:{
  67. useListTitle,
  68. useUpload,
  69. useActionSheet
  70. },
  71. data() {
  72. return {
  73. issubmit: false,
  74. goods_state: '请选择',
  75. reason: '请选择',
  76. desc: '', // 退款说明
  77. // 订单ID
  78. order_id: '',
  79. // 退款金额
  80. refund_money: 0,
  81. // 商品数据
  82. order_detail: [],
  83. // 订单数据
  84. order_data: {},
  85. postData: {
  86. order_id: '',
  87. goods_state: '',
  88. reason: '',
  89. desc: '',
  90. imgs: [],
  91. refund_money: 0,
  92. },
  93. actionSheetShow: false,
  94. actionSheetList: [],
  95. actionSheetTips: {
  96. // text: "退出登录 | 切换账号",
  97. // color: "#9a9a9a",
  98. // size: 24
  99. },
  100. };
  101. },
  102. onUnload() {
  103. uni.$emit('__event_order', 'refresh');
  104. },
  105. onLoad(option) {
  106. this.order_id = option.order_id;
  107. if (!this.order_id) {
  108. this.$api.msg('订单编号不存在');
  109. }
  110. this.loadData();
  111. },
  112. methods: {
  113. loadData() {
  114. let _this = this;
  115. // 订单详情
  116. var data=_this.order_id
  117. orderinfo(data).then((res) => {
  118. if(res.success){
  119. _this.order_data = res.data;
  120. _this.order_detail = res.data.orderDetails;
  121. // 退款金额为实付款金额
  122. _this.refund_money = _this.order_data.orderActualPrice;
  123. return
  124. }
  125. _this.$api.msg(res.msg);
  126. })
  127. },
  128. refundImgs(options) {
  129. let imgs = [];
  130. options.forEach((_) => {
  131. imgs.push(_.url);
  132. });
  133. if (imgs.length > 0) this.postData.imgs = imgs;
  134. console.log('refundImgs', this.postData.imgs);
  135. },
  136. submit() {
  137. console.log('状态',this.postData.goods_state)
  138. if (!this.postData.goods_state) {
  139. this.$api.msg('请选择货物状态');
  140. return;
  141. }
  142. if (!this.postData.reason) {
  143. this.$api.msg('请选择退款原因');
  144. return;
  145. }
  146. if (this.issubmit) return;
  147. this.issubmit = true;
  148. this.postData.order_id = this.order_id;
  149. this.postData.refund_money = this.refund_money;
  150. this.postData.desc = this.desc;
  151. let _this = this;
  152. uni.showModal({
  153. title: '提示',
  154. content: '申请退款',
  155. success: function(res) {
  156. if (res.confirm) {
  157. //只有代发货状态才能申请退款
  158. var data=_this.postData.order_id
  159. var data2={
  160. "goodsState": _this.postData.goods_state,
  161. "refundReason": _this.postData.reason,
  162. "refundAmt": _this.postData.refund_money,
  163. "remark": _this.postData.desc
  164. }
  165. refund(data,data2).then((res) => {
  166. if(res.success){
  167. _this.$api.msg('提交成功');
  168. _this.issubmit = false;
  169. uni.navigateBack({});
  170. return
  171. }
  172. _this.$api.msg(res.msg);
  173. _this.issubmit = false;
  174. })
  175. } else if (res.cancel) {
  176. console.log('用户点击取消');
  177. }
  178. }
  179. });
  180. },
  181. // 打开操作菜单
  182. openActionSheet(idx) {
  183. console.log('ppp',idx)
  184. let type = '';
  185. let actionSheetList = [];
  186. switch (idx) {
  187. case 1:
  188. type = "货物状态";
  189. this.actionSheetTips.text = "请选择" + type;
  190. actionSheetList = [
  191. // {
  192. // text: "已收到货",
  193. // color: "#333",
  194. // type: type
  195. // },
  196. {
  197. text: "未收到货",
  198. color: "#333",
  199. type: type
  200. }, ];
  201. break;
  202. case 2:
  203. type = "退款原因";
  204. this.actionSheetTips.text = "请选择" + type;
  205. actionSheetList = [{
  206. text: "未发货不要了",
  207. color: "#333",
  208. type: type
  209. }, {
  210. text: "拍错了,重新下单",
  211. color: "#333",
  212. type: type
  213. }, {
  214. text: "换一家,质量不好",
  215. color: "#333",
  216. type: type
  217. }, {
  218. text: "其他",
  219. color: "#333",
  220. type: type
  221. }, ];
  222. break;
  223. }
  224. this.actionSheetShow = true;
  225. this.actionSheetList = actionSheetList;
  226. },
  227. // 关闭操作菜单
  228. actionSheetClose() {
  229. this.actionSheetShow = false;
  230. console.log(this.actionSheetShow);
  231. },
  232. // 点击操作菜单
  233. actionSheetClick(index) {
  234. let item = this.actionSheetList[index];
  235. switch (item.type) {
  236. case '货物状态':
  237. this.goods_state = item.text;
  238. this.postData.goods_state = item.text;
  239. break;
  240. case '退款原因':
  241. this.reason = item.text;
  242. this.postData.reason = item.text;
  243. break;
  244. }
  245. },
  246. }
  247. };
  248. </script>
  249. <style lang="scss">
  250. page {
  251. background: $page-color-base;
  252. }
  253. @import url('/packageShang/components/iconfont/iconfont.css');
  254. @import url('/packageShang/common/common.scss');
  255. /* 商品区 */
  256. .goods-area {
  257. &:last-child {
  258. margin-bottom: 0;
  259. }
  260. image {
  261. width: 180rpx;
  262. height: 180rpx;
  263. }
  264. }
  265. /* 退款区 */
  266. .refund-area {
  267. line-height: 60rpx;
  268. .desc {
  269. line-height: 60rpx;
  270. }
  271. }
  272. </style>