choosePart.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952
  1. <template>
  2. <view class="flex flex_column choosePartByVin">
  3. <!-- 头部车辆信息 -->
  4. <div class="flex align-center cpb_header" v-if="carInfo">
  5. <div>
  6. <u-image border-radius="30" :src="carInfo.icon" width="100" height="100" bg-color="#EBEBEB" ></u-image>
  7. </div>
  8. <div>
  9. <div class="flex align-center">
  10. <div class="carTits ellipsis-two">{{modelLabel||''}}</div>
  11. </div>
  12. <div class="flex align-center">
  13. <div>VIN码:{{vinNumber}}</div>
  14. <div class="copyText" @click="copyVin"><span>复制</span></div>
  15. </div>
  16. </div>
  17. </div>
  18. <!-- 配件列表 -->
  19. <div class="cpb_middle flex">
  20. <div class="slider-bar">
  21. <div class="tabs">
  22. <view :class="[curLeve2 == 'all' ? 'active' : '']" @click="selLeve2('all')">
  23. 全部
  24. </view>
  25. <view :class="[curLeve2 == item.id ? 'active' : '']" v-for="(item, index) in leve2Data" :key="index" @click="selLeve2(item.id)">
  26. {{item.label}}
  27. </view>
  28. </div>
  29. </div>
  30. <div class="right-list">
  31. <scroll-view
  32. class="right-list-content"
  33. scroll-y
  34. @scrolltolower="onreachBottom">
  35. <!-- vin适配配件 -->
  36. <view>
  37. <view class="nav-right-title">适配推荐</view>
  38. <vinPartItem
  39. :list="vinPartList"
  40. :commonPartCode="commonPartCodeList"
  41. :configPrice="configPrice"
  42. :showCarPrice="showCarPrice"
  43. :showCostPrice="showCostPrice"
  44. :showShelfDetial="showShelfDetial"
  45. :showNonShelfDetial="showNonShelfDetial"
  46. :priceShowVal="priceShowVal"
  47. @viewImg="viewImg"
  48. @openPrice="openPriceModal"
  49. @addPart="addPart"
  50. @updateVinNums="updateVinNums"
  51. ></vinPartItem>
  52. <view v-if="vinPartList&&vinPartList.length==0">
  53. <u-empty v-if="vinStatus!='loading'" :src="`/static/nodata.png`" icon-size="180" text="暂无适配推荐" mode="list" :margin-top="30"></u-empty>
  54. </view>
  55. <view style="padding: 20upx;" v-if="vinStatus=='loading'" >
  56. <u-loadmore :status="vinStatus" />
  57. </view>
  58. </view>
  59. <!-- 其它配件 -->
  60. <view class="nav-right-title flex align_center justify_between" v-if="vinStatus!='loading'" @click="showOther=!showOther">
  61. 其它配件
  62. <text>{{showOther?'隐藏':'展开'}}</text>
  63. </view>
  64. <otherPartItem
  65. v-if="showOther"
  66. :list="partList"
  67. :configPrice="configPrice"
  68. :showCarPrice="showCarPrice"
  69. :showCostPrice="showCostPrice"
  70. :showShelfDetial="showShelfDetial"
  71. :priceShowVal="priceShowVal"
  72. @viewImg="viewImg"
  73. @openPrice="openPriceModal"
  74. @addPart="addPart"
  75. @updateNums="updateNums"
  76. ></otherPartItem>
  77. <view v-if="partList&&partList.length==0">
  78. <u-empty v-if="status!='loading'" :src="`/static/nodata.png`" icon-size="180" :text="noDataText" mode="list" :margin-top="150"></u-empty>
  79. </view>
  80. <view style="padding: 20upx;" v-if="showOther">
  81. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  82. </view>
  83. </scroll-view>
  84. </div>
  85. </div>
  86. <!-- 底部提交按钮 -->
  87. <div class="cpb_footer flex align-center" :class="isIphoneXup?'isIPXup':''">
  88. <div>
  89. <div class="cpb_cart" @click="openCart">
  90. <u-badge type="error" :count="cartNums" :offset="[-4,-4]" bgColor="#FF5200"></u-badge>
  91. <u-image width="44" height="44" :src="`/pagesA/static/icon_shopping@3x.png`"></u-image>
  92. </div>
  93. </div>
  94. <view>
  95. <!-- 合计:<text>¥{{totalAmount}}</text> -->
  96. <view style="font-size: 0.8em;color: dodgerblue;" v-if="dealerPhone" @click="callPhone()">
  97. <u-icon size="30" name="phone" color="dodgerblue"></u-icon><text>联系汽配商</text>
  98. </view>
  99. </view>
  100. <div>
  101. <u-button type="primary" :loading="saveLoading" @click="submitForm" :custom-style="{background:'#066cff',fontSize:'32rpx'}" shape="circle">确认拿货</u-button>
  102. </div>
  103. </div>
  104. <!-- 已选配件 购物车 -->
  105. <div class="cpb_cart-mask" v-if="showCart">
  106. <div class="cpb_cart-box">
  107. <div class="cpb_close flex align-center justify_center" @click="showCart=false"><u-icon name="close"></u-icon></div>
  108. <div class="cpb_cart-tit">
  109. 已选配件
  110. </div>
  111. <div class="cpb_cart-list">
  112. <view class="nav-right-item flex" v-for="(item, index) in partListData" :key="item.productSn">
  113. <view class="uni-col-2">
  114. <u-image border-radius="30" :src="item.images" width="150" height="150" bg-color="#EBEBEB" ></u-image>
  115. </view>
  116. <view class="item-info uni-col-10">
  117. <view class="item-name">
  118. <text class="item-tempPart" v-if="!item.currentInven">急送</text>
  119. <text>{{item.name}}</text>
  120. </view>
  121. <view class="item-detail">
  122. <view class="item-detail-info">
  123. <view class="flex justify_between">
  124. <text class="item-detail-text flex_1">{{item.code}}</text>
  125. <text class="item-detail-text" v-if="item.affiliation!='NON_SHELF'">库存:{{item.currentInven?item.currentInven:0}} {{item.unit}}</text>
  126. </view>
  127. <view class="flex" v-if="item.productTypeSn=='543766811373752320'" style="padding-bottom: 5px;">
  128. <u-tag :text="item.origCode" mode="light" borderColor="#ffffff" shape="circle" type="success"></u-tag>
  129. </view>
  130. <view class="flex justify_between">
  131. <view class="item-detail-text flex_1">
  132. <text class="item-price" :style="{color:!item.price?'#666':''}" v-if="showCarPrice">{{item.price?'¥'+item.price:'暂无价格'}}</text>
  133. <text class="item-price" :style="{color:!item.cost?'#666':''}" v-if="showCostPrice">{{item.cost?'¥'+item.cost:'暂无价格'}}</text>
  134. </view>
  135. <view class="item-detail-text">
  136. <u-number-box @change="updateCartNums" @blur="updateCartNums" v-model="item.qty" :index="'cart_'+item.productSn" :min="0" :max="item.currentInven||999999"></u-number-box>
  137. </view>
  138. </view>
  139. </view>
  140. </view>
  141. </view>
  142. </view>
  143. </div>
  144. </div>
  145. </div>
  146. <!-- 去认证 -->
  147. <u-popup v-model="showPopup" mode="center" :border-radius="20" closeable>
  148. <view style="background-color: #fff;padding:1rem;">
  149. <u-image width="533" height="415" src="/static/authimg.jpg"></u-image>
  150. <view style="padding-top:1rem;" class="flex justify_center">
  151. <u-button @click="toAuthStore()" shape="circle" :custom-style="{background:'#066cff',color:'#fff',width:'350rpx'}">开始认证</u-button>
  152. </view>
  153. </view>
  154. </u-popup>
  155. <!-- 价格查看 -->
  156. <u-popup v-model="showPriceModal" mode="center" length="80%" closeable>
  157. <view class="show-price-modal" v-if="tempData">
  158. <view class="itemlist">
  159. <text>产品编码</text>
  160. <text>{{tempData.code||'--'}}</text>
  161. </view>
  162. <view class="itemlist" v-if="tempData.productTypeSn=='543766811373752320'">
  163. <text>原厂编码</text>
  164. <text>{{tempData.origCode||'--'}}</text>
  165. </view>
  166. <view class="itemlist">
  167. <text>产品名称</text>
  168. <text>{{tempData.name||'--'}}</text>
  169. </view>
  170. <view v-if="tempData.affiliation=='SHELF'">
  171. <view class="itemlist" v-if="configPrice&&configPrice.shelf_cost_show == '1'">
  172. <text>进货价</text>
  173. <text>{{tempData.cost?'¥'+tempData.cost:'暂无价格'}}</text>
  174. </view>
  175. <view class="itemlist" v-if="configPrice&&configPrice.shelf_price_show == '1'">
  176. <text>车主价</text>
  177. <text>{{tempData.price?'¥'+tempData.price:'暂无价格'}}</text>
  178. </view>
  179. </view>
  180. <view v-else>
  181. <view class="itemlist" v-if="configPrice&&configPrice.non_shelf_cost_show == '1'">
  182. <text>进货价</text>
  183. <text>{{tempData.cost?'¥'+tempData.cost:'暂无价格'}}</text>
  184. </view>
  185. <view class="itemlist" v-if="configPrice&&configPrice.non_shelf_price_show == '1'">
  186. <text>车主价</text>
  187. <text>{{tempData.price?'¥'+tempData.price:'暂无价格'}}</text>
  188. </view>
  189. </view>
  190. </view>
  191. </u-popup>
  192. </view>
  193. </template>
  194. <script>
  195. import { getShelfProductList, getShelfProductType, queryPartCodeByVin, getShelfQueryList, shelfOrderFlowCreate, findShelfUserParam } from '@/api/shelf'
  196. import { scanVinLogCopy } from '@/api/car'
  197. import vinPartItem from './components/vinPartItem.vue'
  198. import otherPartItem from './components/otherPartItem.vue'
  199. export default {
  200. components:{
  201. vinPartItem,
  202. otherPartItem
  203. },
  204. data() {
  205. return {
  206. showOther: false,
  207. showPriceModal: false,
  208. theme: '',
  209. vinNumber: '',
  210. leve2Data: [], // 二级菜单数据
  211. curLeve2: '', // 当前所选二级菜单
  212. carInfo: null,
  213. status: 'loading',
  214. vinStatus: 'loading',
  215. noDataText: '暂无配件',
  216. pageNo: 1,
  217. pageSize: 10,
  218. total: 0, // 列表总数
  219. noMore: false ,// 没有更多
  220. showCart: false, // 购物车
  221. carList:[], // 车型列表
  222. partList: [], // 配件列表
  223. partListData: [], // 已选配件
  224. vinPartList: [],
  225. vinCode:[],
  226. commonPartCodeList:[],
  227. isIphoneXup: false,
  228. saveLoading: false,
  229. showPopup: false,
  230. priceShowVal: null, // 是否可以查看所有价格
  231. showCarPrice: false, // 显示车主价
  232. showCostPrice: false, // 显示成本价
  233. tempData: null // 临时数据
  234. }
  235. },
  236. computed:{
  237. modelLabel(){
  238. return this.carInfo&&this.carInfo.text||''
  239. },
  240. cartNums(){
  241. let ret = 0
  242. this.partListData.map(item => {
  243. ret = ret + item.qty
  244. })
  245. return ret
  246. },
  247. totalAmount(){
  248. let ret = 0
  249. for(let i=0;i<this.partListData.length;i++){
  250. const item = this.partListData[i]
  251. ret = ret + ((item.price||0) * item.qty)
  252. }
  253. return ret.toFixed(2)
  254. },
  255. dealerPhone(){
  256. const shelfInfo = this.$store.state.vuex_storeShelf
  257. return shelfInfo&&shelfInfo.contactMobile ? shelfInfo.contactMobile : ''
  258. },
  259. userInfo(){
  260. return this.$store.state.vuex_userInfo
  261. },
  262. storeApply(){
  263. return this.$store.state.vuex_storeAuthInfo || null
  264. },
  265. isAdmin(){
  266. return this.userInfo.superAdmin == 1
  267. },
  268. hasRedPacket(){
  269. const rule = this.$store.state.vuex_rewardRule
  270. return rule&&rule.ruleStatus == 'release'
  271. },
  272. configPrice(){
  273. return this.$store.state.vuex_configPrice
  274. },
  275. showShelfDetial(){
  276. return this.configPrice && this.configPrice.shelf_price_show == '1'&&this.configPrice.shelf_cost_show == '1'
  277. },
  278. showNonShelfDetial(){
  279. return this.configPrice && this.configPrice.non_shelf_price_show == '1'&&this.configPrice.non_shelf_cost_show == '1'
  280. }
  281. },
  282. onLoad(opts) {
  283. this.theme = getApp().globalData.theme
  284. this.vinNumber = opts.vinNumber
  285. this.carInfo = opts.carList?JSON.parse(decodeURIComponent(opts.carList)):null
  286. // 获取vin 对应code
  287. this.getCarCodeByVin()
  288. // 记录
  289. if(opts.type == 'log'){
  290. this.scanVinLogCopy()
  291. }
  292. // 游客
  293. if(this.userInfo.sysUserFlag == '0'){
  294. // 未认证
  295. if(!this.storeApply || this.storeApply&&!this.storeApply.auditStatus){
  296. this.showPopup = true
  297. }
  298. }
  299. },
  300. onShow() {
  301. this.$store.state.vuex_shelfChoosePart = []
  302. this.getShowPriceType()
  303. },
  304. methods: {
  305. getShowPriceType(){
  306. const storeShelf = this.$store.state.vuex_storeShelf
  307. if(storeShelf){
  308. findShelfUserParam({shelfSn: storeShelf?storeShelf.shelfSn:''}).then(res => {
  309. this.priceShowVal = res.data ? res.data.carOwnerPrice == '1' && res.data.purchasesPrice == '1' : false
  310. // 选中了2中价格,则从列表显示价格中取值
  311. if(this.priceShowVal){
  312. // 进货价
  313. this.showCostPrice = res.data.priceShowType == 'PURCHASES_PRICE'
  314. // 车主价
  315. this.showCarPrice = res.data.priceShowType == 'CAR_OWNER_PRICE'
  316. }else{
  317. // 进货价
  318. this.showCostPrice = res.data ? res.data.purchasesPrice == '1' : false
  319. // 车主价
  320. this.showCarPrice = res.data ? res.data.carOwnerPrice == '1' : false
  321. }
  322. })
  323. }else{
  324. this.priceShowVal = false
  325. this.showCostPrice = false
  326. this.showCarPrice = false
  327. }
  328. },
  329. // 打开价格信息弹框
  330. openPriceModal(row,type,show){
  331. console.log(row)
  332. if(this.priceShowVal&&show){
  333. if(type == 0){
  334. row.affiliation = "SHELF"
  335. }
  336. this.tempData = row
  337. this.showPriceModal = true
  338. }
  339. },
  340. scanVinLogCopy(){
  341. scanVinLogCopy({id:this.carInfo.id}).then(res => {
  342. console.log(res)
  343. })
  344. },
  345. toAuthStore(){
  346. this.showPopup = false
  347. uni.redirectTo({
  348. url: '/pages/storeManage/storeAuth'
  349. })
  350. },
  351. callPhone() {
  352. if(this.dealerPhone!=''){
  353. uni.makePhoneCall({
  354. phoneNumber: this.dealerPhone
  355. })
  356. }
  357. },
  358. viewImg(item){
  359. uni.previewImage({
  360. urls: [item.images]
  361. })
  362. },
  363. // 复制
  364. copyVin(){
  365. uni.setClipboardData({
  366. data: this.vinNumber||'',
  367. })
  368. },
  369. // 格式化标签数据和配件分类数据一样
  370. labelToPart(data){
  371. let arr = []
  372. data.map(item => {
  373. arr.push({
  374. id: item.id || item.productTypeSn,
  375. label: item.name
  376. })
  377. })
  378. return arr
  379. },
  380. getCarCodeByVin(){
  381. queryPartCodeByVin({vinNumber:this.vinNumber}).then(res => {
  382. console.log(res,'this.vinCode')
  383. const ret = res.data
  384. this.commonPartCodeList = ret.commonPartCodeList || []
  385. this.vinCode = this.commonPartCodeList.concat(ret.partCodeList||[])
  386. this.getShelfProductType()
  387. })
  388. },
  389. // 获取数字货架分类作为二级分类
  390. getShelfProductType(){
  391. const storeShelf = this.$store.state.vuex_storeShelf
  392. getShelfProductType({
  393. codeList: this.vinCode,
  394. shelfSn: storeShelf?storeShelf.shelfSn:''
  395. }).then(res => {
  396. // console.log(res,'getShelfProductType')
  397. this.leve2Data = this.labelToPart(res.data || [])
  398. // 默认该车适用或全部
  399. this.selLeve2('all')
  400. })
  401. },
  402. // 单击二级菜单
  403. selLeve2 (v) {
  404. this.pageNo = 1
  405. this.partList = []
  406. this.vinPartList = []
  407. this.curLeve2 = v
  408. if(this.vinNumber){
  409. this.getVinShelfPartList()
  410. }
  411. this.getShelfProductList()
  412. },
  413. // 获取数字货架配件列表
  414. getShelfProductList(){
  415. const _this = this
  416. let params = {
  417. pageNo: this.pageNo,
  418. pageSize: this.pageSize,
  419. excludeCodeList: this.vinCode,
  420. productTypeSn: this.curLeve2 == 'all' ? '' : this.curLeve2
  421. }
  422. _this.status = 'loading'
  423. getShelfProductList(params).then(res => {
  424. console.log(res,'获取数字货架配件列表')
  425. uni.hideLoading()
  426. if(res.status == 200){
  427. let list = res.data.list
  428. if (list && list.length){
  429. // 分页 拼接数据
  430. if (_this.pageNo != 1) {
  431. _this.partList = _this.partList ? _this.partList.concat(this.fiterChecked(list)) : this.fiterChecked(list)
  432. } else {
  433. _this.partList = this.fiterChecked(list)
  434. }
  435. this.total = res.data.count
  436. if (_this.partList.length == res.data.count) {
  437. _this.status = 'nomore'
  438. } else {
  439. _this.status = 'loadmore'
  440. }
  441. } else {
  442. _this.partList = list || []
  443. this.total = 0
  444. _this.status = 'nomore'
  445. }
  446. _this.noDataText = '暂无配件'
  447. }else{
  448. _this.status = 'loadmore'
  449. _this.partList = []
  450. this.total = 0
  451. _this.noDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
  452. }
  453. })
  454. },
  455. // 根据客户vin查询该车可用数字货架中的配件
  456. getVinShelfPartList(){
  457. let params = {
  458. queryWord: this.queryWord,
  459. productTypeSn: this.curLeve2 == 'all' ? '' : this.curLeve2,
  460. codeList: this.vinCode
  461. }
  462. uni.showLoading({
  463. title: '加载中',
  464. mask: true
  465. })
  466. this.vinStatus = 'loading'
  467. getShelfQueryList(params).then(res => {
  468. this.vinPartList = this.fiterChecked(res.data || [])
  469. this.vinStatus = 'nomore'
  470. uni.hideLoading()
  471. })
  472. },
  473. // 过滤已选择的
  474. fiterChecked (list){
  475. this.partListData.map(item => {
  476. let p = list.find(k => {
  477. return k.productSn == item.productSn
  478. })
  479. if (p){
  480. p.checked = true
  481. p.qty = item.qty
  482. }
  483. })
  484. return list
  485. },
  486. // 加载更多
  487. onreachBottom () {
  488. if(this.partList.length < this.total && this.showOther){
  489. this.pageNo++
  490. this.getShelfProductList()
  491. }else{
  492. this.status = "nomore"
  493. }
  494. },
  495. // 添加到购物车
  496. addPart(item,type){
  497. if(type == 'vin'){
  498. const idx = this.vinPartList.findIndex(k => k.id == item.id)
  499. this.vinPartList[idx].checked = true
  500. this.vinPartList[idx].qty = 1
  501. this.vinPartList.splice()
  502. }else{
  503. const idx = this.partList.findIndex(k => k.id == item.id)
  504. this.partList[idx].checked = true
  505. this.partList[idx].qty = 1
  506. this.partList.splice()
  507. }
  508. // 已选列表
  509. this.partListData.unshift({
  510. id: item.id,
  511. productSn: item.productSn,
  512. name: item.name,
  513. unit: item.unit,
  514. price: item.price,
  515. cost: item.cost,
  516. currentInven: item.currentInven,
  517. code: item.code,
  518. origCode: item.origCode,
  519. qty: 1,
  520. productTypeSn: item.productTypeSn,
  521. images: item.images,
  522. checked: true,
  523. affiliation: item.affiliation
  524. })
  525. },
  526. // 更新配件列表数量
  527. updatePartList(data,type){
  528. const prow = this[type].find(item => item.productSn == data.index)
  529. const index = this.partListData.findIndex(item => item.productSn == data.index)
  530. // 删除
  531. if(!data.value){
  532. prow.checked = false
  533. if(index>=0){
  534. this.partListData.splice(index,1)
  535. }
  536. if(this.partListData.length==0){
  537. this.showCart = false
  538. }
  539. }else{
  540. this.partListData[index].qty = data.value
  541. this.partListData.splice()
  542. }
  543. },
  544. // 修改适配配件上数量
  545. updateVinNums(data){
  546. this.updatePartList(data,'vinPartList')
  547. },
  548. // 修改其它配件上的数量
  549. updateNums(data){
  550. this.updatePartList(data,'partList')
  551. },
  552. // 点击购物车修改数量
  553. updateCartNums(data){
  554. console.log(data)
  555. if(!data.value){
  556. const index = this.partListData.findIndex(item => 'cart_'+item.productSn == data.index)
  557. if(index>=0){
  558. this.partListData.splice(index,1)
  559. }
  560. if(this.partListData.length==0){
  561. this.showCart = false
  562. }
  563. }
  564. // 同步更新Vin适配配件列表上的
  565. const vinprow = this.vinPartList.find(item => 'cart_'+item.productSn == data.index)
  566. if(vinprow){
  567. vinprow.qty = data.value
  568. vinprow.checked = !!data.value
  569. this.vinPartList.splice()
  570. }
  571. // 同步更新其它配件列表上的
  572. const prow = this.partList.find(item => 'cart_'+item.productSn == data.index)
  573. if(prow){
  574. prow.qty = data.value
  575. prow.checked = !!data.value
  576. this.partList.splice()
  577. }
  578. },
  579. // 打开购物车
  580. openCart(){
  581. if(this.partListData.length){
  582. this.showCart=!this.showCart
  583. }else{
  584. uni.showToast({
  585. icon: 'none',
  586. title: '请选择配件'
  587. })
  588. }
  589. },
  590. // 格式化数据
  591. formatData(){
  592. const partList = []
  593. const tempList = []
  594. this.partListData.map(item => {
  595. if(item.currentInven){
  596. partList.push({
  597. "productSn": item.productSn,
  598. "totalQty": item.qty
  599. })
  600. }else{
  601. tempList.push({
  602. "productSn": item.productSn,
  603. "qty": item.qty,
  604. // "price": item.cost
  605. })
  606. }
  607. })
  608. return [partList,tempList]
  609. },
  610. // 立即提交
  611. submitForm(){
  612. // 游客去认证
  613. if(this.userInfo.sysUserFlag == '0'){
  614. // 未认证
  615. if(!this.storeApply || this.storeApply&&(!this.storeApply.auditStatus || this.storeApply.auditStatus == 'REFUSE')){
  616. this.showPopup = true
  617. }
  618. // 认证通过
  619. if(this.storeApply&&this.storeApply.auditStatus=='WAIT'){
  620. uni.showModal({
  621. title: '提示',
  622. content: '门店认证资料审核中,请耐心等待!',
  623. confirmText: '好的',
  624. showCancel: false
  625. })
  626. }
  627. }else{
  628. const storeShelf = this.$store.state.vuex_storeShelf
  629. if(!storeShelf){
  630. uni.showToast({
  631. icon: 'none',
  632. title: '您还未开通数字货架,暂时无法使用'
  633. })
  634. return
  635. }
  636. // 已认证用户
  637. if(this.partListData.length==0){
  638. uni.showToast({
  639. icon: 'none',
  640. title: '请选择配件'
  641. })
  642. return
  643. }
  644. // 开始提交
  645. const params = {
  646. shelfOrderDetailList: this.formatData()[0],
  647. tempBillDetailList: this.formatData()[1],
  648. vin: this.vinNumber,
  649. vehicleModel: this.modelLabel || '',
  650. vehicleLogo: this.carInfo.icon||'',
  651. billSource: 'vin'
  652. }
  653. console.log(params,'立即提交')
  654. this.saveLoading = true
  655. shelfOrderFlowCreate(params).then(res => {
  656. console.log(res,'shelfOrderFlowCreate')
  657. if(res.status == 200){
  658. // 提交成功
  659. uni.redirectTo({
  660. url:"/pagesA/digitalShelf/choosePartResult?data="+encodeURIComponent(JSON.stringify(res.data))+"&state=1"
  661. })
  662. }else{
  663. // 或失败
  664. uni.redirectTo({
  665. url:"/pagesA/digitalShelf/choosePartResult?data="+encodeURIComponent(JSON.stringify({shelfOrder:{remindMessage:res.message}}))+"&state=0"
  666. })
  667. }
  668. this.saveLoading = false
  669. })
  670. }
  671. },
  672. }
  673. }
  674. </script>
  675. <style lang="less">
  676. .choosePartByVin{
  677. height: 100vh;
  678. .cpb_header{
  679. background-color: #FFFFFF;
  680. padding: 10rpx;
  681. align-items: center;
  682. > div{
  683. padding: 10rpx;
  684. align-items: center;
  685. &:first-child{
  686. padding-right: 20rpx;
  687. }
  688. > div{
  689. &:first-child{
  690. padding-right: 20rpx;
  691. flex-grow: 1;
  692. color: #818b94;
  693. font-size: 24rpx;
  694. }
  695. }
  696. }
  697. .copyText{
  698. background-color: #EBEBEB;
  699. border-radius: 100rpx;
  700. padding: 0 20rpx;
  701. color: #033692;
  702. font-size: 20rpx;
  703. display: flex;
  704. align-items: center;
  705. justify-content: center;
  706. margin-left: 20rpx;
  707. }
  708. .carTits{
  709. font-size: 32rpx;
  710. font-weight: bold;
  711. color: #222222;
  712. line-height: normal;
  713. margin-bottom: 10rpx;
  714. flex-grow: 1;
  715. }
  716. .qhbtns{
  717. display: flex;
  718. align-items: center;
  719. justify-content: center;
  720. font-size: 20rpx;
  721. color: #0485F6;
  722. border:2rpx solid #0485F6;
  723. border-radius: 50rpx;
  724. background: rgba(88, 177, 255, 0.2);
  725. width: 200rpx;
  726. height: 36rpx;
  727. margin-left: 10rpx;
  728. }
  729. }
  730. .show-price-modal{
  731. padding: 30px 20px;
  732. .itemlist{
  733. display: flex;
  734. align-items: center;
  735. justify-content: space-between;
  736. > text{
  737. &:last-child{
  738. color: #999;
  739. width: 70%;
  740. display: block;
  741. }
  742. }
  743. border-bottom: 1px solid #eee;
  744. padding: 10px;
  745. }
  746. }
  747. .cpb_middle{
  748. flex-grow: 1;
  749. padding-top: 10rpx;
  750. overflow: auto;
  751. .slider-bar{
  752. width: 25%;
  753. background: #F5F6F7;
  754. height: 100%;
  755. overflow: auto;
  756. .tabs{
  757. > view{
  758. border-left: 6rpx solid #F5F6F7;
  759. padding: 20rpx 10rpx;
  760. font-size: 28rpx;
  761. color: #666E75;
  762. text-align: center;
  763. }
  764. .active{
  765. border-color: #0485F6;
  766. color: #0485F6;
  767. background: #fff;
  768. }
  769. }
  770. }
  771. .right-list{
  772. position: relative;
  773. flex-grow: 1;
  774. background: #fff;
  775. height: 100%;
  776. width: 75%;
  777. .right-list-content{
  778. height: 100%;
  779. .nav-right-title{
  780. font-weight: bold;
  781. padding: 20upx 25upx;
  782. border-bottom: 2rpx solid #eee;
  783. > text{
  784. color: #9E9E9E;
  785. font-weight: normal;
  786. }
  787. }
  788. .nav-right-item{
  789. padding: 15upx 25upx;
  790. border-bottom: 2rpx solid #f5f5f5;
  791. .item-info{
  792. padding-left: 20upx;
  793. flex-grow: 1;
  794. .item-name{
  795. font-size: 30upx;
  796. color: #191919;
  797. display: flex;
  798. align-items: center;
  799. >image{
  800. width: 38rpx;
  801. height: 38rpx;
  802. margin-right: 10rpx;
  803. }
  804. >text{
  805. flex: 1;
  806. word-break: break-all;
  807. }
  808. }
  809. .item-detail{
  810. .item-detail-info{
  811. padding: 10upx 0 4upx;
  812. /deep/ .u-tag{
  813. word-break: break-all;
  814. font-size: 28rpx;
  815. color: #0fab04eee;
  816. border: 0;
  817. padding: 0.2rem 0.3rem;
  818. }
  819. > view{
  820. padding-bottom: 10rpx;
  821. align-items: center;
  822. .item-detail-text{
  823. color: #999;
  824. .phtxt{
  825. color: #0485F6;
  826. font-size: 28upx;
  827. }
  828. .item-price{
  829. color: #FB1E1E;
  830. font-size: 28upx;
  831. }
  832. }
  833. }
  834. }
  835. }
  836. }
  837. }
  838. }
  839. }
  840. }
  841. .cpb_footer{
  842. padding: 20rpx;
  843. background-color: #fff;
  844. align-items: center;
  845. justify-content: space-between;
  846. .cpb_cart{
  847. width: 84rpx;
  848. height: 84rpx;
  849. background-color: #0485F6;
  850. border-radius: 200rpx;
  851. display: flex;
  852. align-items: center;
  853. justify-content: center;
  854. position: relative;
  855. }
  856. > div{
  857. &:last-child{
  858. width: 40%;
  859. }
  860. }
  861. }
  862. .cpb_cart-mask{
  863. position: fixed;
  864. width: 100%;
  865. background: rgba(0,0,0,0.5);
  866. z-index: 900;
  867. bottom: 120rpx;
  868. top: 0;
  869. }
  870. .cpb_cart-box{
  871. background-color: #fff;
  872. position: absolute;
  873. width: 100%;
  874. z-index: 1000;
  875. bottom: 0;
  876. padding: 0;
  877. border-radius: 30rpx 30rpx 0 0;
  878. max-height: 70vh;
  879. display: flex;
  880. flex-direction: column;
  881. .cpb_close{
  882. position: absolute;
  883. top: 10rpx;
  884. right: 20rpx;
  885. width: 70rpx;
  886. height: 70rpx;
  887. font-size: 32rpx;
  888. color: #999;
  889. }
  890. .cpb_cart-tit{
  891. text-align: center;
  892. padding: 20rpx;
  893. font-size: 36rpx;
  894. border-bottom: 1px solid #eee;
  895. }
  896. .cpb_cart-list{
  897. padding: 20rpx 30rpx;
  898. overflow: auto;
  899. flex-grow: 1;
  900. > view{
  901. margin-bottom: 20rpx;
  902. border-bottom:2rpx solid #eee;
  903. }
  904. .item-name{
  905. font-size: 30rpx;
  906. margin-bottom: 5px;
  907. .item-tempPart{
  908. background: #0055ff;
  909. color: #fff;
  910. border-radius: 1em;
  911. font-size: 0.8em;
  912. padding: 0 0.5em;
  913. }
  914. }
  915. .item-info{
  916. flex-grow: 1;
  917. padding-left: 0.8em;
  918. }
  919. .item-detail{
  920. .item-detail-info{
  921. padding: 10upx 0 4upx;
  922. /deep/ .u-tag{
  923. word-break: break-all;
  924. font-size: 28rpx;
  925. color: #0fab04eee;
  926. border: 0;
  927. padding: 0.2rem 0.3rem;
  928. }
  929. > view{
  930. padding-bottom: 20rpx;
  931. align-items: center;
  932. .item-detail-text{
  933. color: #999;
  934. .phtxt{
  935. color: #0485F6;
  936. font-size: 28upx;
  937. }
  938. .item-price{
  939. color: #FB1E1E;
  940. font-size: 28upx;
  941. }
  942. }
  943. }
  944. }
  945. }
  946. }
  947. }
  948. }
  949. </style>