index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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;">{{$t('scanningconfirm.success')}}</view>
  6. <u-table border-color="#f2f2f2">
  7. <u-tr class="u-tr">
  8. <u-td class="u-td">{{successCount}}{{$t('scanningconfirm.strip')}}</u-td>
  9. <u-td class="u-td">{{$t('scanningconfirm.Successfullypit')}}</u-td>
  10. </u-tr>
  11. </u-table>
  12. <view style="width: 100%;height: 42rpx;margin-top: 30rpx;margin-bottom: 10rpx;text-align: center;">{{$t('scanningconfirm.fail')}}</view>
  13. <u-table border-color="#f2f2f2">
  14. <u-tr class="u-tr">
  15. <u-th class="u-th">{{$t('scanningconfirm.number')}}</u-th>
  16. <u-th class="u-th">{{$t('scanningconfirm.failreason')}}</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">{{$t('scanningconfirm.stateA')}}</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">{{$t('scanningconfirm.stateB')}}</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">{{$t('scanningconfirm.stateC')}}</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">{{$t('scanningconfirm.reward')}}:{{rewardMoney}}{{$t('scanningconfirm.yuan')}}</u-td>
  35. <u-td class="u-td">{{$t('scanningconfirm.integral')}}:{{rewardIntegral}}{{$t('scanningconfirm.one')}}</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>{{$t('scanningconfirm.number_s')}}</view>
  44. <view>{{$t('scanningconfirm.materiel')}}</view>
  45. <view>{{$t('scanningconfirm.estimatereward')}}</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}}{{$t('scanningconfirm.yuan')}}</view>
  52. </view>
  53. </view>
  54. <view class="content-three">
  55. <view>
  56. {{$t('scanningconfirm.total')}}:{{total}}{{$t('scanningconfirm.yuan')}}
  57. </view>
  58. </view>
  59. </view>
  60. <view class="content-four">
  61. {{$t('scanningconfirm.attention')}}
  62. </view>
  63. </view>
  64. <u-toast ref="repeat" position="bottom" />
  65. <view class="tail" @click="location">
  66. {{$t('scanningconfirm.confirm')}}
  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 {
  81. mapMutations
  82. } from 'vuex'
  83. export default {
  84. data() {
  85. return {
  86. dalist: [],
  87. total: 0,
  88. show: false,
  89. successCount: '', //成功条数
  90. notBelongStoreBrandTyreNumbers: [], //非门店经营品牌胎号
  91. nonRegularTyreNumbers: [], //非正规胎号
  92. alreadyExistsTyreNumbers: [], //库存中已存在轮胎号
  93. rewardMoney: '', //奖励金额
  94. rewardIntegral: '', //奖励积分
  95. longitude: '', //经度
  96. latitude: '', //纬度
  97. whole:''
  98. }
  99. },
  100. created() {
  101. uni.setNavigationBarTitle({
  102. title: this.$t('scanningconfirm.titleIn')
  103. });
  104. uni.getNetworkType({
  105. success: function(res) {
  106. let none = res.networkType
  107. if (none == 'none') {
  108. uni.showToast({
  109. icon: 'none',
  110. title: this.$t('unified.networkstate'),
  111. position: "bottom"
  112. })
  113. }
  114. }
  115. });
  116. this.getDatalist()
  117. },
  118. onBackPress(options) {
  119. if (options.from == 'backbutton') {
  120. this.$u.route({
  121. url: 'pages/home/scancode/index'
  122. })
  123. uni.$emit('data', {
  124. lisi: this.datalist,
  125. })
  126. }
  127. return true;
  128. },
  129. methods: {
  130. ...mapMutations(["inStore"]),
  131. confirm() {
  132. this.$u.route({
  133. type: 'redirectTo',
  134. url: 'pages/me/Warehousing-details/index'
  135. })
  136. },
  137. getDatalist() {
  138. uni.showLoading({
  139. title: this.$t('unified.Loading')
  140. });
  141. setTimeout(function() {
  142. uni.hideLoading();
  143. }, 1000);
  144. uni.$on('update', data => {
  145. this.datalist = data.materialList
  146. this.whole = data
  147. console.log(data)
  148. request({
  149. url: '/storeScan/getTyreReword',
  150. method: 'Post',
  151. data: {
  152. storeId: this.$store.state.storeInfo.storeId,
  153. userId: this.$store.state.storeInfo.userId,
  154. materialList: this.datalist,
  155. scanType:'1'
  156. }
  157. }).then(res => {
  158. console.log(res)
  159. if (res.data.code == 0) {
  160. this.dalist = res.data.data
  161. for (let i = 0; i < this.dalist.length; i++) {
  162. this.total += parseInt(this.dalist[i].rewardMoney)
  163. }
  164. this.inStore()
  165. return this.total
  166. } else {
  167. uni.showToast({
  168. icon: 'none',
  169. title: this.$t('unified.error')
  170. })
  171. }
  172. }).catch(err => {
  173. uni.showToast({
  174. icon: 'none',
  175. title: this.$t('unified.networkstate')
  176. })
  177. }).finally(() => {
  178. // Loading.close()
  179. })
  180. })
  181. },
  182. location() {
  183. console.log(this.whole)
  184. uni.getNetworkType({
  185. success: function(res) {
  186. let none = res.networkType
  187. if (none == 'none') {
  188. uni.showToast({
  189. icon: 'none',
  190. title: this.$t('unified.networkstate'),
  191. position: "bottom"
  192. })
  193. }
  194. }
  195. });
  196. let this_s = this
  197. this_s.Submit()
  198. },
  199. Submit() {
  200. this.show = true;
  201. request({
  202. url: '/storeScan/storeScanTyres',
  203. method: 'Post',
  204. data: {
  205. storeId: this.$store.state.storeInfo.storeId,
  206. userId: this.$store.state.storeInfo.userId,
  207. scanAddress: this.whole.address, //地址
  208. longitude: this.whole.degree.x,
  209. latitude: this.whole.degree.y,
  210. materialList: this.datalist //轮胎参数
  211. }
  212. }).then(res => {
  213. console.log(res)
  214. if (res.data.code == 500) {
  215. this.$refs.repeat.show({
  216. title: res.data.msg,
  217. type: 'default',
  218. position: 'bottom'
  219. })
  220. }
  221. this.notBelongStoreBrandTyreNumbers = res.data.data.notBelongStoreBrandTyreNumbers //非门店经营品牌胎号
  222. this.successCount = res.data.data.successCount //成功条数
  223. this.nonRegularTyreNumbers = res.data.data.nonRegularTyreNumbers //非正规胎号
  224. this.alreadyExistsTyreNumbers = res.data.data.alreadyExistsTyreNumbers //库存中已存在轮胎号
  225. this.rewardMoney = res.data.data.rewardMoney //奖励金额
  226. this.rewardIntegral = res.data.data.rewardIntegral //奖励积分
  227. this.datalist = ''
  228. }).catch(err => {
  229. uni.showToast({
  230. icon: 'none',
  231. title: this.$t('scanningconfirm.networkstate')
  232. })
  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>