feat(gloabl): 列表商品展示使用封面图字段cover
This commit is contained in:
parent
e4b055b75a
commit
bc1ea11e37
|
@ -34,7 +34,11 @@
|
|||
:key="item.pkWares"
|
||||
@click="handleProductClick(item)"
|
||||
>
|
||||
<image :src="item.cover1" class="product-image" mode="aspectFill" />
|
||||
<image
|
||||
:src="item.cover || item.cover1"
|
||||
class="product-image"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<view class="product-info">
|
||||
<view class="product-name">{{ item.waresName }}</view>
|
||||
<view class="product-price-row">
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<view class="popList_i" v-for="item in tableData" :key="item.pkId">
|
||||
<u-checkbox :name="item.pkId"> </u-checkbox>
|
||||
<view class="popList_ii">
|
||||
<img :src="item.cover1" alt="" />
|
||||
<img :src="item.cover || item.cover1" alt="" />
|
||||
<view>
|
||||
<view>{{ item.waresName }}</view>
|
||||
<view>{{ item.waresCode }}</view>
|
||||
|
|
|
@ -7,29 +7,26 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 海报 -->
|
||||
<view class="popup"
|
||||
v-show="popShow">
|
||||
<view class="all"
|
||||
id="qrCodeDiv"
|
||||
ref="qrCodeDiv">
|
||||
<canvas :style="{ width: canvasW + 'px', height: canvasH + 'px' }"
|
||||
<view class="popup" v-show="popShow">
|
||||
<view class="all" id="qrCodeDiv" ref="qrCodeDiv">
|
||||
<canvas
|
||||
:style="{ width: canvasW + 'px', height: canvasH + 'px' }"
|
||||
canvas-id="myCanvas"
|
||||
id="myCanvas"></canvas>
|
||||
id="myCanvas"
|
||||
></canvas>
|
||||
</view>
|
||||
<view class="btn"
|
||||
@click="savePosterPath()">保存到手机</view>
|
||||
|
||||
<view class="btn" @click="savePosterPath()">保存到手机</view>
|
||||
</view>
|
||||
<!-- 模态框 -->
|
||||
<view class="mask"
|
||||
v-show="popShow"
|
||||
@tap="popShow = false"></view>
|
||||
<view class="mask" v-show="popShow" @tap="popShow = false"></view>
|
||||
<!-- 底部弹框 -->
|
||||
<u-action-sheet :actions="list"
|
||||
<u-action-sheet
|
||||
:actions="list"
|
||||
:closeOnClickOverlay="true"
|
||||
@close="closeIsShow"
|
||||
@select="selectClick"
|
||||
:show="isShow"></u-action-sheet>
|
||||
:show="isShow"
|
||||
></u-action-sheet>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -68,11 +65,11 @@ export default {
|
|||
},
|
||||
toShare(item) {
|
||||
let pkId = item.pkId
|
||||
this.goodImg = item.cover1
|
||||
this.goodImg = item.cover || item.cover1
|
||||
qrCode({
|
||||
codeType: 1,
|
||||
waresId: pkId,
|
||||
}).then((res) => {
|
||||
}).then(res => {
|
||||
this.postImg = res.data
|
||||
this.toCanvas()
|
||||
// this.popShow = true
|
||||
|
@ -90,7 +87,7 @@ export default {
|
|||
ctx.drawImage(imgBg, 0, 0, this.canvasW, this.canvasH) //插入图片
|
||||
ctx.drawImage(imggoodList, 95, 175, 130, 130)
|
||||
ctx.drawImage(imgPost, 239, 392, 65, 65)
|
||||
ctx.draw(true, (ret) => {})
|
||||
ctx.draw(true, ret => {})
|
||||
}, 100)
|
||||
},
|
||||
//获取图片缓存地址
|
||||
|
@ -98,7 +95,7 @@ export default {
|
|||
return new Promise((reslove, reject) => {
|
||||
uni.getImageInfo({
|
||||
src: img,
|
||||
success: (res) => {
|
||||
success: res => {
|
||||
reslove(res.path)
|
||||
},
|
||||
})
|
||||
|
@ -122,7 +119,7 @@ export default {
|
|||
uni.showModal({
|
||||
title: '授权提示',
|
||||
content: '是否允许获取保存相册权限',
|
||||
success: (res) => {
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
// 点击确定,则调用相册授权
|
||||
uni.openSetting({
|
||||
|
@ -154,7 +151,8 @@ export default {
|
|||
saveLocal() {
|
||||
console.log('d')
|
||||
// canvas转图片
|
||||
uni.canvasToTempFilePath({
|
||||
uni.canvasToTempFilePath(
|
||||
{
|
||||
canvasId: 'myCanvas',
|
||||
success: function (res) {
|
||||
console.log('res', res)
|
||||
|
@ -179,7 +177,9 @@ export default {
|
|||
fail: function (err) {
|
||||
console.log('err', err)
|
||||
},
|
||||
},this)
|
||||
},
|
||||
this
|
||||
)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
></view>
|
||||
<view class="goods-flex-s">
|
||||
<view class="goods-img">
|
||||
<image :src="item.cover1"></image>
|
||||
<image :src="item.cover || item.cover1"></image>
|
||||
</view>
|
||||
<view class="padding_s goods-info">
|
||||
<view class="goods-name">{{ item.waresName }}</view>
|
||||
|
|
|
@ -270,7 +270,7 @@
|
|||
>
|
||||
<view class="goodList_i">
|
||||
<view class="goodList_it">
|
||||
<img :src="item.cover1" class="cover" alt="" />
|
||||
<img :src="item.cover || item.cover1" class="cover" alt="" />
|
||||
<view class="goodList_ir">
|
||||
<view class="goodList_ib">
|
||||
<view class="tit1">
|
||||
|
@ -621,7 +621,7 @@ export default {
|
|||
achieveAmount: 0,
|
||||
price: 0,
|
||||
priceAmount: 0,
|
||||
cover1: item.cover1,
|
||||
cover1: item.cover || item.cover1,
|
||||
energySilo: 1,
|
||||
}
|
||||
})
|
||||
|
|
|
@ -753,7 +753,7 @@ export default {
|
|||
achieveAmount: 0,
|
||||
price: 0,
|
||||
priceAmount: 0,
|
||||
cover1: item.cover1,
|
||||
cover1: item.cover || item.cover1,
|
||||
energySilo: 1,
|
||||
}
|
||||
})
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</view>
|
||||
<view class="list_flex" style="margin-top: 20rpx;" v-for="aitem,aindex in item.waresOrderList">
|
||||
<view class="center_left">
|
||||
<image class="center_img" :src="aitem.cover1" mode=""></image>
|
||||
<image class="center_img" :src="aitem.cover || aitem.cover1" mode=""></image>
|
||||
<view class="center_title">{{aitem.waresName}}</view>
|
||||
</view>
|
||||
<view class="center_right">
|
||||
|
|
|
@ -11,16 +11,18 @@
|
|||
<view>{{ zoneList[0].label }}</view>
|
||||
</view> -->
|
||||
<view class="goods">
|
||||
<view class="goods_item"
|
||||
<view
|
||||
class="goods_item"
|
||||
v-for="item in goodsList"
|
||||
:key="item.pkId"
|
||||
@tap="goDetails(item)">
|
||||
<img :src="item.cover1"
|
||||
class="goodImg"
|
||||
alt="">
|
||||
@tap="goDetails(item)"
|
||||
>
|
||||
<img :src="item.cover || item.cover1" class="goodImg" alt="" />
|
||||
<view class="goods_item_bom">
|
||||
<view class="tit1_flex">
|
||||
<view class="tit2">{{ item.waresPrice | numberToCurrency | isLocal }}</view>
|
||||
<view class="tit2">{{
|
||||
item.waresPrice | numberToCurrency | isLocal
|
||||
}}</view>
|
||||
<!-- <img class="shareImg"
|
||||
:src="shareImg"
|
||||
@click.stop="openImg(item)"
|
||||
|
@ -28,8 +30,9 @@
|
|||
</view>
|
||||
<view class="disFlex">
|
||||
<view class="tit3">
|
||||
<span class="qzbq"
|
||||
v-if="item.prefixLabelTarget != undefined">[{{ item.prefixLabelTarget.label }}]</span>
|
||||
<span class="qzbq" v-if="item.prefixLabelTarget != undefined"
|
||||
>[{{ item.prefixLabelTarget.label }}]</span
|
||||
>
|
||||
<span>{{ item.waresName }}</span>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -37,20 +40,21 @@
|
|||
<view class="tit4">
|
||||
{{ '销量' }}:{{ item.sales | numberToCurrency | seles }}
|
||||
</view>
|
||||
<view class="tit4"
|
||||
style="margin-left:10px">{{'业绩'}}:{{ item.waresAchieve | numberToCurrency}}
|
||||
<view class="tit4" style="margin-left: 10px"
|
||||
>{{ '业绩' }}:{{ item.waresAchieve | numberToCurrency }}
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="addCar">{{ '加入购物车' }}</view> -->
|
||||
<view class="md">
|
||||
<img v-for="ctem in item.sellingLabelList"
|
||||
<img
|
||||
v-for="ctem in item.sellingLabelList"
|
||||
v-show="item.sellingLabelList"
|
||||
:key="ctem.pkId"
|
||||
:src="ctem.labelImage || ''"
|
||||
alt="">
|
||||
alt=""
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -71,14 +75,12 @@ export default {
|
|||
},
|
||||
filters: {
|
||||
seles(value) {
|
||||
|
||||
if (value > 999) {
|
||||
return 999 + '+'
|
||||
} else {
|
||||
return value
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -156,9 +158,9 @@ export default {
|
|||
.getAllGoods({
|
||||
specialArea: this.specialArea,
|
||||
})
|
||||
.then((res) => {
|
||||
.then(res => {
|
||||
this.goodsList = res.data
|
||||
this.goodsList.forEach((item) => {
|
||||
this.goodsList.forEach(item => {
|
||||
if (item.waresName.length > 8) {
|
||||
item.waresName = item.waresName.substring(0, 8) + '...'
|
||||
}
|
||||
|
@ -171,9 +173,9 @@ export default {
|
|||
source: this.source,
|
||||
productCategory: this.productCategory,
|
||||
})
|
||||
.then((res) => {
|
||||
.then(res => {
|
||||
this.goodsList = res.rows
|
||||
this.goodsList.forEach((item) => {
|
||||
this.goodsList.forEach(item => {
|
||||
if (item.waresName.length > 8) {
|
||||
item.waresName = item.waresName.substring(0, 8) + '...'
|
||||
}
|
||||
|
@ -191,10 +193,12 @@ export default {
|
|||
min-height: 94vh;
|
||||
}
|
||||
.index_header {
|
||||
background: #f9f9f9;;
|
||||
background: #f9f9f9;
|
||||
height: 330rpx;
|
||||
font-size: 18px;
|
||||
font-family: PingFang SC-Semibold, PingFang SC;
|
||||
font-family:
|
||||
PingFang SC-Semibold,
|
||||
PingFang SC;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
text-align: center;
|
||||
|
@ -243,7 +247,9 @@ export default {
|
|||
// width: 120rpx;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
font-family: PingFang SC-Semibold, PingFang SC;
|
||||
font-family:
|
||||
PingFang SC-Semibold,
|
||||
PingFang SC;
|
||||
font-weight: 600;
|
||||
color: #ed1d25;
|
||||
margin-right: 28rpx;
|
||||
|
@ -341,7 +347,9 @@ export default {
|
|||
border: 1px solid #f33131;
|
||||
border-radius: 6px;
|
||||
font-size: 12px;
|
||||
font-family: PingFang SC-Semibold, PingFang SC;
|
||||
font-family:
|
||||
PingFang SC-Semibold,
|
||||
PingFang SC;
|
||||
font-weight: 600;
|
||||
color: #f33131;
|
||||
text-align: center;
|
||||
|
|
|
@ -157,7 +157,7 @@
|
|||
<view class="popList_i" v-for="item in tableData" :key="item.pkId">
|
||||
<u-checkbox :name="item.pkId"> </u-checkbox>
|
||||
<view class="popList_ii">
|
||||
<img :src="item.cover1" alt="" />
|
||||
<img :src="item.cover || item.cover1" alt="" />
|
||||
<view>
|
||||
<view>{{ item.waresName }}</view>
|
||||
<view>{{ item.waresCode }}</view>
|
||||
|
|
|
@ -17,42 +17,75 @@
|
|||
<img :src="pkCountryImg" alt="" />
|
||||
<u-icon name="arrow-down" color="#999"></u-icon>
|
||||
</view>
|
||||
<u-scroll-list :indicator="false" v-if="itemChildren.length > 1" class="tabList_a">
|
||||
<u-scroll-list
|
||||
:indicator="false"
|
||||
v-if="itemChildren.length > 1"
|
||||
class="tabList_a"
|
||||
>
|
||||
<view class="tab">
|
||||
<view v-for="(item, index) in itemChildren" :key="index" @click="setSpecial(item)" v-show="item.isShow"
|
||||
:class="[specialArea == item.value ? 'actTab' : 'tab_i']">
|
||||
<view
|
||||
v-for="(item, index) in itemChildren"
|
||||
:key="index"
|
||||
@click="setSpecial(item)"
|
||||
v-show="item.isShow"
|
||||
:class="[specialArea == item.value ? 'actTab' : 'tab_i']"
|
||||
>
|
||||
<view>{{ item.label }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-scroll-list>
|
||||
<view class="index_btm">
|
||||
<view class="index_l">
|
||||
<view v-for="item in oneList" :class="['classIfy', oneId == item.pkId ? 'actOne' : '']" @click="
|
||||
(oneId = item.pkId),
|
||||
<view
|
||||
v-for="item in oneList"
|
||||
:class="['classIfy', oneId == item.pkId ? 'actOne' : '']"
|
||||
@click="
|
||||
((oneId = item.pkId),
|
||||
getAllGoods(item.pkId),
|
||||
getClassIfyTwo(item.pkId)
|
||||
" :key="item.pkId">{{ item.classifyName }}</view>
|
||||
getClassIfyTwo(item.pkId))
|
||||
"
|
||||
:key="item.pkId"
|
||||
>{{ item.classifyName }}</view
|
||||
>
|
||||
</view>
|
||||
<view class="index_r">
|
||||
<u-scroll-list :indicator="false" class="tabList">
|
||||
<view class="tab">
|
||||
<view v-for="(item, index) in twoList" :key="index"
|
||||
@click="(twoId = item.pkId), getAllGoods1(item.pkId)"
|
||||
:class="[twoId == item.pkId ? 'actTab' : 'tab_i']">
|
||||
<view
|
||||
v-for="(item, index) in twoList"
|
||||
:key="index"
|
||||
@click="((twoId = item.pkId), getAllGoods1(item.pkId))"
|
||||
:class="[twoId == item.pkId ? 'actTab' : 'tab_i']"
|
||||
>
|
||||
<view>{{ item.classifyName }}</view>
|
||||
<!-- <view :class="[twoId == item.pkId ? 'heng' : 'heng1']"></view> -->
|
||||
</view>
|
||||
</view>
|
||||
</u-scroll-list>
|
||||
<view class="search">
|
||||
<u--input placeholder="请输入商品名称" placeholderStyle="font-size:14px;" prefixIcon="search"
|
||||
shape="circle" v-model="waresName" border="none" @confirm="getAllGoods1()"
|
||||
prefixIconStyle="font-size: 22px;color: #909399"></u--input>
|
||||
<u--input
|
||||
placeholder="请输入商品名称"
|
||||
placeholderStyle="font-size:14px;"
|
||||
prefixIcon="search"
|
||||
shape="circle"
|
||||
v-model="waresName"
|
||||
border="none"
|
||||
@confirm="getAllGoods1()"
|
||||
prefixIconStyle="font-size: 22px;color: #909399"
|
||||
></u--input>
|
||||
</view>
|
||||
<view class="goodList">
|
||||
<view v-for="item in goodList" :key="item.waresCode" class="goodList_i" @tap="goDetails(item)">
|
||||
<view class="fly" v-show="item.preSaleStatus == 3 || item.isSale == 1"></view>
|
||||
<img :src="item.cover1" class="cover" alt="" />
|
||||
<view
|
||||
v-for="item in goodList"
|
||||
:key="item.waresCode"
|
||||
class="goodList_i"
|
||||
@tap="goDetails(item)"
|
||||
>
|
||||
<view
|
||||
class="fly"
|
||||
v-show="item.preSaleStatus == 3 || item.isSale == 1"
|
||||
></view>
|
||||
<img :src="item.cover || item.cover1" class="cover" alt="" />
|
||||
<view class="goodList_ir">
|
||||
<view>
|
||||
<span class="qzbq" v-if="item.prefixLabelTarget != undefined">{{
|
||||
|
@ -60,14 +93,24 @@
|
|||
}}</span>
|
||||
{{ item.waresName }}
|
||||
</view>
|
||||
<view class="pv"
|
||||
v-if="specialArea != 18 && specialArea != 13&& specialArea != 31&& specialArea != 10">
|
||||
<view
|
||||
class="pv"
|
||||
v-if="
|
||||
specialArea != 18 &&
|
||||
specialArea != 13 &&
|
||||
specialArea != 31 &&
|
||||
specialArea != 10
|
||||
"
|
||||
>
|
||||
业绩:{{ item.waresAchieve | numberToCurrency }}
|
||||
</view>
|
||||
<view class="pv" v-if="specialArea == 10">
|
||||
积分可抵扣:{{ item.deductMoney | numberToCurrency }}
|
||||
</view>
|
||||
<view class="pv" v-if="specialArea == 31&&userInfo.isMakerSpace == 0">
|
||||
<view
|
||||
class="pv"
|
||||
v-if="specialArea == 31 && userInfo.isMakerSpace == 0"
|
||||
>
|
||||
业绩:{{ item.waresAchieve | numberToCurrency }}
|
||||
</view>
|
||||
<view class="pv" v-if="specialArea == 13">
|
||||
|
@ -78,44 +121,70 @@
|
|||
<view v-if="specialArea == 31 && userInfo.isMakerSpace == 1">
|
||||
{{ item.vipPrice | numberToCurrency }}
|
||||
</view>
|
||||
<view v-if="(specialArea == 31&&userInfo.isMakerSpace == 0)||specialArea !=31">
|
||||
<view
|
||||
v-if="
|
||||
(specialArea == 31 && userInfo.isMakerSpace == 0) ||
|
||||
specialArea != 31
|
||||
"
|
||||
>
|
||||
{{ item.waresPrice | numberToCurrency }}
|
||||
</view>
|
||||
<img @click.stop="addCar(item)"
|
||||
v-show="item.preSaleStatus != 3 && item.isSale != 1&&specialArea != 31"
|
||||
src="@/static/images/cart.png" alt="" />
|
||||
<img @click.stop="addCar(item)"
|
||||
v-show="item.preSaleStatus != 3 && item.isSale != 1&&specialArea == 31&&userInfo.isMakerSpace == 0"
|
||||
src="@/static/images/cart.png" alt="" />
|
||||
<img
|
||||
@click.stop="addCar(item)"
|
||||
v-show="
|
||||
item.preSaleStatus != 3 &&
|
||||
item.isSale != 1 &&
|
||||
specialArea != 31
|
||||
"
|
||||
src="@/static/images/cart.png"
|
||||
alt=""
|
||||
/>
|
||||
<img
|
||||
@click.stop="addCar(item)"
|
||||
v-show="
|
||||
item.preSaleStatus != 3 &&
|
||||
item.isSale != 1 &&
|
||||
specialArea == 31 &&
|
||||
userInfo.isMakerSpace == 0
|
||||
"
|
||||
src="@/static/images/cart.png"
|
||||
alt=""
|
||||
/>
|
||||
</view>
|
||||
<!-- <view class="pv" v-show="specialArea == 31"> 统一零售价:{{ item.retailPrice| numberToCurrency | isLocal}} </view> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="zhan"></view>
|
||||
<!-- <view class="zhan"></view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-picker :show="isCountry" @cancel="isCountry = false" @confirm="sureCountry" :columns="countryList"
|
||||
keyName="label"></u-picker>
|
||||
<u-picker
|
||||
:show="isCountry"
|
||||
@cancel="isCountry = false"
|
||||
@confirm="sureCountry"
|
||||
:columns="countryList"
|
||||
keyName="label"
|
||||
></u-picker>
|
||||
<selSpaceGoods ref="selSpaceGoods" @getCar="getCatLength"></selSpaceGoods>
|
||||
<cartBall ref="cart" :carLength="shopCarLength" :specialArea="specialArea"></cartBall>
|
||||
<cartBall
|
||||
ref="cart"
|
||||
:carLength="shopCarLength"
|
||||
:specialArea="specialArea"
|
||||
></cartBall>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import backIcon from "@/components/backIcon.vue";
|
||||
import cartBall from "@/components/cartBall.vue";
|
||||
import {
|
||||
mapGetters,
|
||||
mapActions
|
||||
} from "vuex";
|
||||
import * as api from "@/config/goods";
|
||||
import clTabbar from "@/components/cl-tabbar.vue";
|
||||
import selSpaceGoods from "@/components/selSpaceGoods.vue";
|
||||
import backIcon from '@/components/backIcon.vue'
|
||||
import cartBall from '@/components/cartBall.vue'
|
||||
import { mapGetters, mapActions } from 'vuex'
|
||||
import * as api from '@/config/goods'
|
||||
import clTabbar from '@/components/cl-tabbar.vue'
|
||||
import selSpaceGoods from '@/components/selSpaceGoods.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
"cl-tabbar": clTabbar,
|
||||
'cl-tabbar': clTabbar,
|
||||
backIcon,
|
||||
cartBall,
|
||||
selSpaceGoods,
|
||||
|
@ -124,9 +193,9 @@
|
|||
filters: {
|
||||
seles(value) {
|
||||
if (value > 999) {
|
||||
return 999 + "+";
|
||||
return 999 + '+'
|
||||
} else {
|
||||
return value;
|
||||
return value
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -134,88 +203,98 @@
|
|||
return {
|
||||
specialArea: 1,
|
||||
oneList: [],
|
||||
oneId: "",
|
||||
oneId: '',
|
||||
twoList: [],
|
||||
twoId: "",
|
||||
twoId: '',
|
||||
goodList: [],
|
||||
titLabel: "",
|
||||
titLabel: '',
|
||||
itemChildren: [],
|
||||
diff: 0,
|
||||
shopCarLength: false,
|
||||
userInfo: {},
|
||||
pkCountry: 1,
|
||||
pkCountryLabel: "",
|
||||
pkCountryImg: "",
|
||||
pkCountryLabel: '',
|
||||
pkCountryImg: '',
|
||||
countryList: [],
|
||||
isCountry: false,
|
||||
waresName: "",
|
||||
};
|
||||
waresName: '',
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
console.log('%c [ options ]-25', 'font-size:13px; background:#cb38d2; color:#ff7cff;', options)
|
||||
console.log(
|
||||
'%c [ options ]-25',
|
||||
'font-size:13px; background:#cb38d2; color:#ff7cff;',
|
||||
options
|
||||
)
|
||||
if (JSON.parse(options.children).length > 0) {
|
||||
let arr = [];
|
||||
let arr = []
|
||||
if (options.childArea) {
|
||||
this.specialArea = options.childArea;
|
||||
this.specialArea = options.childArea
|
||||
// this.diff = 1
|
||||
} else {
|
||||
JSON.parse(options.children).forEach((item) => {
|
||||
JSON.parse(options.children).forEach(item => {
|
||||
if (item.isShow) {
|
||||
arr.push(item.value);
|
||||
arr.push(item.value)
|
||||
}
|
||||
});
|
||||
this.specialArea = arr[0];
|
||||
})
|
||||
this.specialArea = arr[0]
|
||||
// this.diff = 0
|
||||
}
|
||||
if (options.diff) {
|
||||
this.diff = options.diff;
|
||||
this.diff = options.diff
|
||||
}
|
||||
} else {
|
||||
this.specialArea = options.specialArea;
|
||||
this.specialArea = options.specialArea
|
||||
}
|
||||
|
||||
this.titLabel = options.label;
|
||||
let tempArr = JSON.parse(options.children);
|
||||
this.titLabel = options.label
|
||||
let tempArr = JSON.parse(options.children)
|
||||
if (this.specialArea != 18) {
|
||||
api.menuList().then((res) => {
|
||||
tempArr = tempArr.filter(item => res.data.find(ctem => ctem.menuKey == item.name));
|
||||
this.itemChildren = tempArr;
|
||||
});
|
||||
api.menuList().then(res => {
|
||||
tempArr = tempArr.filter(item =>
|
||||
res.data.find(ctem => ctem.menuKey == item.name)
|
||||
)
|
||||
this.itemChildren = tempArr
|
||||
})
|
||||
}
|
||||
// 修改标题
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.titLabel,
|
||||
success: () => {},
|
||||
});
|
||||
})
|
||||
// 获取一级分类并获取商品列表
|
||||
// this.getClassIfy()
|
||||
|
||||
this.userInfo = uni.getStorageSync("User");
|
||||
console.log('%c [ this.userInfo ]-242', 'font-size:13px; background:#cb38d2; color:#ff7cff;', this.userInfo)
|
||||
this.userInfo = uni.getStorageSync('User')
|
||||
console.log(
|
||||
'%c [ this.userInfo ]-242',
|
||||
'font-size:13px; background:#cb38d2; color:#ff7cff;',
|
||||
this.userInfo
|
||||
)
|
||||
if (this.specialArea == 1) {
|
||||
if (uni.getStorageSync("pkCountry")) {
|
||||
this.pkCountry = uni.getStorageSync("pkCountry");
|
||||
if (uni.getStorageSync('pkCountry')) {
|
||||
this.pkCountry = uni.getStorageSync('pkCountry')
|
||||
} else {
|
||||
this.pkCountry = this.userInfo.pkSettleCountry;
|
||||
uni.setStorageSync("pkCountry", this.pkCountry + "");
|
||||
this.pkCountry = this.userInfo.pkSettleCountry
|
||||
uni.setStorageSync('pkCountry', this.pkCountry + '')
|
||||
}
|
||||
} else {
|
||||
this.pkCountry = this.userInfo.pkSettleCountry;
|
||||
this.pkCountry = this.userInfo.pkSettleCountry
|
||||
}
|
||||
this.setSpecial({
|
||||
value: this.specialArea
|
||||
});
|
||||
value: this.specialArea,
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
let that = this;
|
||||
uni.$on("returnData", function(data) {
|
||||
that.specialArea = data.value;
|
||||
let that = this
|
||||
uni.$on('returnData', function (data) {
|
||||
that.specialArea = data.value
|
||||
that.setSpecial({
|
||||
value: data.value
|
||||
});
|
||||
});
|
||||
value: data.value,
|
||||
})
|
||||
})
|
||||
// 获取国家
|
||||
this.getJScountry();
|
||||
this.getJScountry()
|
||||
this.$nextTick(() => {
|
||||
this.$refs.cart.getCar()
|
||||
})
|
||||
|
@ -231,43 +310,41 @@
|
|||
methods: {
|
||||
...mapActions(['setSmallCarLength', 'setShopCarLength']),
|
||||
changeCountry() {
|
||||
this.isCountry = true;
|
||||
this.isCountry = true
|
||||
},
|
||||
sureCountry(e) {
|
||||
const {
|
||||
value
|
||||
} = e;
|
||||
this.pkCountry = value[0].id;
|
||||
this.pkCountryLabel = value[0].label;
|
||||
this.pkCountryImg = value[0].img;
|
||||
this.isCountry = false;
|
||||
uni.setStorageSync("pkCountry", this.pkCountry + "");
|
||||
const { value } = e
|
||||
this.pkCountry = value[0].id
|
||||
this.pkCountryLabel = value[0].label
|
||||
this.pkCountryImg = value[0].img
|
||||
this.isCountry = false
|
||||
uni.setStorageSync('pkCountry', this.pkCountry + '')
|
||||
// 获取分类一级
|
||||
this.getClassIfy();
|
||||
this.$refs.cart.getCar();
|
||||
this.getClassIfy()
|
||||
this.$refs.cart.getCar()
|
||||
},
|
||||
getJScountry() {
|
||||
api.currencyList().then((res) => {
|
||||
let data = res.data.map((item) => {
|
||||
api.currencyList().then(res => {
|
||||
let data = res.data.map(item => {
|
||||
return {
|
||||
img: item.nationalFlag2,
|
||||
id: item.pkId,
|
||||
label: item.shortName,
|
||||
};
|
||||
});
|
||||
this.countryList = [data];
|
||||
this.countryList[0].forEach((item) => {
|
||||
if (item.id == this.pkCountry) {
|
||||
this.pkCountryLabel = item.label;
|
||||
this.pkCountryImg = item.img;
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
this.countryList = [data]
|
||||
this.countryList[0].forEach(item => {
|
||||
if (item.id == this.pkCountry) {
|
||||
this.pkCountryLabel = item.label
|
||||
this.pkCountryImg = item.img
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
goShare() {
|
||||
uni.navigateTo({
|
||||
url: "/pages/specialArea/share?specialArea=7",
|
||||
});
|
||||
url: '/pages/specialArea/share?specialArea=7',
|
||||
})
|
||||
},
|
||||
setSpecial(item) {
|
||||
if (item.value == 21) {
|
||||
|
@ -279,8 +356,8 @@
|
|||
// JSON.stringify(this.itemChildren),
|
||||
// })
|
||||
} else {
|
||||
this.specialArea = item.value;
|
||||
this.getClassIfy();
|
||||
this.specialArea = item.value
|
||||
this.getClassIfy()
|
||||
}
|
||||
},
|
||||
addCar(item) {
|
||||
|
@ -290,35 +367,35 @@
|
|||
number: 1,
|
||||
waresCode: item.waresCode,
|
||||
productGroup: item.productGroup,
|
||||
};
|
||||
}
|
||||
if (
|
||||
item.isMakerGift == 2 &&
|
||||
(item.specialArea == 1 || item.specialArea == 3)
|
||||
) {
|
||||
this.$refs.selSpaceGoods.getData(carList);
|
||||
this.$refs.selSpaceGoods.getData(carList)
|
||||
} else {
|
||||
api.addShopping(carList).then((res) => {
|
||||
api.addShopping(carList).then(res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: '购物车添加成功',
|
||||
icon: "success",
|
||||
icon: 'success',
|
||||
mask: true,
|
||||
});
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.$store
|
||||
.dispatch("getCarLength", this.specialArea)
|
||||
.then((res) => {
|
||||
this.shopCarLength = res.data.smallCount;
|
||||
});
|
||||
}, 200);
|
||||
.dispatch('getCarLength', this.specialArea)
|
||||
.then(res => {
|
||||
this.shopCarLength = res.data.smallCount
|
||||
})
|
||||
}, 200)
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
},
|
||||
getCatLength() {
|
||||
this.$store.dispatch("getCarLength", this.specialArea).then((res) => {
|
||||
this.shopCarLength = res.data.smallCount;
|
||||
});
|
||||
this.$store.dispatch('getCarLength', this.specialArea).then(res => {
|
||||
this.shopCarLength = res.data.smallCount
|
||||
})
|
||||
},
|
||||
getClassIfy() {
|
||||
api
|
||||
|
@ -327,16 +404,16 @@
|
|||
specialArea: this.specialArea,
|
||||
hierarchy: 0,
|
||||
})
|
||||
.then((res) => {
|
||||
.then(res => {
|
||||
res.data.unshift({
|
||||
classifyName: '全部',
|
||||
pkId: "",
|
||||
});
|
||||
this.oneList = res.data;
|
||||
this.oneId = this.oneList[0]?this.oneList[0].pkId : '';
|
||||
this.getClassIfyTwo(this.oneList[0].pkId);
|
||||
this.getAllGoods(this.oneList[0].pkId);
|
||||
});
|
||||
pkId: '',
|
||||
})
|
||||
this.oneList = res.data
|
||||
this.oneId = this.oneList[0] ? this.oneList[0].pkId : ''
|
||||
this.getClassIfyTwo(this.oneList[0].pkId)
|
||||
this.getAllGoods(this.oneList[0].pkId)
|
||||
})
|
||||
},
|
||||
// 获取分类二级
|
||||
getClassIfyTwo(pkId) {
|
||||
|
@ -347,30 +424,30 @@
|
|||
hierarchy: 1,
|
||||
pkCountry: this.pkCountry,
|
||||
})
|
||||
.then((res) => {
|
||||
.then(res => {
|
||||
res.data.unshift({
|
||||
classifyName: '全部',
|
||||
pkId: pkId,
|
||||
});
|
||||
this.twoList = res.data;
|
||||
this.twoId = pkId;
|
||||
});
|
||||
})
|
||||
this.twoList = res.data
|
||||
this.twoId = pkId
|
||||
})
|
||||
},
|
||||
getAllGoods(id) {
|
||||
api
|
||||
.getAllGoods({
|
||||
pkCountry: this.pkCountry,
|
||||
specialArea: Number(this.specialArea),
|
||||
pkAreaClassify: id ? id : "",
|
||||
pkAreaClassify: id ? id : '',
|
||||
})
|
||||
.then((res) => {
|
||||
this.goodList = res.data;
|
||||
this.goodList.forEach((item) => {
|
||||
.then(res => {
|
||||
this.goodList = res.data
|
||||
this.goodList.forEach(item => {
|
||||
if (item.waresName.length > 11) {
|
||||
item.waresName = item.waresName.substring(0, 11) + "...";
|
||||
item.waresName = item.waresName.substring(0, 11) + '...'
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
},
|
||||
getAllGoods1(id) {
|
||||
api
|
||||
|
@ -380,34 +457,37 @@
|
|||
waresName: this.waresName,
|
||||
pkAreaClassify: id ? id : this.oneId,
|
||||
})
|
||||
.then((res) => {
|
||||
this.goodList = res.data;
|
||||
this.goodList.forEach((item) => {
|
||||
.then(res => {
|
||||
this.goodList = res.data
|
||||
this.goodList.forEach(item => {
|
||||
if (item.waresName.length > 11) {
|
||||
item.waresName = item.waresName.substring(0, 11) + "...";
|
||||
item.waresName = item.waresName.substring(0, 11) + '...'
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
},
|
||||
goDetails(item) {
|
||||
if (item.preSaleStatus != 3 && item.isSale != 1) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/specialArea/details?waresCode=" +
|
||||
url:
|
||||
'/pages/specialArea/details?waresCode=' +
|
||||
item.waresCode +
|
||||
"&specialArea=" +
|
||||
'&specialArea=' +
|
||||
item.specialArea,
|
||||
});
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.index_header {
|
||||
background: #fff;
|
||||
font-size: 18px;
|
||||
font-family: PingFang SC-Semibold, PingFang SC;
|
||||
font-family:
|
||||
PingFang SC-Semibold,
|
||||
PingFang SC;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
text-align: center;
|
||||
|
@ -416,13 +496,14 @@
|
|||
|
||||
.content {
|
||||
background: #f9f9f9;
|
||||
height: 93vh;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tabList_a {}
|
||||
.tabList_a {
|
||||
}
|
||||
|
||||
.index_btm {
|
||||
flex: 1; // display: flex;
|
||||
|
@ -431,7 +512,9 @@
|
|||
width: 198rpx;
|
||||
padding: 10rpx 0;
|
||||
font-size: 11px;
|
||||
font-family: PingFang SC-Regular, PingFang SC;
|
||||
font-family:
|
||||
PingFang SC-Regular,
|
||||
PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #000000;
|
||||
overflow-y: auto;
|
||||
|
@ -457,13 +540,12 @@
|
|||
font-family: Microsoft YaHei;
|
||||
font-weight: 400;
|
||||
color: #666666;
|
||||
|
||||
}
|
||||
|
||||
.actOne {
|
||||
// border-left: 6rpx solid #005BAC;
|
||||
color: #fff;
|
||||
background: #005BAC;
|
||||
background: #005bac;
|
||||
}
|
||||
|
||||
.tab {
|
||||
|
@ -471,7 +553,6 @@
|
|||
align-items: center;
|
||||
padding: 0 24rpx;
|
||||
margin-top: 20rpx;
|
||||
|
||||
}
|
||||
|
||||
.tab_i {
|
||||
|
@ -501,10 +582,12 @@
|
|||
// width: 120rpx;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
font-family: PingFang SC-Semibold, PingFang SC;
|
||||
font-family:
|
||||
PingFang SC-Semibold,
|
||||
PingFang SC;
|
||||
font-weight: 600;
|
||||
// color: #005BAC;
|
||||
background-color: #005BAC;
|
||||
background-color: #005bac;
|
||||
color: #fff;
|
||||
margin-right: 28rpx;
|
||||
white-space: nowrap;
|
||||
|
@ -524,7 +607,7 @@
|
|||
.heng {
|
||||
width: 24px;
|
||||
height: 2px;
|
||||
background: #005BAC;
|
||||
background: #005bac;
|
||||
border-radius: 1px 1px 1px 1px;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
|
@ -555,7 +638,7 @@
|
|||
|
||||
.goodList {
|
||||
padding: 0 20rpx;
|
||||
height: 95vh;
|
||||
height: calc(100vh - 300rpx);
|
||||
overflow-y: auto;
|
||||
|
||||
.goodList_i {
|
||||
|
|
Loading…
Reference in New Issue