index.vue 8.4 KB

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