choosePart.vue 25 KB

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