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