apply.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <view class="refund-apply pb100">
  3. <form @submit="formSubmit" @reset="formReset">
  4. <view class="one-product d-s-c p30 bg-white ">
  5. <view class="cover">
  6. <image :src="product.image.file_path" mode="aspectFit"></image>
  7. </view>
  8. <view class="flex-1">
  9. <view class="pro-info">{{product.product_name}}</view>
  10. <view class="pt10 p-0-30 f24 gray9">
  11. <text class="">
  12. 单价:¥{{product.line_price}}
  13. </text>
  14. <text class="ml20">
  15. 数量:{{product.total_num}}
  16. </text>
  17. </view>
  18. </view>
  19. </view>
  20. <!-- 服务类型 -->
  21. <view class="group bg-white">
  22. <view class="group-hd border-b-e">
  23. <view class="left">
  24. <text class="min-name">服务类型</text>
  25. </view>
  26. </view>
  27. <view class="d-s-c p-20-0">
  28. <button v-if="product.orderM.delivery_type.value!=30" type="default"
  29. :class="type==10?'btn-red-border':''" @click="tabType(10)">退货/退款</button>
  30. <button v-if="product.orderM.delivery_type.value!=30" type="default"
  31. :class="type==20?'ml20 btn-red-border':'ml20'" @click="tabType(20)">换货</button>
  32. <button v-if="product.orderM.delivery_type.value!=30" type="default"
  33. :class="type==30?'ml20 btn-red-border':'ml20'" @click="tabType(30)">仅退款</button>
  34. </view>
  35. </view>
  36. <!--申请原因-->
  37. <view class="group bg-white">
  38. <view class="group-hd">
  39. <view class="left">
  40. <text class="min-name">申请原因</text>
  41. </view>
  42. </view>
  43. <view class="d-s-c">
  44. <textarea class="p10 box-s-b border flex-1 f28 lh150" value="" name="content"
  45. placeholder="请详细填写申请原因,注意保持商品的完好,建议您先与卖家沟通" />
  46. </view>
  47. </view>
  48. <!--退款金额-->
  49. <view class="group bg-white" v-if="type==10 || type==30">
  50. <view class="group-hd">
  51. <view class="left">
  52. <text class="min-name">退款金额:</text>
  53. <text class="red f30">¥{{product.total_price}}</text>
  54. </view>
  55. </view>
  56. </view>
  57. <!--上传图片-->
  58. <view class="group bg-white">
  59. <view class="group-hd">
  60. <view class="left">
  61. <text class="min-name">上传凭证</text>
  62. <text class="gray9">(最多6张)</text>
  63. </view>
  64. </view>
  65. <view class="upload-list d-s-c">
  66. <view class="item" v-for="(imgs,img_num) in images" :key="img_num" @click="deleteFunc(imgs)">
  67. <image :src="imgs.file_path" mode="aspectFit"></image>
  68. </view>
  69. <view class="item d-c-c d-stretch" v-if="images.length<6">
  70. <view class="upload-btn d-c-c d-c flex-1" @click="openUpload()">
  71. <text class="icon iconfont icon-xiangji f34"></text>
  72. <text class="gray9">上传图片</text>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="foot-btns">
  78. <button form-type="submit" class="btn-red">确认提交</button>
  79. <!--<button type="primary" >确认提交</button>-->
  80. </view>
  81. </form>
  82. <!--上传图片-->
  83. <Upload v-if="isUpload" @getImgs="getImgsFunc"></Upload>
  84. </view>
  85. </template>
  86. <script>
  87. import Upload from '@/components/upload/upload.vue';
  88. export default {
  89. components: {
  90. Upload
  91. },
  92. data() {
  93. return {
  94. /*是否加载完成*/
  95. loadding: true,
  96. indicatorDots: true,
  97. autoplay: true,
  98. interval: 2000,
  99. duration: 500,
  100. type: 10,
  101. /*是否打开上传图片*/
  102. isUpload: false,
  103. /*订单商品id*/
  104. order_product_id: 0,
  105. /*订单商品*/
  106. product: {},
  107. images: [],
  108. /*小程序订阅消息*/
  109. temlIds: [],
  110. }
  111. },
  112. onLoad(e) {
  113. this.order_product_id = e.order_product_id;
  114. },
  115. mounted() {
  116. /*获取订单详情*/
  117. this.getData();
  118. },
  119. methods: {
  120. /*获取数据*/
  121. getData() {
  122. let self = this;
  123. uni.showLoading({
  124. title: '加载中'
  125. });
  126. let order_product_id = self.order_product_id;
  127. self._get('user.refund/apply', {
  128. order_product_id: order_product_id,
  129. platform: self.getPlatform()
  130. }, function(res) {
  131. self.product = res.data.detail;
  132. self.temlIds = res.data.template_arr;
  133. if (self.product.orderM.delivery_type.value == 30) {
  134. self.type = 30;
  135. }
  136. uni.hideLoading();
  137. });
  138. },
  139. /*切换服务类型*/
  140. tabType(e) {
  141. this.type = e;
  142. },
  143. /*提交表单*/
  144. formSubmit: function(e) {
  145. let self = this;
  146. var formdata = e.detail.value;
  147. formdata.type = self.type;
  148. formdata.order_product_id = self.order_product_id;
  149. formdata.images = JSON.stringify(self.images);
  150. let callback = function() {
  151. uni.showLoading({
  152. title: '正在提交',
  153. mask: true
  154. });
  155. self._post('user.refund/apply', formdata, function(res) {
  156. uni.hideLoading();
  157. uni.showToast({
  158. title: res.msg,
  159. duration: 3000,
  160. complete: function() {
  161. self.gotoPage('/pages/order/refund/index/index');
  162. }
  163. });
  164. });
  165. }
  166. self.subMessage(self.temlIds, callback);
  167. },
  168. /*打开上传图片*/
  169. openUpload() {
  170. this.isUpload = true;
  171. },
  172. /*获取上传的图片*/
  173. getImgsFunc(e) {
  174. let self = this;
  175. self.isUpload = false;
  176. if (e && typeof(e) != 'undefined') {
  177. let this_length = self.images.length,
  178. upload_length = e.length;
  179. if (this_length + upload_length < 7) {
  180. self.images = self.images.concat(e);
  181. } else {
  182. let leng = 6 - this_length;
  183. for (let i = 0; i < leng; i++) {
  184. self.images.push(e[i]);
  185. }
  186. }
  187. }
  188. },
  189. /*删除图片*/
  190. deleteFunc(e) {
  191. this.images.splice(e, 1);
  192. }
  193. }
  194. }
  195. </script>
  196. <style>
  197. </style>