index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <view>
  3. <u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="兑换"></u-navbar>
  4. <view class="settlement">
  5. <!-- 商品 -->
  6. <view class="settlement-goods" style="background-color: #fff">
  7. <view class="settlement-goods-item">
  8. <image :src="list.picUrl" mode="aspectFit"></image>
  9. <view class="info">
  10. <view class="info-title ells">{{ list.title }}</view>
  11. <view class="info-num flex">
  12. <view class="info-num-sku ells-one">规格:{{ list.properties || '-' }}</view>
  13. <view class="info-num-goods">剩余数量:{{ list.goodsNum }}</view>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="flex numbtn">
  18. <view class="type"></view>
  19. <view class="btn" @click="toRecovery">兑换数量:<view style="display: inline-block;">
  20. <u-number-box input-width="25" disabledInput :max="list.goodsNum" button-size="26" color="#999999" bg-color="#F5F6F8"
  21. v-model="value" @change="valChange"></u-number-box>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="settlement-tip">
  27. <view>1. 不喜欢的商品可回收兑换为盲豆<br>2. 盲豆可用于在平台商城中兑换商品<br>3. 盲豆的所属解释权归平台所有,有疑问请联系客服</view>
  28. </view>
  29. </view>
  30. <view class="footer-fixed">
  31. <view class="content">
  32. <view class="content-btn flex">
  33. <view class="content-btn-left">
  34. <view class="money">
  35. <text>总价:</text>
  36. <text class="value">{{ list.returnCoin }}盲豆</text>
  37. </view>
  38. </view>
  39. <view class="content-btn-right">
  40. <text class="save" @click="save">确定兑换</text>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import env from '../../config/env.js'
  49. import $http from '@/utils/request.js'
  50. export default {
  51. data() {
  52. return {
  53. list: [],
  54. value: '',
  55. recovery: {},
  56. }
  57. },
  58. onLoad(opthios) {
  59. if(opthios){
  60. this.value = opthios.num
  61. this.recovery = {
  62. goodsId: opthios.goodsId,
  63. num: opthios.num,
  64. properties: opthios.properties,
  65. skuId: opthios.skuId=="null"?null:opthios.skuId,
  66. storageId: opthios.storageId,
  67. }
  68. this.getDetail()
  69. }
  70. },
  71. onShow() {
  72. this.getDetail()
  73. },
  74. methods: {
  75. getDetail() {
  76. uni.showLoading({
  77. title: '加载中'
  78. });
  79. $http.post('/api/v1/mp/user/prize/recovery/settle', this.recovery).then(res => {
  80. uni.hideLoading();
  81. if (res.code == 0) {
  82. res.data.picUrl = env.filePublic + res.data.picUrl.split(',')[0] + '?imageView2/2/w/170'
  83. this.list = res.data
  84. }
  85. }).catch(() => {
  86. uni.hideLoading();
  87. })
  88. },
  89. valChange(e) {
  90. this.recovery.num = e.value
  91. this.getDetail()
  92. },
  93. //确定兑
  94. save() {
  95. uni.showLoading({
  96. title: '加载中'
  97. });
  98. $http.post('/api/v1/mp/user/prize/recovery/submit',{}).then(res => {
  99. uni.hideLoading();
  100. if (res.code == 0) {
  101. this.toRecoveryDetail()
  102. }else {
  103. }
  104. }).catch(() => {
  105. uni.hideLoading();
  106. })
  107. },
  108. toRecoveryDetail() {
  109. uni.navigateTo({
  110. url: '/packageGoods/recovery/detail'
  111. })
  112. }
  113. }
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. .settlement {
  118. margin: 34rpx;
  119. padding-bottom: 100rpx;
  120. // 商品
  121. &-goods {
  122. margin-bottom: 34rpx;
  123. background-color: #fff;
  124. border-radius: 22rpx;
  125. box-shadow: 0px 0px 8px 0px rgba(26, 35, 113, 0.08);
  126. // 商品列表
  127. &-item {
  128. display: flex;
  129. padding: 34rpx 32rpx 34rpx 22rpx;
  130. image {
  131. width: 176rpx;
  132. height: 176rpx;
  133. border-radius: 12rpx;
  134. margin-right: 22rpx;
  135. }
  136. .info {
  137. display: flex;
  138. flex-direction: column;
  139. justify-content: space-between;
  140. flex: 1;
  141. padding: 8rpx 0;
  142. &-title {
  143. font-size: 30rpx;
  144. font-weight: bold;
  145. line-height: 40rpx;
  146. }
  147. &-num {
  148. justify-content: space-between;
  149. &-sku {
  150. flex: 1;
  151. color: #666666;
  152. font-size: 26rpx;
  153. }
  154. &-goods {
  155. color: #666666;
  156. font-size: 26rpx;
  157. }
  158. }
  159. }
  160. }
  161. }
  162. // 留言、运费
  163. &-tip {
  164. font-size: 26rpx;
  165. margin-bottom: 34rpx;
  166. background-color: #EEEEEE;
  167. padding: 34rpx;
  168. border-radius: 22rpx;
  169. color: #666666;
  170. }
  171. .numbtn {
  172. margin: 0 50rpx;
  173. border-top: #E5E5E5 2rpx solid;
  174. justify-content: space-between;
  175. color: #333333;
  176. font-size: 30rpx;
  177. font-weight: 500;
  178. line-height: 100rpx;
  179. }
  180. }
  181. .footer-fixed {
  182. position: fixed;
  183. bottom: var(--window-bottom);
  184. left: 0;
  185. right: 0;
  186. z-index: 11;
  187. box-shadow: 0 -4rpx 40rpx 0 rgba(151, 151, 151, 0.24);
  188. background: #fff;
  189. // 设置ios刘海屏底部横线安全区域
  190. padding-bottom: constant(safe-area-inset-bottom);
  191. padding-bottom: env(safe-area-inset-bottom);
  192. .content {
  193. padding: 20rpx 0;
  194. font-size: 30rpx;
  195. // 不发货提示
  196. &-not {
  197. justify-content: flex-start;
  198. font-size: 30rpx;
  199. color: #F9832E;
  200. margin: 0 0 30rpx;
  201. padding: 0 40rpx 24rpx;
  202. border-bottom: 1px solid #eee;
  203. }
  204. // 提交按钮
  205. &-btn {
  206. justify-content: space-between;
  207. padding: 0 40rpx;
  208. &-left {
  209. .value {
  210. color: #FF4208;
  211. }
  212. }
  213. &-right {
  214. display: flex;
  215. align-items: center;
  216. justify-content: flex-end;
  217. .save {
  218. width: 210rpx;
  219. height: 82rpx;
  220. line-height: 82rpx;
  221. background: #F9822C;
  222. border-radius: 40rpx;
  223. text-align: center;
  224. color: #fff;
  225. }
  226. .not {
  227. background-color: #6c6c6c;
  228. }
  229. }
  230. }
  231. }
  232. }
  233. </style>