feat(gloabl): 列表商品展示使用封面图字段cover

This commit is contained in:
woody 2025-06-06 11:25:12 +08:00
parent e4b055b75a
commit bc1ea11e37
10 changed files with 813 additions and 718 deletions

View File

@ -34,7 +34,11 @@
:key="item.pkWares" :key="item.pkWares"
@click="handleProductClick(item)" @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-info">
<view class="product-name">{{ item.waresName }}</view> <view class="product-name">{{ item.waresName }}</view>
<view class="product-price-row"> <view class="product-price-row">

View File

@ -129,7 +129,7 @@
<view class="popList_i" v-for="item in tableData" :key="item.pkId"> <view class="popList_i" v-for="item in tableData" :key="item.pkId">
<u-checkbox :name="item.pkId"> </u-checkbox> <u-checkbox :name="item.pkId"> </u-checkbox>
<view class="popList_ii"> <view class="popList_ii">
<img :src="item.cover1" alt="" /> <img :src="item.cover || item.cover1" alt="" />
<view> <view>
<view>{{ item.waresName }}</view> <view>{{ item.waresName }}</view>
<view>{{ item.waresCode }}</view> <view>{{ item.waresCode }}</view>

View File

@ -1,35 +1,32 @@
<!-- <!--
* @Descripttion: * @Descripttion:
* @version: * @version:
* @Author: kBank * @Author: kBank
* @Date: 2022-12-13 15:02:12 * @Date: 2022-12-13 15:02:12
--> -->
<template> <template>
<view> <view>
<!-- 海报 --> <!-- 海报 -->
<view class="popup" <view class="popup" v-show="popShow">
v-show="popShow"> <view class="all" id="qrCodeDiv" ref="qrCodeDiv">
<view class="all" <canvas
id="qrCodeDiv" :style="{ width: canvasW + 'px', height: canvasH + 'px' }"
ref="qrCodeDiv"> canvas-id="myCanvas"
<canvas :style="{ width: canvasW + 'px', height: canvasH + 'px' }" id="myCanvas"
canvas-id="myCanvas" ></canvas>
id="myCanvas"></canvas>
</view> </view>
<view class="btn" <view class="btn" @click="savePosterPath()">保存到手机</view>
@click="savePosterPath()">保存到手机</view>
</view> </view>
<!-- 模态框 --> <!-- 模态框 -->
<view class="mask" <view class="mask" v-show="popShow" @tap="popShow = false"></view>
v-show="popShow"
@tap="popShow = false"></view>
<!-- 底部弹框 --> <!-- 底部弹框 -->
<u-action-sheet :actions="list" <u-action-sheet
:closeOnClickOverlay="true" :actions="list"
@close="closeIsShow" :closeOnClickOverlay="true"
@select="selectClick" @close="closeIsShow"
:show="isShow"></u-action-sheet> @select="selectClick"
:show="isShow"
></u-action-sheet>
</view> </view>
</template> </template>
@ -68,11 +65,11 @@ export default {
}, },
toShare(item) { toShare(item) {
let pkId = item.pkId let pkId = item.pkId
this.goodImg = item.cover1 this.goodImg = item.cover || item.cover1
qrCode({ qrCode({
codeType: 1, codeType: 1,
waresId: pkId, waresId: pkId,
}).then((res) => { }).then(res => {
this.postImg = res.data this.postImg = res.data
this.toCanvas() this.toCanvas()
// this.popShow = true // this.popShow = true
@ -90,7 +87,7 @@ export default {
ctx.drawImage(imgBg, 0, 0, this.canvasW, this.canvasH) // ctx.drawImage(imgBg, 0, 0, this.canvasW, this.canvasH) //
ctx.drawImage(imggoodList, 95, 175, 130, 130) ctx.drawImage(imggoodList, 95, 175, 130, 130)
ctx.drawImage(imgPost, 239, 392, 65, 65) ctx.drawImage(imgPost, 239, 392, 65, 65)
ctx.draw(true, (ret) => {}) ctx.draw(true, ret => {})
}, 100) }, 100)
}, },
// //
@ -98,7 +95,7 @@ export default {
return new Promise((reslove, reject) => { return new Promise((reslove, reject) => {
uni.getImageInfo({ uni.getImageInfo({
src: img, src: img,
success: (res) => { success: res => {
reslove(res.path) reslove(res.path)
}, },
}) })
@ -122,7 +119,7 @@ export default {
uni.showModal({ uni.showModal({
title: '授权提示', title: '授权提示',
content: '是否允许获取保存相册权限', content: '是否允许获取保存相册权限',
success: (res) => { success: res => {
if (res.confirm) { if (res.confirm) {
// //
uni.openSetting({ uni.openSetting({
@ -154,32 +151,35 @@ export default {
saveLocal() { saveLocal() {
console.log('d') console.log('d')
// canvas // canvas
uni.canvasToTempFilePath({ uni.canvasToTempFilePath(
canvasId: 'myCanvas', {
success: function (res) { canvasId: 'myCanvas',
console.log('res', res) success: function (res) {
// // console.log('res', res)
uni.saveImageToPhotosAlbum({ // //
filePath: res.tempFilePath, uni.saveImageToPhotosAlbum({
success: function () { filePath: res.tempFilePath,
console.log('save success') success: function () {
uni.showToast({ console.log('save success')
title: '已保存在本地相册', uni.showToast({
icon: 'none', title: '已保存在本地相册',
}) icon: 'none',
}, })
fail: function () { },
uni.showToast({ fail: function () {
title: '保存失败', uni.showToast({
icon: 'none', title: '保存失败',
}) icon: 'none',
}, })
}) },
})
},
fail: function (err) {
console.log('err', err)
},
}, },
fail: function (err) { this
console.log('err', err) )
},
},this)
}, },
}, },
} }
@ -242,4 +242,4 @@ export default {
background: rgba(0, 0, 0, 80%); background: rgba(0, 0, 0, 80%);
overflow: hidden; overflow: hidden;
} }
</style> </style>

View File

@ -83,7 +83,7 @@
></view> ></view>
<view class="goods-flex-s"> <view class="goods-flex-s">
<view class="goods-img"> <view class="goods-img">
<image :src="item.cover1"></image> <image :src="item.cover || item.cover1"></image>
</view> </view>
<view class="padding_s goods-info"> <view class="padding_s goods-info">
<view class="goods-name">{{ item.waresName }}</view> <view class="goods-name">{{ item.waresName }}</view>

View File

@ -270,7 +270,7 @@
> >
<view class="goodList_i"> <view class="goodList_i">
<view class="goodList_it"> <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_ir">
<view class="goodList_ib"> <view class="goodList_ib">
<view class="tit1"> <view class="tit1">
@ -621,7 +621,7 @@ export default {
achieveAmount: 0, achieveAmount: 0,
price: 0, price: 0,
priceAmount: 0, priceAmount: 0,
cover1: item.cover1, cover1: item.cover || item.cover1,
energySilo: 1, energySilo: 1,
} }
}) })

View File

@ -753,7 +753,7 @@ export default {
achieveAmount: 0, achieveAmount: 0,
price: 0, price: 0,
priceAmount: 0, priceAmount: 0,
cover1: item.cover1, cover1: item.cover || item.cover1,
energySilo: 1, energySilo: 1,
} }
}) })

View File

@ -28,7 +28,7 @@
</view> </view>
<view class="list_flex" style="margin-top: 20rpx;" v-for="aitem,aindex in item.waresOrderList"> <view class="list_flex" style="margin-top: 20rpx;" v-for="aitem,aindex in item.waresOrderList">
<view class="center_left"> <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 class="center_title">{{aitem.waresName}}</view>
</view> </view>
<view class="center_right"> <view class="center_right">
@ -495,4 +495,4 @@
} }
} }
</style> </style>

View File

@ -1,6 +1,6 @@
<!-- <!--
* @Descripttion: * @Descripttion:
* @version: * @version:
* @Author: kBank * @Author: kBank
* @Date: 2022-11-21 15:11:22 * @Date: 2022-11-21 15:11:22
--> -->
@ -11,16 +11,18 @@
<view>{{ zoneList[0].label }}</view> <view>{{ zoneList[0].label }}</view>
</view> --> </view> -->
<view class="goods"> <view class="goods">
<view class="goods_item" <view
v-for="item in goodsList" class="goods_item"
:key="item.pkId" v-for="item in goodsList"
@tap="goDetails(item)"> :key="item.pkId"
<img :src="item.cover1" @tap="goDetails(item)"
class="goodImg" >
alt=""> <img :src="item.cover || item.cover1" class="goodImg" alt="" />
<view class="goods_item_bom"> <view class="goods_item_bom">
<view class="tit1_flex"> <view class="tit1_flex">
<view class="tit2">{{ item.waresPrice | numberToCurrency | isLocal }}</view> <view class="tit2">{{
item.waresPrice | numberToCurrency | isLocal
}}</view>
<!-- <img class="shareImg" <!-- <img class="shareImg"
:src="shareImg" :src="shareImg"
@click.stop="openImg(item)" @click.stop="openImg(item)"
@ -28,29 +30,31 @@
</view> </view>
<view class="disFlex"> <view class="disFlex">
<view class="tit3"> <view class="tit3">
<span class="qzbq" <span class="qzbq" v-if="item.prefixLabelTarget != undefined"
v-if="item.prefixLabelTarget != undefined">[{{ item.prefixLabelTarget.label }}]</span> >[{{ item.prefixLabelTarget.label }}]</span
>
<span>{{ item.waresName }}</span> <span>{{ item.waresName }}</span>
</view> </view>
</view> </view>
<view class="disFlex"> <view class="disFlex">
<view class="tit4"> <view class="tit4">
{{'销量'}}:{{ item.sales | numberToCurrency |seles}} {{ '销量' }}:{{ item.sales | numberToCurrency | seles }}
</view> </view>
<view class="tit4" <view class="tit4" style="margin-left: 10px"
style="margin-left:10px">{{'业绩'}}:{{ item.waresAchieve | numberToCurrency}} >{{ '业绩' }}:{{ item.waresAchieve | numberToCurrency }}
</view> </view>
</view> </view>
<!-- <view class="addCar">{{ '加入购物车' }}</view> --> <!-- <view class="addCar">{{ '加入购物车' }}</view> -->
<view class="md"> <view class="md">
<img v-for="ctem in item.sellingLabelList" <img
v-show="item.sellingLabelList" v-for="ctem in item.sellingLabelList"
:key="ctem.pkId" v-show="item.sellingLabelList"
:src="ctem.labelImage||''" :key="ctem.pkId"
alt=""> :src="ctem.labelImage || ''"
alt=""
/>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
@ -69,17 +73,15 @@ export default {
computed: { computed: {
...mapGetters(['user']), ...mapGetters(['user']),
}, },
filters:{ filters: {
seles(value){ seles(value) {
if (value > 999) {
if(value>999){ return 999 + '+'
return 999 + '+' } else {
}else{ return value
return value }
}
}
}, },
},
data() { data() {
return { return {
title: '', title: '',
@ -156,9 +158,9 @@ export default {
.getAllGoods({ .getAllGoods({
specialArea: this.specialArea, specialArea: this.specialArea,
}) })
.then((res) => { .then(res => {
this.goodsList = res.data this.goodsList = res.data
this.goodsList.forEach((item) => { this.goodsList.forEach(item => {
if (item.waresName.length > 8) { if (item.waresName.length > 8) {
item.waresName = item.waresName.substring(0, 8) + '...' item.waresName = item.waresName.substring(0, 8) + '...'
} }
@ -171,9 +173,9 @@ export default {
source: this.source, source: this.source,
productCategory: this.productCategory, productCategory: this.productCategory,
}) })
.then((res) => { .then(res => {
this.goodsList = res.rows this.goodsList = res.rows
this.goodsList.forEach((item) => { this.goodsList.forEach(item => {
if (item.waresName.length > 8) { if (item.waresName.length > 8) {
item.waresName = item.waresName.substring(0, 8) + '...' item.waresName = item.waresName.substring(0, 8) + '...'
} }
@ -191,10 +193,12 @@ export default {
min-height: 94vh; min-height: 94vh;
} }
.index_header { .index_header {
background: #f9f9f9;; background: #f9f9f9;
height: 330rpx; height: 330rpx;
font-size: 18px; font-size: 18px;
font-family: PingFang SC-Semibold, PingFang SC; font-family:
PingFang SC-Semibold,
PingFang SC;
font-weight: 600; font-weight: 600;
color: #333333; color: #333333;
text-align: center; text-align: center;
@ -243,7 +247,9 @@ export default {
// width: 120rpx; // width: 120rpx;
text-align: center; text-align: center;
font-size: 14px; font-size: 14px;
font-family: PingFang SC-Semibold, PingFang SC; font-family:
PingFang SC-Semibold,
PingFang SC;
font-weight: 600; font-weight: 600;
color: #ed1d25; color: #ed1d25;
margin-right: 28rpx; margin-right: 28rpx;
@ -341,7 +347,9 @@ export default {
border: 1px solid #f33131; border: 1px solid #f33131;
border-radius: 6px; border-radius: 6px;
font-size: 12px; font-size: 12px;
font-family: PingFang SC-Semibold, PingFang SC; font-family:
PingFang SC-Semibold,
PingFang SC;
font-weight: 600; font-weight: 600;
color: #f33131; color: #f33131;
text-align: center; text-align: center;

View File

@ -157,7 +157,7 @@
<view class="popList_i" v-for="item in tableData" :key="item.pkId"> <view class="popList_i" v-for="item in tableData" :key="item.pkId">
<u-checkbox :name="item.pkId"> </u-checkbox> <u-checkbox :name="item.pkId"> </u-checkbox>
<view class="popList_ii"> <view class="popList_ii">
<img :src="item.cover1" alt="" /> <img :src="item.cover || item.cover1" alt="" />
<view> <view>
<view>{{ item.waresName }}</view> <view>{{ item.waresName }}</view>
<view>{{ item.waresCode }}</view> <view>{{ item.waresCode }}</view>

File diff suppressed because it is too large Load Diff