noService.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="one">
  5. <view class="list" v-for="(item,index) in goodsList" :key="index">
  6. <view class="list_1">
  7. <text>退款商品</text>
  8. </view>
  9. <view class="list_2">
  10. <view class="l">
  11. <image class="image"
  12. :src="item.goods.file&&item.goods.file.length>0?item.goods.file[0].url:''" mode="">
  13. </image>
  14. </view>
  15. <view class="c">
  16. <view class="name">
  17. {{item.name}}
  18. </view>
  19. </view>
  20. <view class="r">
  21. <view v-if="type=='0'" class="price">
  22. ¥{{item.sell_money}}
  23. </view>
  24. <view v-else class="price">
  25. ¥{{item.group_config.money}}
  26. </view>
  27. <view class="num">
  28. ×{{item.buy_num}}
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="two">
  35. <uni-forms ref="form" :rules="rules" :model="form" label-width="auto">
  36. <uni-forms-item label="申请售后理由" name="desc">
  37. <uni-easyinput type="textarea" v-model="form.desc" placeholder="请输入申请售后描述" />
  38. </uni-forms-item>
  39. <view class="btn">
  40. <button type="primary" size="mini" @click="onSubmit('form')">提交保存</button>
  41. </view>
  42. </uni-forms>
  43. </view>
  44. </view>
  45. </mobile-frame>
  46. </template>
  47. <script>
  48. export default {
  49. data() {
  50. return {
  51. id: '',
  52. user: {},
  53. form: {},
  54. type: '',
  55. // 退货商品
  56. goodsList: [],
  57. icon: [],
  58. rules: {
  59. desc: {
  60. rules: [{
  61. required: true,
  62. errorMessage: '请输入申请售后描述',
  63. }]
  64. },
  65. },
  66. };
  67. },
  68. onLoad: async function(e) {
  69. const that = this;
  70. that.$set(that, `id`, e && e.id || '');
  71. // 监听用户登录
  72. that.watchLogin();
  73. },
  74. methods: {
  75. // 提交保存
  76. async onSubmit(ref) {
  77. const that = this;
  78. that.$refs[ref].validate().then(async params => {
  79. params.order_detail = that.id
  80. const arr = await that.$api(`/afterSale/orderCancel`, 'POST', params);
  81. if (arr.errcode == '0') {
  82. uni.showToast({
  83. title: `申请售后成功`,
  84. icon: 'success',
  85. });
  86. uni.navigateBack({
  87. detail: 1
  88. })
  89. } else {
  90. uni.showToast({
  91. title: arr.errmsg,
  92. icon: 'none',
  93. })
  94. }
  95. })
  96. },
  97. // 监听用户是否登录
  98. watchLogin() {
  99. const that = this;
  100. uni.getStorage({
  101. key: 'token',
  102. success: async function(res) {
  103. let user = that.$jwt(res.data);
  104. if (user) {
  105. that.$set(that, `user`, user);
  106. if (that.id) {
  107. let arr = await that.$api(`/orderDetail/${that.id}`, 'GET')
  108. if (arr.errcode == '0') {
  109. that.$set(that, `goodsList`, arr.data.goods)
  110. that.$set(that, `type`, arr.data.type)
  111. }
  112. }
  113. }
  114. },
  115. fail: function(err) {
  116. uni.reLaunch({
  117. url: '/pages/login/index'
  118. })
  119. }
  120. })
  121. },
  122. }
  123. }
  124. </script>
  125. <style lang="scss">
  126. .main {
  127. .one {
  128. .list {
  129. margin: 2vw;
  130. padding: 2vw;
  131. border-radius: 2vw;
  132. border: 1px solid #3333;
  133. .list_1 {
  134. margin: 0 0 1vw 0;
  135. display: flex;
  136. flex-direction: row;
  137. justify-content: space-between;
  138. font-size: var(--font14Size);
  139. font-weight: bold;
  140. }
  141. .list_2 {
  142. margin: 0 0 1vw 0;
  143. display: flex;
  144. .l {
  145. width: 20vw;
  146. .image {
  147. width: 100%;
  148. height: 20vw;
  149. border-radius: 5px;
  150. }
  151. }
  152. .c {
  153. width: 50vw;
  154. padding: 0 2vw;
  155. }
  156. .r {
  157. width: 25vw;
  158. text-align: right;
  159. }
  160. }
  161. .other {
  162. margin: 0 0 2vw 0;
  163. text-align: right;
  164. text {
  165. font-size: 14px;
  166. padding: 0 0 0 2vw;
  167. }
  168. }
  169. .btn {
  170. text-align: right;
  171. margin: 2vw 0 0 0;
  172. border-top: 1px solid #f1fff1;
  173. button {
  174. margin: 2vw 0 0 2vw;
  175. }
  176. }
  177. }
  178. }
  179. .two {
  180. padding: 2vw;
  181. .btn {
  182. text-align: center;
  183. button {
  184. width: 30%;
  185. font-size: 14px;
  186. background-color: var(--f35BColor);
  187. }
  188. }
  189. }
  190. }
  191. .uni-forms-item {
  192. margin-bottom: 6vw !important;
  193. display: flex;
  194. flex-direction: row;
  195. }
  196. </style>