123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957 |
- <template>
- <view class="flex flex_column choosePartByVin">
- <!-- 头部车辆信息 -->
- <div class="flex align-center cpb_header" v-if="carInfo">
- <div>
- <u-image border-radius="30" :src="carInfo.icon" width="100" height="100" bg-color="#EBEBEB" ></u-image>
- </div>
- <div>
- <div class="flex align-center">
- <div class="carTits ellipsis-two">{{modelLabel||''}}</div>
- </div>
- <div class="flex align-center">
- <div>VIN码:{{vinNumber}}</div>
- <div class="copyText" @click="copyVin"><span>复制</span></div>
- </div>
- <view style="font-size: 0.8em;color: dodgerblue;margin-top: 0.5em;" v-if="dealerPhone" @click="callPhone()">
- <u-icon size="30" name="phone" color="dodgerblue"></u-icon><text>联系汽配商</text>
- </view>
- </div>
- </div>
- <!-- 配件列表 -->
- <div class="cpb_middle flex">
- <div class="slider-bar">
- <div class="tabs">
- <view :class="[curLeve2 == 'all' ? 'active' : '']" @click="selLeve2('all')">
- 全部
- </view>
- <view :class="[curLeve2 == item.id ? 'active' : '']" v-for="(item, index) in leve2Data" :key="index" @click="selLeve2(item.id)">
- {{item.label}}
- </view>
- </div>
- </div>
- <div class="right-list">
- <scroll-view
- class="right-list-content"
- scroll-y
- @scrolltolower="onreachBottom">
- <!-- vin适配配件 -->
- <view>
- <view class="nav-right-title">适配推荐</view>
- <view class="nav-right-item flex" v-for="(item, index) in vinPartList" :key="item.productSn">
- <view class="uni-col-2">
- <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>
- </view>
- <view class="item-info uni-col-10">
- <view class="item-name">
- <text>{{item.name}}</text>
- </view>
- <view class="item-detail">
- <view class="item-detail-info">
- <view class="flex justify_between">
- <view>
- <text class="item-detail-text flex_1">{{item.code}}</text>
- <u-tag v-if="commonPartCodeList.includes(item.code)" size="mini" style="margin-left: 5px;" text="通用" mode="light" shape="circle" type="success"></u-tag>
- </view>
- <text class="item-detail-text" v-if="item.affiliation=='SHELF'">库存:{{item.currentInven?item.currentInven:0}} {{item.unit}}</text>
- </view>
- <view class="flex" v-if="item.productTypeSn=='543766811373752320'">
- <text class="item-detail-text" style="width: 4.5rem;">原厂编码:</text>
- <view style="width: 50%;flex-grow: 1;">
- <u-tag :text="item.origCode" mode="light" borderColor="#ffffff" type="warning" size="large"></u-tag>
- </view>
- </view>
- <view class="flex justify_between">
- <view class="item-detail-text flex_1">
- <view @click="openPriceModal(item,1)">
- <text class="item-price" :style="{color:!item.price?'#666':''}" v-if="showCarPrice">{{item.price?'¥'+item.price:'暂无价格'}}</text>
- <text class="item-price" :style="{color:!item.cost?'#666':''}" v-if="showCostPrice&&item.affiliation=='SHELF'">{{item.cost?'¥'+item.cost:'暂无价格'}}</text>
- <u-icon name="arrow-right" v-if="priceShowVal"></u-icon>
- </view>
- </view>
- <view class="item-detail-text" v-if="item.currentInven">
- <u-button shape="circle" @click="addPart(item)" v-if="!item.checked" :custom-style="{width:'48upx',height:'48upx'}" type="primary" size="mini">
- <u-icon name="plus" color="#fff" size="28"></u-icon>
- </u-button>
- <u-number-box v-else @change="updateVinNums" @blur="updateVinNums" v-model="item.qty" :index="item.productSn" :min="0" :max="item.currentInven"></u-number-box>
- </view>
- <view class="item-detail-text" v-if="item.affiliation=='SUPER_CATALOGUE'||!item.currentInven">
- <text v-if="!item.checked" @click="addPart(item)" class="phtxt">我要急送</text>
- <u-number-box v-else @change="updateVinNums" @blur="updateVinNums" v-model="item.qty" :index="item.productSn" :min="0"></u-number-box>
- </view>
- </view>
- </view>
- <view class="nav-right-item-btns flex align_center justify_between">
- <view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view v-if="vinPartList&&vinPartList.length==0">
- <u-empty v-if="vinStatus!='loading'" :src="`/static/nodata.png`" icon-size="180" text="暂无适配推荐" mode="list" :margin-top="30"></u-empty>
- </view>
- <view style="padding: 20upx;">
- <u-loadmore v-if="vinStatus=='loading'" :status="vinStatus" />
- </view>
- </view>
- <!-- 其它配件 -->
- <view class="nav-right-title flex align_center justify_between" @click="showOther=!showOther">
- 其它配件
- <text>{{showOther?'隐藏':'展开'}}</text>
- </view>
- <view class="nav-right-item flex" v-if="showOther" v-for="(item, index) in partList" :key="item.productSn">
- <view class="uni-col-2">
- <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>
- </view>
- <view class="item-info uni-col-10">
- <view class="item-name">
- <text>{{item.name}}</text>
- </view>
- <view class="item-detail">
- <view class="item-detail-info">
- <view class="flex justify_between">
- <text class="item-detail-text flex_1">{{item.code}}</text>
- <text class="item-detail-text">库存:{{item.currentInven?item.currentInven:0}} {{item.unit}}</text>
- </view>
- <view class="flex" v-if="item.productTypeSn=='543766811373752320'">
- <text class="item-detail-text" style="width: 4.5rem;">原厂编码:</text>
- <view style="width: 50%;flex-grow: 1;">
- <u-tag :text="item.origCode" mode="light" borderColor="#ffffff" type="warning" size="large"></u-tag>
- </view>
- </view>
- <view class="flex justify_between">
- <view class="item-detail-text flex_1" @click="openPriceModal(item,0)">
- <text class="item-price" :style="{color:!item.price?'#666':''}" v-if="showCarPrice">{{item.price?'¥'+item.price:'暂无价格'}}</text>
- <text class="item-price" :style="{color:!item.cost?'#666':''}" v-if="showCostPrice">{{item.cost?'¥'+item.cost:'暂无价格'}}</text>
- <u-icon name="arrow-right" v-if="priceShowVal"></u-icon>
- </view>
- <view class="item-detail-text" v-if="item.currentInven">
- <u-button shape="circle" @click="addPart(item)" v-if="!item.checked" :custom-style="{width:'48upx',height:'48upx',background:'#066cff'}" type="primary" size="mini">
- <u-icon name="plus" color="#fff" size="28"></u-icon>
- </u-button>
- <u-number-box v-else @change="updateNums" @blur="updateNums" v-model="item.qty" :index="item.productSn" :min="0" :max="item.currentInven"></u-number-box>
- </view>
- <view class="item-detail-text" v-else>
- <text @click="addPart(item)" v-if="!item.checked" class="phtxt">我要急送</text>
- <u-number-box v-else @change="updateNums" @blur="updateNums" v-model="item.qty" :index="item.productSn" :min="0"></u-number-box>
- </view>
- </view>
- </view>
- <view class="nav-right-item-btns flex align_center justify_between">
- <view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view v-if="partList&&partList.length==0">
- <u-empty v-if="status!='loading'" :src="`/static/nodata.png`" icon-size="180" :text="noDataText" mode="list" :margin-top="150"></u-empty>
- </view>
- <view style="padding: 20upx;" v-if="showOther">
- <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
- </view>
- </scroll-view>
- </div>
- </div>
- <!-- 底部提交按钮 -->
- <div class="cpb_footer flex align-center" :class="isIphoneXup?'isIPXup':''">
- <div>
- <div class="cpb_cart" @click="openCart">
- <u-badge type="error" :count="cartNums" :offset="[-4,-4]" bgColor="#FF5200"></u-badge>
- <u-image width="44" height="44" :src="`/static/icon_shopping@3x.png`"></u-image>
- </div>
- </div>
- <view v-if="(showCarPrice||showCostPrice)&&totalAmount">
- <!-- 合计:<text>¥{{totalAmount}}</text> -->
- </view>
- <div>
- <u-button type="primary" :loading="saveLoading" @click="submitForm" :custom-style="{background:'#066cff',fontSize:'32rpx'}" shape="circle">确认拿货</u-button>
- </div>
- </div>
- <!-- 已选配件 购物车 -->
- <div class="cpb_cart-mask" v-if="showCart">
- <div class="cpb_cart-box">
- <div class="cpb_close flex align-center justify_center" @click="showCart=false"><u-icon name="close"></u-icon></div>
- <div class="cpb_cart-tit">
- 已选配件
- </div>
- <div class="cpb_cart-list">
- <view class="nav-right-item flex" v-for="(item, index) in partListData" :key="item.productSn">
- <view class="uni-col-2">
- <u-image border-radius="30" :src="item.images" width="100" height="100" bg-color="#EBEBEB" ></u-image>
- </view>
- <view class="item-info uni-col-10">
- <view class="item-name">
- <text class="item-tempPart" v-if="!item.currentInven">急送</text>
- <text>{{item.name}}</text>
- </view>
- <view class="item-detail">
- <view class="item-detail-info">
- <view class="flex justify_between">
- <text class="item-detail-text flex_1">{{item.code}}</text>
- <text class="item-detail-text" v-if="item.affiliation!='SUPER_CATALOGUE'">库存:{{item.currentInven?item.currentInven:0}} {{item.unit}}</text>
- </view>
- <view class="flex" v-if="item.productTypeSn=='543766811373752320'" style="padding-bottom: 5px;">
- <text class="item-detail-text" style="width: 4.5rem;">原厂编码:</text>
- <view style="width: 50%;flex-grow: 1;">
- <u-tag :text="item.origCode" mode="light" borderColor="#ffffff" type="warning" size="large"></u-tag>
- </view>
- </view>
- <view class="flex justify_between">
- <view class="item-detail-text flex_1">
- <text class="item-price" :style="{color:!item.price?'#666':''}" v-if="showCarPrice">{{item.price?'¥'+item.price:'暂无价格'}}</text>
- <text class="item-price" :style="{color:!item.cost?'#666':''}" v-if="showCostPrice">{{item.cost?'¥'+item.cost:'暂无价格'}}</text>
- </view>
- <view class="item-detail-text">
- <u-number-box @change="updateCartNums" @blur="updateCartNums" v-model="item.qty" :index="'cart_'+item.productSn" :min="0" :max="item.currentInven||999999"></u-number-box>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </div>
- </div>
- </div>
- <!-- 去认证 -->
- <u-popup v-model="showPopup" mode="center" :border-radius="20" closeable>
- <view style="background-color: #fff;padding:1rem;">
- <u-image width="533" height="415" src="/static/authimg.jpg"></u-image>
- <view style="padding-top:1rem;" class="flex justify_center">
- <u-button @click="toAuthStore()" shape="circle" :custom-style="{background:'#066cff',color:'#fff',width:'350rpx'}">开始认证</u-button>
- </view>
- </view>
- </u-popup>
- <!-- 价格查看 -->
- <u-popup v-model="showPriceModal" mode="center" length="80%" closeable>
- <view class="show-price-modal" v-if="tempData">
- <view>
- <text>产品编码</text>
- <text>{{tempData.code||'--'}}</text>
- </view>
- <view v-if="tempData.productTypeSn=='543766811373752320'">
- <text>原厂编码</text>
- <text>{{tempData.origCode||'--'}}</text>
- </view>
- <view>
- <text>产品名称</text>
- <text>{{tempData.name||'--'}}</text>
- </view>
- <view v-if="tempData.affiliation=='SHELF'">
- <text>进货价</text>
- <text>{{tempData.cost?'¥'+tempData.cost:'暂无价格'}}</text>
- </view>
- <view>
- <text>车主价</text>
- <text>{{tempData.price?'¥'+tempData.price:'暂无价格'}}</text>
- </view>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import { getShelfProductList, getShelfProductType, queryPartCodeByVin, getShelfQueryList, shelfOrderFlowCreate, findShelfUserParam } from '@/api/shelf'
- import { scanVinLogCopy } from '@/api/car'
- export default {
- data() {
- return {
- showOther: false,
- showPriceModal: false,
- theme: '',
- vinNumber: '',
- leve2Data: [], // 二级菜单数据
- curLeve2: '', // 当前所选二级菜单
- carInfo: null,
- status: 'loading',
- vinStatus: 'loading',
- noDataText: '暂无配件',
- pageNo: 1,
- pageSize: 10,
- total: 0, // 列表总数
- noMore: false ,// 没有更多
- showCart: false, // 购物车
- carList:[], // 车型列表
- partList: [], // 配件列表
- partListData: [], // 已选配件
- vinPartList: [],
- vinCode:[],
- commonPartCodeList:[],
- isIphoneXup: false,
- saveLoading: false,
- showPopup: false,
- priceShowVal: null, // 是否可以查看所有价格
- showCarPrice: false, // 显示车主价
- showCostPrice: false, // 显示成本价
- tempData: null // 临时数据
- }
- },
- computed:{
- modelLabel(){
- return this.carInfo&&this.carInfo.text||''
- },
- cartNums(){
- let ret = 0
- this.partListData.map(item => {
- ret = ret + item.qty
- })
- return ret
- },
- totalAmount(){
- let ret = 0
- for(let i=0;i<this.partListData.length;i++){
- const item = this.partListData[i]
- ret = ret + ((item.price||0) * item.qty)
- }
- return ret.toFixed(2)
- },
- dealerPhone(){
- const shelfInfo = this.$store.state.vuex_storeShelf
- return shelfInfo&&shelfInfo.contactMobile ? shelfInfo.contactMobile : ''
- },
- userInfo(){
- return this.$store.state.vuex_userInfo
- },
- storeApply(){
- return this.$store.state.vuex_storeAuthInfo || null
- },
- isAdmin(){
- return this.userInfo.superAdmin == 1
- },
- hasRedPacket(){
- const rule = this.$store.state.vuex_rewardRule
- return rule&&rule.ruleStatus == 'release'
- }
- },
- onLoad(opts) {
- this.theme = getApp().globalData.theme
- this.vinNumber = opts.vinNumber
- this.carInfo = opts.carList?JSON.parse(decodeURIComponent(opts.carList)):null
- // 获取vin 对应code
- this.getCarCodeByVin()
- // 记录
- if(opts.type == 'log'){
- this.scanVinLogCopy()
- }
- // 游客
- if(this.userInfo.sysUserFlag == '0'){
- // 未认证
- if(!this.storeApply || this.storeApply&&!this.storeApply.auditStatus){
- this.showPopup = true
- }
- }
- },
- onShow() {
- this.$store.state.vuex_shelfChoosePart = []
- this.getShowPriceType()
- },
- methods: {
- getShowPriceType(){
- const storeShelf = this.$store.state.vuex_storeShelf
- findShelfUserParam({shelfSn: storeShelf?storeShelf.shelfSn:''}).then(res => {
- this.priceShowVal = res.data ? res.data.carOwnerPrice == '1' && res.data.purchasesPrice == '1' : false
- // 选中了2中价格,则从列表显示价格中取值
- if(this.priceShowVal){
- // 进货价
- this.showCostPrice = res.data.priceShowType == 'PURCHASES_PRICE'
- // 车主价
- this.showCarPrice = res.data.priceShowType == 'CAR_OWNER_PRICE'
- }else{
- // 进货价
- this.showCostPrice = res.data ? res.data.purchasesPrice == '1' : false
- // 车主价
- this.showCarPrice = res.data ? res.data.carOwnerPrice == '1' : false
- }
- })
- },
- // 打开价格信息弹框
- openPriceModal(row,type){
- console.log(row)
- if(this.priceShowVal){
- if(type == 0){
- row.affiliation = "SHELF"
- }
- this.tempData = row
- this.showPriceModal = true
- }
- },
- scanVinLogCopy(){
- scanVinLogCopy({id:this.carInfo.id}).then(res => {
- console.log(res)
- })
- },
- toAuthStore(){
- this.showPopup = false
- uni.redirectTo({
- url: '/pages/storeManage/storeAuth'
- })
- },
- callPhone() {
- if(this.dealerPhone!=''){
- uni.makePhoneCall({
- phoneNumber: this.dealerPhone
- })
- }
- },
- viewImg(item){
- uni.previewImage({
- urls: [item.images]
- })
- },
- // 复制
- copyVin(){
- uni.setClipboardData({
- data: this.vinNumber||'',
- })
- },
- // 格式化标签数据和配件分类数据一样
- labelToPart(data){
- let arr = []
- data.map(item => {
- arr.push({
- id: item.id || item.productTypeSn,
- label: item.name
- })
- })
- return arr
- },
- getCarCodeByVin(){
- queryPartCodeByVin({vinNumber:this.vinNumber}).then(res => {
- console.log(res,'this.vinCode')
- const ret = res.data
- this.commonPartCodeList = ret.commonPartCodeList || []
- this.vinCode = this.commonPartCodeList.concat(ret.partCodeList||[])
- this.getShelfProductType()
- })
- },
- // 获取数字货架分类作为二级分类
- getShelfProductType(){
- const storeShelf = this.$store.state.vuex_storeShelf
- getShelfProductType({
- codeList: this.vinCode,
- shelfSn: storeShelf?storeShelf.shelfSn:''
- }).then(res => {
- console.log(res,'getShelfProductType')
- this.leve2Data = this.labelToPart(res.data || [])
- // 默认该车适用或全部
- this.selLeve2('all')
- })
- },
- // 单击二级菜单
- selLeve2 (v) {
- this.pageNo = 1
- this.partList = []
- this.vinPartList = []
- this.curLeve2 = v
- if(this.vinNumber){
- this.getVinShelfPartList()
- }
- this.getShelfProductList()
- },
- // 获取数字货架配件列表
- getShelfProductList(){
- const _this = this
- let params = {
- pageNo: this.pageNo,
- pageSize: this.pageSize,
- excludeCodeList: this.vinCode,
- productTypeSn: this.curLeve2 == 'all' ? '' : this.curLeve2
- }
- _this.status = 'loading'
- getShelfProductList(params).then(res => {
- console.log(res,'获取数字货架配件列表')
- uni.hideLoading()
- if(res.status == 200){
- let list = res.data.list
- if (list && list.length){
- // 分页 拼接数据
- if (_this.pageNo != 1) {
- _this.partList = _this.partList ? _this.partList.concat(this.fiterChecked(list)) : this.fiterChecked(list)
- } else {
- _this.partList = this.fiterChecked(list)
- }
- this.total = res.data.count
- if (_this.partList.length == res.data.count) {
- _this.status = 'nomore'
- } else {
- _this.status = 'loadmore'
- }
- } else {
- _this.partList = list || []
- this.total = 0
- _this.status = 'nomore'
- }
- _this.noDataText = '暂无配件'
- }else{
- _this.status = 'loadmore'
- _this.partList = []
- this.total = 0
- _this.noDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
- }
- })
- },
- // 根据客户vin查询该车可用数字货架中的配件
- getVinShelfPartList(){
- let params = {
- queryWord: this.queryWord,
- productTypeSn: this.curLeve2 == 'all' ? '' : this.curLeve2,
- codeList: this.vinCode
- }
- this.vinStatus = 'loading'
- getShelfQueryList(params).then(res => {
- this.vinPartList = this.fiterChecked(res.data || [])
- this.vinStatus = 'nomore'
- })
- },
- // 过滤已选择的
- fiterChecked (list){
- this.partListData.map(item => {
- let p = list.find(k => {
- return k.productSn == item.productSn
- })
- if (p){
- p.checked = true
- p.qty = item.qty
- }
- })
- return list
- },
- // 加载更多
- onreachBottom () {
- if(this.partList.length < this.total && this.showOther){
- this.pageNo++
- this.getShelfProductList()
- }else{
- this.status = "nomore"
- }
- },
- // 添加到购物车
- addPart(item){
- item.checked = true
- item.qty = 1
- this.partListData.unshift({
- id: item.id,
- productSn: item.productSn,
- name: item.name,
- unit: item.unit,
- price: item.price,
- cost: item.cost,
- currentInven: item.currentInven,
- code: item.code,
- origCode: item.origCode,
- qty: item.qty,
- productTypeSn: item.productTypeSn,
- images: item.images,
- checked: true,
- affiliation: item.affiliation
- })
- },
- // 更新配件列表数量
- updatePartList(data,type){
- const prow = this[type].find(item => item.productSn == data.index)
- const index = this.partListData.findIndex(item => item.productSn == data.index)
- // 删除
- if(!data.value){
- prow.checked = false
- if(index>=0){
- this.partListData.splice(index,1)
- }
- if(this.partListData.length==0){
- this.showCart = false
- }
- }else{
- this.partListData[index].qty = data.value
- this.partListData.splice()
- }
- },
- // 修改适配配件上数量
- updateVinNums(data){
- this.updatePartList(data,'vinPartList')
- },
- // 修改其它配件上的数量
- updateNums(data){
- this.updatePartList(data,'partList')
- },
- // 点击购物车修改数量
- updateCartNums(data){
- console.log(data)
- if(!data.value){
- const index = this.partListData.findIndex(item => 'cart_'+item.productSn == data.index)
- if(index>=0){
- this.partListData.splice(index,1)
- }
- if(this.partListData.length==0){
- this.showCart = false
- }
- }
- // 同步更新Vin适配配件列表上的
- const vinprow = this.vinPartList.find(item => 'cart_'+item.productSn == data.index)
- if(vinprow){
- vinprow.qty = data.value
- vinprow.checked = !!data.value
- this.vinPartList.splice()
- }
- // 同步更新其它配件列表上的
- const prow = this.partList.find(item => 'cart_'+item.productSn == data.index)
- if(prow){
- prow.qty = data.value
- prow.checked = !!data.value
- this.partList.splice()
- }
- },
- // 打开购物车
- openCart(){
- if(this.partListData.length){
- this.showCart=!this.showCart
- }else{
- uni.showToast({
- icon: 'none',
- title: '请选择配件'
- })
- }
- },
- // 格式化数据
- formatData(){
- const partList = []
- const tempList = []
- this.partListData.map(item => {
- if(item.currentInven){
- partList.push({
- "productSn": item.productSn,
- "totalQty": item.qty
- })
- }else{
- tempList.push({
- "productSn": item.productSn,
- "qty": item.qty,
- // "price": item.cost
- })
- }
- })
- return [partList,tempList]
- },
- // 立即提交
- submitForm(){
- // 游客去认证
- if(this.userInfo.sysUserFlag == '0'){
- // 未认证
- if(!this.storeApply || this.storeApply&&(!this.storeApply.auditStatus || this.storeApply.auditStatus == 'REFUSE')){
- this.showPopup = true
- }
- // 认证通过
- if(this.storeApply&&this.storeApply.auditStatus=='WAIT'){
- uni.showModal({
- title: '提示',
- content: '门店认证资料审核中,请耐心等待!',
- confirmText: '好的',
- showCancel: false
- })
- }
- }else{
- // 已认证用户
- if(this.partListData.length==0){
- uni.showToast({
- icon: 'none',
- title: '请选择配件'
- })
- return
- }
-
- // 开始提交
- const params = {
- shelfOrderDetailList: this.formatData()[0],
- tempBillDetailList: this.formatData()[1],
- vin: this.vinNumber,
- vehicleModel: this.modelLabel || '',
- vehicleLogo: this.carInfo.icon||'',
- billSource: 'vin'
- }
- console.log(params,'立即提交')
- this.saveLoading = true
- shelfOrderFlowCreate(params).then(res => {
- console.log(res,'shelfOrderFlowCreate')
- if(res.status == 200){
- // 提交成功
- uni.redirectTo({
- url:"/pagesA/digitalShelf/choosePartResult?data="+encodeURIComponent(JSON.stringify(res.data))+"&state=1"
- })
- }else{
- // 或失败
- uni.redirectTo({
- url:"/pagesA/digitalShelf/choosePartResult?data="+encodeURIComponent(JSON.stringify({shelfOrder:{remindMessage:res.message}}))+"&state=0"
- })
- }
- this.saveLoading = false
- })
- }
- },
- }
- }
- </script>
- <style lang="less">
- .choosePartByVin{
- height: 100vh;
- .cpb_header{
- background-color: #FFFFFF;
- padding: 10rpx;
- align-items: center;
- > div{
- padding: 10rpx;
- align-items: center;
- &:first-child{
- padding-right: 20rpx;
- }
- > div{
- &:first-child{
- padding-right: 20rpx;
- flex-grow: 1;
- color: #818b94;
- font-size: 24rpx;
- }
- }
- }
- .copyText{
- background-color: #EBEBEB;
- border-radius: 100rpx;
- padding: 0 20rpx;
- color: #033692;
- font-size: 20rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-left: 20rpx;
- }
- .carTits{
- font-size: 32rpx;
- font-weight: bold;
- color: #222222;
- line-height: normal;
- margin-bottom: 10rpx;
- flex-grow: 1;
- }
- .qhbtns{
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 20rpx;
- color: #0485F6;
- border:2rpx solid #0485F6;
- border-radius: 50rpx;
- background: rgba(88, 177, 255, 0.2);
- width: 200rpx;
- height: 36rpx;
- margin-left: 10rpx;
- }
- }
- .show-price-modal{
- padding: 30px 20px;
- >view{
- display: flex;
- align-items: center;
- justify-content: space-between;
- > text{
- &:last-child{
- color: #999;
- width: 70%;
- display: block;
- }
- }
- border-bottom: 1px solid #eee;
- padding: 10px;
- }
- }
- .cpb_middle{
- flex-grow: 1;
- padding-top: 10rpx;
- overflow: auto;
- .slider-bar{
- width: 25%;
- background: #F5F6F7;
- height: 100%;
- overflow: auto;
- .tabs{
- > view{
- border-left: 6rpx solid #F5F6F7;
- padding: 30rpx 10rpx;
- font-size: 30rpx;
- color: #666E75;
- }
- .active{
- border-color: #0485F6;
- color: #0485F6;
- background: #fff;
- }
- }
- }
- .right-list{
- position: relative;
- flex-grow: 1;
- background: #fff;
- height: 100%;
- width: 75%;
- .right-list-content{
- height: 100%;
- .nav-right-title{
- font-weight: bold;
- padding: 20upx 25upx;
- border-bottom: 2rpx solid #eee;
- > text{
- color: #9E9E9E;
- font-weight: normal;
- }
- }
- .nav-right-item{
- padding: 15upx 25upx;
- border-bottom: 2rpx solid #f5f5f5;
- .item-info{
- padding-left: 20upx;
- flex-grow: 1;
- .item-name{
- font-size: 32upx;
- color: #191919;
- display: flex;
- align-items: center;
- >image{
- width: 38rpx;
- height: 38rpx;
- margin-right: 10rpx;
- }
- >text{
- flex: 1;
- word-break: break-all;
- }
- }
- .item-detail{
- .item-detail-info{
- padding: 10upx 0 4upx;
- /deep/ .u-tag{
- word-break: break-all;
- }
- > view{
- padding-bottom: 10rpx;
- align-items: center;
- .item-detail-text{
- color: #999;
- .phtxt{
- color: #0485F6;
- font-size: 28upx;
- }
- .item-price{
- color: #FB1E1E;
- font-size: 28upx;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- .cpb_footer{
- padding: 20rpx;
- background-color: #fff;
- align-items: center;
- justify-content: space-between;
- .cpb_cart{
- width: 84rpx;
- height: 84rpx;
- background-color: #0485F6;
- border-radius: 200rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- position: relative;
- }
- > div{
- &:last-child{
- width: 40%;
- }
- }
- }
- .cpb_cart-mask{
- position: fixed;
- width: 100%;
- background: rgba(0,0,0,0.5);
- z-index: 900;
- bottom: 120rpx;
- top: 0;
- }
- .cpb_cart-box{
- background-color: #fff;
- position: absolute;
- width: 100%;
- z-index: 1000;
- bottom: 0;
- padding: 20rpx 0;
- border-radius: 30rpx 30rpx 0 0;
- max-height: 70vh;
- display: flex;
- flex-direction: column;
- .cpb_close{
- position: absolute;
- top: 20rpx;
- right: 20rpx;
- width: 70rpx;
- height: 70rpx;
- font-size: 32rpx;
- color: #999;
- }
- .cpb_cart-tit{
- text-align: center;
- padding: 20rpx;
- font-size: 36rpx;
- }
- .cpb_cart-list{
- padding: 20rpx 30rpx;
- overflow: auto;
- flex-grow: 1;
- > view{
- margin-bottom: 30rpx;
- }
- .item-name{
- font-size: 32rpx;
- margin-bottom: 5px;
- .item-tempPart{
- background: #0055ff;
- color: #fff;
- border-radius: 1em;
- font-size: 0.8em;
- padding: 0 0.5em;
- }
- }
- .item-info{
- border-bottom:2rpx solid #f8f8f8;
- flex-grow: 1;
- padding-left: 0.8em;
- }
- .item-detail{
- .item-detail-info{
- padding: 10upx 0 4upx;
- /deep/ .u-tag{
- word-break: break-all;
- }
- > view{
- padding-bottom: 20rpx;
- align-items: center;
- .item-detail-text{
- color: #999;
- .phtxt{
- color: #0485F6;
- font-size: 28upx;
- }
- .item-price{
- color: #FB1E1E;
- font-size: 28upx;
- }
- }
- }
- }
- }
- }
- }
- }
- </style>
|