index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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">{{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">{{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">{{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">{{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. const app = getApp()
  72. var QQMapWX = require('../../../components/mi-map/qqmap-wx-jssdk.min.js')
  73. var qqmapsdk = new QQMapWX({
  74. key: 'LXCBZ-NNIKD-UZ64F-H6AFI-UNJLH-OCFGE'
  75. })
  76. import {
  77. request
  78. } from '../../../common/request/request'
  79. require("promise.prototype.finally").shim()
  80. export default {
  81. data() {
  82. return {
  83. dalist: [],
  84. total: 0,
  85. show: false,
  86. successCount: '', //成功条数
  87. notBelongStoreBrandTyreNumbers: [], //非门店经营品牌胎号
  88. nonRegularTyreNumbers: [], //非正规胎号
  89. alreadyExistsTyreNumbers: [], //库存中已存在轮胎号
  90. rewardMoney: '', //奖励金额
  91. rewardIntegral: '' ,//奖励积分
  92. longitude:'', //经度
  93. latitude:'', //纬度
  94. address: '' //中文地址
  95. }
  96. },
  97. created() {
  98. uni.getNetworkType({
  99. success: function (res) {
  100. let none = res.networkType
  101. console.log(res.networkType);
  102. if(none == 'none'){
  103. uni.showToast({
  104. icon: 'none',
  105. title: '无网络,请连接网络后再试~',
  106. position: "bottom"
  107. })
  108. }
  109. }
  110. });
  111. this.getDatalist()
  112. },
  113. methods: {
  114. confirm() {
  115. this.$u.route({
  116. type:'redirectTo',
  117. url: 'pages/me/Warehousing-details/index'
  118. })
  119. },
  120. getDatalist() {
  121. uni.$on('update', data => {
  122. this.datalist = data.materialList
  123. request({
  124. url: '/storeScan/getTyreReword',
  125. method: 'Post',
  126. data: {
  127. storeId:this.$store.state.storeInfo.storeId,
  128. userId:this.$store.state.storeInfo.userId,
  129. materialList: this.datalist
  130. }
  131. }).then(res => {
  132. console.log(res)
  133. this.dalist = res.data.data
  134. for (let i = 0; i < this.dalist.length; i++) {
  135. this.total += parseInt(this.dalist[i].rewardMoney)
  136. }
  137. return this.total
  138. }).catch(err => {
  139. console.log(err)
  140. uni.showToast({
  141. icon: 'none',
  142. title: '无网络,请连接网络后再试~'
  143. })
  144. }).finally(() => {
  145. // Loading.close()
  146. })
  147. })
  148. },
  149. location(){
  150. uni.getNetworkType({
  151. success: function (res) {
  152. let none = res.networkType
  153. console.log(res.networkType);
  154. if(none == 'none'){
  155. uni.showToast({
  156. icon: 'none',
  157. title: '无网络,请连接网络后再试~',
  158. position: "bottom"
  159. })
  160. }
  161. }
  162. });
  163. let this_s = this
  164. uni.getLocation({
  165. type: 'wgs84', // 返回国测局坐标
  166. geocode: true,
  167. success: function(res) {
  168. console.log(res);
  169. this_s.longitude = res.longitude
  170. this_s.latitude = res.latitude
  171. this_s.address = res.address.country + res.address.province + res.address.city + res.address.district + res.address.street
  172. if(res.address.length == 0){
  173. uni.showToast({
  174. icon: 'none',
  175. title: '获取地址失败, 请检查是否开启定位权限~~',
  176. position: "bottom"
  177. })
  178. console.log("定位失败出去啦")
  179. return
  180. }
  181. this_s.Submit()
  182. },
  183. fail: function(e) {
  184. uni.showToast({
  185. icon: 'none',
  186. title: '获取地址失败, 请检查是否开启定位权限~~'
  187. })
  188. this.location()
  189. }
  190. })
  191. },
  192. Submit() {
  193. this.show = true;
  194. request({
  195. url: '/storeScan/storeScanTyres',
  196. method: 'Post',
  197. data: {
  198. storeId:this.$store.state.storeInfo.storeId,
  199. userId:this.$store.state.storeInfo.userId,
  200. scanAddress: this.address, //地址
  201. longitude: this.longitude, //纬度
  202. latitude: this.latitude, //经度
  203. materialList: this.datalist //轮胎参数
  204. }
  205. }).then(res => {
  206. console.log(res)
  207. console.log(res.data.msg)
  208. if (res.data.code == 500) {
  209. this.$refs.repeat.show({
  210. title: res.data.msg,
  211. type: 'default',
  212. position: 'bottom'
  213. })
  214. }
  215. this.notBelongStoreBrandTyreNumbers = res.data.data.notBelongStoreBrandTyreNumbers //非门店经营品牌胎号
  216. this.successCount = res.data.data.successCount //成功条数
  217. this.nonRegularTyreNumbers = res.data.data.nonRegularTyreNumbers //非正规胎号
  218. this.alreadyExistsTyreNumbers = res.data.data.alreadyExistsTyreNumbers //库存中已存在轮胎号
  219. this.rewardMoney = res.data.data.rewardMoney //奖励金额
  220. this.rewardIntegral = res.data.data.rewardIntegral //奖励积分
  221. console.log(res)
  222. }).catch(err => {
  223. console.log(err.data.msg)
  224. }).finally(() => {
  225. // Loading.close()
  226. })
  227. }
  228. },
  229. }
  230. </script>
  231. <style lang="scss" scoped>
  232. .behind {
  233. width: 100%;
  234. height: 230rpx;
  235. margin-bottom: -200rpx;
  236. background-color: #0094FE;
  237. }
  238. .header {
  239. width: 100%;
  240. }
  241. .content {
  242. width: 711rpx;
  243. // height: 852rpx;
  244. background: #FFFFFF;
  245. box-shadow: 0rpx 0rpx 24rpx 0rpx rgba(101, 176, 249, 0.41);
  246. border-radius: 20rpx;
  247. padding-top: 10rpx;
  248. padding-bottom: 10rpx;
  249. margin: 0 auto;
  250. }
  251. .content-one {
  252. display: flex;
  253. justify-content: space-between;
  254. }
  255. .content-one:nth-child(1) {
  256. margin-left: 90rpx;
  257. margin-right: 50rpx;
  258. font-weight: bold;
  259. margin-top: 30rpx;
  260. }
  261. .content-two {
  262. display: flex;
  263. justify-content: space-between;
  264. margin-top: 30rpx;
  265. line-height: 115rpx;
  266. width: 666rpx;
  267. margin: 0 auto;
  268. color: #9c9c9c;
  269. font-size: 28rpx;
  270. border-bottom: 1rpx solid #E8E8E8;
  271. }
  272. .content-two>view:nth-child(2) {
  273. width: 240rpx;
  274. line-height: 53rpx;
  275. text-align: center;
  276. margin-right: 100rpx;
  277. }
  278. .content-two>view:nth-child(3) {
  279. color: #149EE2;
  280. margin-right: 50rpx;
  281. }
  282. .tail {
  283. width: 678rpx;
  284. line-height: 83rpx;
  285. background: #0095FF;
  286. color: #fff;
  287. text-align: center;
  288. margin: 0 auto;
  289. margin-top: 60rpx;
  290. border-radius: 15rpx;
  291. }
  292. .content-three>view:nth-child(1) {
  293. margin-left: 500rpx;
  294. line-height: 80rpx;
  295. font-weight: bolder;
  296. }
  297. .content-four {
  298. color: #acacac;
  299. font-size: 24rpx;
  300. margin-top: 30rpx;
  301. margin-left: 20rpx;
  302. margin-bottom: 50rpx;
  303. }
  304. </style>