noService.vue 4.2 KB

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