orderRefund.vue 4.8 KB

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