orderRefund.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view class="content">
  3. <view class="order-item">
  4. <view class="titleGoods">
  5. 退款商品
  6. </view>
  7. <scroll-view v-if="listStyle == 1" class="goods-box" scroll-x>
  8. <view v-for="(goodsItem, goodsIndex) in item.cartInfo" :key="goodsIndex" class="goods-item">
  9. <image class="goods-img" :src="goodsItem.productInfo.image" mode="aspectFill"></image>
  10. </view>
  11. </scroll-view>
  12. <view v-if="listStyle == 2" class="goods-box-single" v-for="(goodsItem, goodsIndex) in item.cartInfo"
  13. :key="goodsIndex">
  14. <image class="goods-img" :src="goodsItem.productInfo.image" mode="aspectFill"></image>
  15. <view class="right">
  16. <text class="title clamp">{{ goodsItem.productInfo.store_name }}</text>
  17. <view v-if="goodsItem.productInfo.attrInfo">
  18. <view class="attr-box">{{ goodsItem.productInfo.attrInfo.suk}} x {{ goodsItem.cart_num }}</view>
  19. <view class="price">{{ goodsItem.productInfo.attrInfo.price }}</view>
  20. </view>
  21. <view v-else>
  22. <view class="attr-box">{{ goodsItem.attrInfo ? goodsItem.attrInfo.suk : '' }} x
  23. {{ goodsItem.cart_num }}</view>
  24. <view class="price">{{ goodsItem.productInfo.price }}</view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="orderDetial">
  30. <view class="row b-b flex">
  31. <text class="tit">订单总价</text>
  32. <view class="input">¥{{ item.total_price }}</view>
  33. </view>
  34. <view class="row b-b flex">
  35. <text class="tit">邮费</text>
  36. <view class="input">{{ item.pay_postage > 0 ? '¥' +item.pay_postage : '免邮费' }}</view>
  37. </view>
  38. <view class="row flex">
  39. <text class="tit ">退款金额</text>
  40. <view class="input payColor">¥{{ item.pay_price }}</view>
  41. </view>
  42. </view>
  43. <view class="orderDetial">
  44. <view class="row b-b flex">
  45. <text class="tit">退款理由</text>
  46. <picker mode="selector" :range="value" @change="bindChange">
  47. <view class="refund" v-if="refund">{{ refund || '请选择退款理由' }}</view>
  48. <view class="noRefund" v-else>请选择退款理由</view>
  49. </picker>
  50. </view>
  51. <view class="row">
  52. <text class="tit">备注说明</text>
  53. <input class="input" type="text" v-model="reason" placeholder="请填写备注" placeholder-class="placeholder" />
  54. </view>
  55. </view>
  56. <view class="base-buttom" @click="confirm">提交</view>
  57. </view>
  58. </template>
  59. <script>
  60. import {
  61. refund,
  62. refundReason,
  63. orderDetail
  64. } from '@/api/order.js';
  65. export default {
  66. data() {
  67. return {
  68. refund: '', //退款理由
  69. reason: '', //备注
  70. value: ['1', '2', '3', '4', '5', '6', '7', '8', 9, 10, 11, 12, 13],
  71. orderId: '',
  72. item: {},
  73. listStyle: 2
  74. };
  75. },
  76. onLoad(option) {
  77. this.orderId = option.id;
  78. this.refundReason();
  79. this.loadOrder();
  80. },
  81. methods: {
  82. // 切换选中事件
  83. bindChange(e) {
  84. this.refund = this.value[e.detail.value];
  85. },
  86. // 加载退款理由
  87. refundReason() {
  88. refundReason({}).then(e => {
  89. this.value = e.data;
  90. });
  91. },
  92. loadOrder() {
  93. orderDetail({}, this.orderId).then(e => {
  94. this.item = e.data;
  95. });
  96. },
  97. //提交
  98. confirm() {
  99. let obj = this;
  100. if (!obj.refund) {
  101. uni.showModal({
  102. title: '错误',
  103. content: '请填写退货理由',
  104. showCancel: false
  105. });
  106. return false;
  107. }
  108. uni.showLoading({
  109. title: '提交中...',
  110. mask: true
  111. });
  112. refund({
  113. text: obj.refund,
  114. uni: obj.orderId,
  115. refund_reason_wap_explain: obj.reason
  116. }).then(function(e) {
  117. uni.hideLoading()
  118. uni.showModal({
  119. title: '提示',
  120. content: '已提交成功是否返回?',
  121. success: res => {
  122. if(res.confirm){
  123. uni.switchTab({
  124. url:'/pages/user/user'
  125. })
  126. }
  127. },
  128. });
  129. }).catch(() => {
  130. uni.hideLoading()
  131. });
  132. }
  133. }
  134. };
  135. </script>
  136. <style lang="scss">
  137. page {
  138. background: $page-color-base;
  139. padding-top: 30rpx;
  140. }
  141. .orderDetial {
  142. margin: 0 $page-row-spacing;
  143. margin-bottom: 30rpx;
  144. border-radius: 20rpx;
  145. overflow: hidden;
  146. .row {
  147. .input {
  148. text-align: right;
  149. color: $font-color-light;
  150. }
  151. }
  152. }
  153. .row {
  154. display: flex;
  155. align-items: center;
  156. position: relative;
  157. padding: 0 30rpx;
  158. height: 110rpx;
  159. background: #fff;
  160. .refund {
  161. font-size: 30rpx;
  162. color: $font-color-light;
  163. }
  164. .noRefund {
  165. font-size: 30rpx;
  166. color: $font-color-light;
  167. padding-left: 20rpx;
  168. }
  169. .tit {
  170. flex-shrink: 0;
  171. width: 120rpx;
  172. font-size: 30rpx;
  173. color: $font-color-dark;
  174. }
  175. .input {
  176. flex: 1;
  177. font-size: 30rpx;
  178. color: $font-color-dark;
  179. padding-left: 20rpx;
  180. &.payColor {
  181. color: $color-red;
  182. }
  183. }
  184. .iconlocation {
  185. font-size: 36rpx;
  186. color: $font-color-light;
  187. }
  188. }
  189. .add-btn {
  190. display: flex;
  191. align-items: center;
  192. justify-content: center;
  193. width: 690rpx;
  194. height: 80rpx;
  195. margin: 60rpx auto;
  196. font-size: $font-lg;
  197. color: #fff;
  198. background-color: $base-color;
  199. border-radius: 10rpx;
  200. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  201. }
  202. /* 多条商品 */
  203. .order-item {
  204. display: flex;
  205. flex-direction: column;
  206. padding-left: 30rpx;
  207. background: #fff;
  208. margin-top: 16rpx;
  209. margin: 0 $page-row-spacing;
  210. border-radius: 20rpx;
  211. padding-top: 30rpx;
  212. margin-bottom: 30rpx;
  213. .titleGoods {
  214. font-size: $font-lg;
  215. }
  216. .goods-box {
  217. height: 160rpx;
  218. padding: 20rpx 0;
  219. white-space: nowrap;
  220. .goods-item {
  221. width: 120rpx;
  222. height: 120rpx;
  223. display: inline-block;
  224. margin-right: 24rpx;
  225. }
  226. .goods-img {
  227. display: block;
  228. width: 100%;
  229. height: 100%;
  230. }
  231. }
  232. /* 单条商品 */
  233. .goods-box-single {
  234. display: flex;
  235. padding: 20rpx 0;
  236. .goods-img {
  237. display: block;
  238. width: 120rpx;
  239. height: 120rpx;
  240. }
  241. .right {
  242. flex: 1;
  243. display: flex;
  244. flex-direction: column;
  245. padding: 0 30rpx 0 24rpx;
  246. overflow: hidden;
  247. .title {
  248. font-size: $font-base + 2rpx;
  249. color: $font-color-dark;
  250. line-height: 1;
  251. }
  252. .attr-box {
  253. font-size: $font-sm + 2rpx;
  254. color: $font-color-light;
  255. padding: 10rpx 12rpx;
  256. }
  257. .price {
  258. font-size: $font-base + 2rpx;
  259. color: $font-color-dark;
  260. &:before {
  261. content: '¥';
  262. font-size: $font-sm;
  263. margin: 0 2rpx 0 8rpx;
  264. }
  265. }
  266. }
  267. }
  268. }
  269. </style>