choosePart.vue 25 KB

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