index.vue 8.5 KB

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