index.vue 8.4 KB

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