index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <!-- 扫码入库确认页面 -->
  3. <view>
  4. <view class="header">
  5. <view class="behind"></view>
  6. <view class="content">
  7. <view class="content-one">
  8. <view>胎号</view>
  9. <view>物料</view>
  10. <view>预计奖励</view>
  11. </view>
  12. <view v-for="(item,index) in dalist" :key="index">
  13. <view class="content-two">
  14. <view>{{item.tireNumber}}</view>
  15. <view>{{item.maktx}}</view>
  16. <view>{{item.rewardMoney}}元</view>
  17. </view>
  18. </view>
  19. <view class="content-three">
  20. <view>
  21. 合计:{{total}}元
  22. </view>
  23. </view>
  24. </view>
  25. <view class="content-four">
  26. 注:请完善请完善请完善请完善请完善请完善请完善
  27. </view>
  28. </view>
  29. <u-toast ref="repeat" position="bottom" />
  30. <view class="tail" @click="Submit">
  31. 扫码确认
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. request
  38. } from '../../../common/request/request'
  39. require("promise.prototype.finally").shim()
  40. export default {
  41. data() {
  42. return {
  43. dalist: [],
  44. total: 0
  45. }
  46. },
  47. created() {
  48. this.getDatalist()
  49. },
  50. methods: {
  51. getDatalist() {
  52. uni.$on('update', data => {
  53. this.datalist = data.materialList
  54. request({
  55. url: '/storeScan/getTyreReword',
  56. method: 'Post',
  57. data: {
  58. storeId: '1000',
  59. userId: '123',
  60. materialList: this.datalist
  61. }
  62. }).then(res => {
  63. this.dalist = res.data.data
  64. for (let i = 0; i < this.dalist.length; i++) {
  65. this.total += parseInt(this.dalist[i].rewardMoney)
  66. }
  67. return this.total
  68. }).catch(err => {
  69. console.log(err)
  70. }).finally(() => {
  71. Loading.close()
  72. })
  73. })
  74. },
  75. Submit() {
  76. request({
  77. url: '/storeScan/storeScanTyres',
  78. method: 'Post',
  79. data: {
  80. storeId: '1000',
  81. userId: '123',
  82. scanAddress: '中国',
  83. longitude: '1213.61256',
  84. latitude: '541651.56',
  85. materialList: this.datalist
  86. }
  87. }).then(res => {
  88. console.log(res.data.msg)
  89. this.$refs.repeat.show({
  90. title: res.data.msg,
  91. type: 'default',
  92. position: 'bottom'
  93. })
  94. }).catch(err => {
  95. console.log(err.data.msg)
  96. }).finally(() => {
  97. Loading.close()
  98. })
  99. }
  100. },
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. .behind{
  105. width: 100%;
  106. height: 230rpx;
  107. margin-bottom: -200rpx;
  108. background-color: #0094FE;
  109. }
  110. .header {
  111. width: 100%;
  112. }
  113. .content {
  114. width: 711rpx;
  115. // height: 852rpx;
  116. background: #FFFFFF;
  117. box-shadow: 0rpx 0rpx 24rpx 0rpx rgba(101, 176, 249, 0.41);
  118. border-radius: 20rpx;
  119. padding-top: 10rpx;
  120. padding-bottom: 10rpx;
  121. margin: 0 auto;
  122. }
  123. .content-one {
  124. display: flex;
  125. justify-content: space-between;
  126. }
  127. .content-one:nth-child(1) {
  128. margin-left: 90rpx;
  129. margin-right: 50rpx;
  130. font-weight: bold;
  131. margin-top: 30rpx;
  132. }
  133. .content-two {
  134. display: flex;
  135. justify-content: space-between;
  136. margin-top: 30rpx;
  137. line-height: 115rpx;
  138. width: 666rpx;
  139. margin: 0 auto;
  140. color: #9c9c9c;
  141. font-size: 28rpx;
  142. border-bottom: 1rpx solid #E8E8E8;
  143. }
  144. .content-two>view:nth-child(2) {
  145. width: 240rpx;
  146. line-height: 53rpx;
  147. text-align: center;
  148. margin-right: 100rpx;
  149. }
  150. .content-two>view:nth-child(3) {
  151. color: #149EE2;
  152. margin-right: 50rpx;
  153. }
  154. .tail {
  155. width: 678rpx;
  156. line-height: 83rpx;
  157. background: #0095FF;
  158. color: #fff;
  159. text-align: center;
  160. margin: 0 auto;
  161. margin-top: 60rpx;
  162. border-radius: 15rpx;
  163. }
  164. .content-three>view:nth-child(1) {
  165. margin-left: 500rpx;
  166. line-height: 80rpx;
  167. font-weight: bolder;
  168. }
  169. .content-four {
  170. color: #acacac;
  171. font-size: 24rpx;
  172. margin-top: 30rpx;
  173. margin-left: 20rpx;
  174. margin-bottom: 50rpx;
  175. }
  176. </style>