index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <!-- 扫码入库确认页面 -->
  3. <view>
  4. <u-modal v-model="show" :show-title="false" @confirm="confirm">
  5. <view style="width: 100%;height: 42rpx;margin-top: 30rpx;margin-bottom: 10rpx;text-align: center;">成功信息</view>
  6. <u-table border-color="#f2f2f2">
  7. <u-tr class="u-tr">
  8. <u-td class="u-td" style="font-size: 24rpx;">{{successCount}}</u-td>
  9. <u-td class="u-td">成功入库轮胎</u-td>
  10. </u-tr>
  11. </u-table>
  12. <view style="width: 100%;height: 42rpx;margin-top: 30rpx;margin-bottom: 10rpx;text-align: center;">失败信息</view>
  13. <u-table border-color="#f2f2f2">
  14. <u-tr class="u-tr">
  15. <u-th class="u-th">轮胎胎号</u-th>
  16. <u-th class="u-th">失败原因</u-th>
  17. </u-tr>
  18. <u-tr class="u-tr" v-for="(item,index) in notBelongStoreBrandTyreNumbers" :key="index">
  19. <u-td class="u-td" style="font-size: 24rpx;">{{item}}</u-td>
  20. <u-td class="u-td">非门店经营品牌</u-td>
  21. </u-tr>
  22. <u-tr class="u-tr" v-for="(item,index) in nonRegularTyreNumbers" :key="index">
  23. <u-td class="u-td" style="font-size: 24rpx;">{{item}}</u-td>
  24. <u-td class="u-td">非正规胎号</u-td>
  25. </u-tr>
  26. <u-tr class="u-tr" v-for="(item,index) in alreadyExistsTyreNumbers" :key="index">
  27. <u-td class="u-td" style="font-size: 24rpx;">{{item}}</u-td>
  28. <u-td class="u-td">库存中已存在</u-td>
  29. </u-tr>
  30. </u-table>
  31. <view style="width: 100%;height: 42rpx;margin-top: 30rpx;margin-bottom: 10rpx;text-align: center;">奖励明细</view>
  32. <u-table border-color="#f2f2f2">
  33. <u-tr class="u-tr">
  34. <u-td class="u-td">{{rewardMoney}}奖励</u-td>
  35. <u-td class="u-td">{{rewardIntegral}}积分</u-td>
  36. </u-tr>
  37. </u-table>
  38. </u-modal>
  39. <view class="header">
  40. <view class="behind"></view>
  41. <view class="content">
  42. <view class="content-one">
  43. <view>胎号</view>
  44. <view>物料</view>
  45. <view>预计奖励</view>
  46. </view>
  47. <view v-for="(item,index) in dalist" :key="index">
  48. <view class="content-two">
  49. <view>{{item.tireNumber}}</view>
  50. <view>{{item.maktx}}</view>
  51. <view>{{item.rewardMoney}}元</view>
  52. </view>
  53. </view>
  54. <view class="content-three">
  55. <view>
  56. 合计:{{total}}元
  57. </view>
  58. </view>
  59. </view>
  60. <view class="content-four">
  61. 注:请完善请完善请完善请完善请完善请完善请完善
  62. </view>
  63. </view>
  64. <u-toast ref="repeat" position="bottom" />
  65. <view class="tail" @click="location">
  66. 扫码确认
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import {
  72. request
  73. } from '../../../common/request/request'
  74. require("promise.prototype.finally").shim()
  75. export default {
  76. data() {
  77. return {
  78. dalist: [],
  79. total: 0,
  80. show: false,
  81. successCount: '', //成功条数
  82. notBelongStoreBrandTyreNumbers: [], //非门店经营品牌胎号
  83. nonRegularTyreNumbers: [], //非正规胎号
  84. alreadyExistsTyreNumbers: [], //库存中已存在轮胎号
  85. rewardMoney: '', //奖励金额
  86. rewardIntegral: '' ,//奖励积分
  87. longitude:'', //经度
  88. latitude:'', //纬度
  89. address: '' //中文地址
  90. }
  91. },
  92. created() {
  93. uni.getNetworkType({
  94. success: function (res) {
  95. let none = res.networkType
  96. console.log(res.networkType);
  97. if(none == 'none'){
  98. uni.showToast({
  99. icon: 'none',
  100. title: '无网络,请连接网络后再试~',
  101. position: "bottom"
  102. })
  103. }
  104. }
  105. });
  106. this.getDatalist()
  107. },
  108. methods: {
  109. confirm() {
  110. this.$u.route({
  111. type:'redirectTo',
  112. url: 'pages/me/Warehousing-details/index'
  113. })
  114. },
  115. getDatalist() {
  116. uni.$on('update', data => {
  117. this.datalist = data.materialList
  118. request({
  119. url: '/storeScan/getTyreReword',
  120. method: 'Post',
  121. data: {
  122. storeId:this.$store.state.storeInfo.storeId,
  123. userId:this.$store.state.storeInfo.userId,
  124. materialList: this.datalist
  125. }
  126. }).then(res => {
  127. console.log(res)
  128. this.dalist = res.data.data
  129. for (let i = 0; i < this.dalist.length; i++) {
  130. this.total += parseInt(this.dalist[i].rewardMoney)
  131. }
  132. return this.total
  133. }).catch(err => {
  134. console.log(err)
  135. uni.showToast({
  136. icon: 'none',
  137. title: '无网络,请连接网络后再试~'
  138. })
  139. }).finally(() => {
  140. // Loading.close()
  141. })
  142. })
  143. },
  144. location(){
  145. let this_s = this
  146. uni.getLocation({
  147. type: 'wgs84', // 返回国测局坐标
  148. geocode: true,
  149. success: function(res) {
  150. console.log(res);
  151. this_s.longitude = res.longitude
  152. this_s.latitude = res.latitude
  153. this_s.address = res.address.city + res.address.district + res.address.poiName
  154. this_s.Submit()
  155. },
  156. fail: function(e) {
  157. uni.showToast({
  158. icon: 'none',
  159. title: '获取地址失败, 请检查是否开启定位权限~~'
  160. })
  161. }
  162. })
  163. },
  164. Submit() {
  165. this.show = true;
  166. request({
  167. url: '/storeScan/storeScanTyres',
  168. method: 'Post',
  169. data: {
  170. storeId:this.$store.state.storeInfo.storeId,
  171. userId:this.$store.state.storeInfo.userId,
  172. scanAddress: this.address, //地址
  173. longitude: this.longitude, //纬度
  174. latitude: this.latitude, //经度
  175. materialList: this.datalist //轮胎参数
  176. }
  177. }).then(res => {
  178. console.log(res)
  179. console.log(res.data.msg)
  180. if (res.data.code == 500) {
  181. this.$refs.repeat.show({
  182. title: res.data.msg,
  183. type: 'default',
  184. position: 'bottom'
  185. })
  186. }
  187. this.notBelongStoreBrandTyreNumbers = res.data.data.notBelongStoreBrandTyreNumbers //非门店经营品牌胎号
  188. this.successCount = res.data.data.successCount //成功条数
  189. this.nonRegularTyreNumbers = res.data.data.nonRegularTyreNumbers //非正规胎号
  190. this.alreadyExistsTyreNumbers = res.data.data.alreadyExistsTyreNumbers //库存中已存在轮胎号
  191. this.rewardMoney = res.data.data.rewardMoney //奖励金额
  192. this.rewardIntegral = res.data.data.rewardIntegral //奖励积分
  193. console.log(res)
  194. }).catch(err => {
  195. console.log(err.data.msg)
  196. }).finally(() => {
  197. // Loading.close()
  198. })
  199. }
  200. },
  201. }
  202. </script>
  203. <style lang="scss" scoped>
  204. .behind {
  205. width: 100%;
  206. height: 230rpx;
  207. margin-bottom: -200rpx;
  208. background-color: #0094FE;
  209. }
  210. .header {
  211. width: 100%;
  212. }
  213. .content {
  214. width: 711rpx;
  215. // height: 852rpx;
  216. background: #FFFFFF;
  217. box-shadow: 0rpx 0rpx 24rpx 0rpx rgba(101, 176, 249, 0.41);
  218. border-radius: 20rpx;
  219. padding-top: 10rpx;
  220. padding-bottom: 10rpx;
  221. margin: 0 auto;
  222. }
  223. .content-one {
  224. display: flex;
  225. justify-content: space-between;
  226. }
  227. .content-one:nth-child(1) {
  228. margin-left: 90rpx;
  229. margin-right: 50rpx;
  230. font-weight: bold;
  231. margin-top: 30rpx;
  232. }
  233. .content-two {
  234. display: flex;
  235. justify-content: space-between;
  236. margin-top: 30rpx;
  237. line-height: 115rpx;
  238. width: 666rpx;
  239. margin: 0 auto;
  240. color: #9c9c9c;
  241. font-size: 28rpx;
  242. border-bottom: 1rpx solid #E8E8E8;
  243. }
  244. .content-two>view:nth-child(2) {
  245. width: 240rpx;
  246. line-height: 53rpx;
  247. text-align: center;
  248. margin-right: 100rpx;
  249. }
  250. .content-two>view:nth-child(3) {
  251. color: #149EE2;
  252. margin-right: 50rpx;
  253. }
  254. .tail {
  255. width: 678rpx;
  256. line-height: 83rpx;
  257. background: #0095FF;
  258. color: #fff;
  259. text-align: center;
  260. margin: 0 auto;
  261. margin-top: 60rpx;
  262. border-radius: 15rpx;
  263. }
  264. .content-three>view:nth-child(1) {
  265. margin-left: 500rpx;
  266. line-height: 80rpx;
  267. font-weight: bolder;
  268. }
  269. .content-four {
  270. color: #acacac;
  271. font-size: 24rpx;
  272. margin-top: 30rpx;
  273. margin-left: 20rpx;
  274. margin-bottom: 50rpx;
  275. }
  276. </style>