index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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:Number(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. this.value = res.data.num
  83. res.data.picUrl = env.filePublic + res.data.picUrl.split(',')[0] + '?imageView2/2/w/170'
  84. this.list = res.data
  85. }
  86. }).catch(() => {
  87. uni.hideLoading();
  88. })
  89. },
  90. valChange(e) {
  91. this.recovery.num = e.value
  92. this.getDetail()
  93. },
  94. //确定兑
  95. save() {
  96. uni.showLoading({
  97. title: '加载中'
  98. });
  99. $http.post('/api/v1/mp/user/prize/recovery/submit',{}).then(res => {
  100. uni.hideLoading();
  101. if (res.code == 0) {
  102. this.toRecoveryDetail()
  103. }else {
  104. }
  105. }).catch(() => {
  106. uni.hideLoading();
  107. })
  108. },
  109. toRecoveryDetail() {
  110. uni.redirectTo({
  111. url: '/packageGoods/recovery/detail'
  112. })
  113. }
  114. }
  115. }
  116. </script>
  117. <style lang="scss" scoped>
  118. .settlement {
  119. margin: 34rpx;
  120. padding-bottom: 100rpx;
  121. // 商品
  122. &-goods {
  123. margin-bottom: 34rpx;
  124. background-color: #fff;
  125. border-radius: 22rpx;
  126. box-shadow: 0px 0px 8px 0px rgba(26, 35, 113, 0.08);
  127. // 商品列表
  128. &-item {
  129. display: flex;
  130. padding: 34rpx 32rpx 34rpx 22rpx;
  131. image {
  132. width: 176rpx;
  133. height: 176rpx;
  134. border-radius: 12rpx;
  135. margin-right: 22rpx;
  136. }
  137. .info {
  138. display: flex;
  139. flex-direction: column;
  140. justify-content: space-between;
  141. flex: 1;
  142. padding: 8rpx 0;
  143. &-title {
  144. font-size: 30rpx;
  145. font-weight: bold;
  146. line-height: 40rpx;
  147. }
  148. &-num {
  149. justify-content: space-between;
  150. &-sku {
  151. flex: 1;
  152. color: #666666;
  153. font-size: 26rpx;
  154. }
  155. &-goods {
  156. color: #666666;
  157. font-size: 26rpx;
  158. }
  159. }
  160. }
  161. }
  162. }
  163. // 留言、运费
  164. &-tip {
  165. font-size: 26rpx;
  166. margin-bottom: 34rpx;
  167. background-color: #fff;
  168. padding: 34rpx;
  169. border-radius: 22rpx;
  170. color: #666666;
  171. }
  172. .numbtn {
  173. margin: 0 50rpx;
  174. border-top: #E5E5E5 2rpx solid;
  175. justify-content: space-between;
  176. color: #333333;
  177. font-size: 30rpx;
  178. font-weight: 500;
  179. line-height: 100rpx;
  180. }
  181. }
  182. .footer-fixed {
  183. position: fixed;
  184. bottom: var(--window-bottom);
  185. left: 0;
  186. right: 0;
  187. z-index: 11;
  188. box-shadow: 0 -4rpx 40rpx 0 rgba(151, 151, 151, 0.24);
  189. background: #fff;
  190. // 设置ios刘海屏底部横线安全区域
  191. padding-bottom: constant(safe-area-inset-bottom);
  192. padding-bottom: env(safe-area-inset-bottom);
  193. .content {
  194. padding: 20rpx 0;
  195. font-size: 30rpx;
  196. // 提交按钮
  197. &-btn {
  198. justify-content: space-between;
  199. padding: 0 40rpx;
  200. &-left {
  201. .money {
  202. font-size: 30rpx;
  203. text:first-child {
  204. font-weight: bold;
  205. }
  206. .value {
  207. color: #F9832E;
  208. }
  209. }
  210. }
  211. &-right {
  212. display: flex;
  213. align-items: center;
  214. justify-content: flex-end;
  215. .save {
  216. width: 210rpx;
  217. height: 82rpx;
  218. line-height: 82rpx;
  219. background: #F9822C;
  220. border-radius: 40rpx;
  221. text-align: center;
  222. color: #fff;
  223. }
  224. .not {
  225. background-color: #6c6c6c;
  226. }
  227. }
  228. }
  229. }
  230. }
  231. </style>