Merge branch 'dev' into test

This commit is contained in:
lifizer
2024-09-26 10:10:28 +08:00
10 changed files with 487 additions and 409 deletions
+9
View File
@@ -25,6 +25,15 @@ export function getProductDetail(id, data) {
}); });
} }
/*
* 商品规格选中
* */
export function getProductSkuBySelected(data) {
return request.post("/product/getSkuBySelected", data, {
login: true
});
}
/* /*
* 商品分销二维码 * 商品分销二维码
* */ * */
+59 -62
View File
@@ -2,38 +2,42 @@
<view> <view>
<view class="product-window" :class="attr.cartAttr === true ? 'on' : ''"> <view class="product-window" :class="attr.cartAttr === true ? 'on' : ''">
<view class="textpic acea-row row-between-wrapper"> <view class="textpic acea-row row-between-wrapper">
<view class="pictrue" @click="previewImg(attr.productSelect.image)"> <view class="pictrue" @click="previewImg(attrObj.productSelect.image)">
<image :src="attr.productSelect.image" class="image" /> <image :src="attrObj.productSelect.image" class="image" />
</view> </view>
<view class="text"> <view class="text">
<view class="money font-color-lightred v12-font-"> <view class="money font-color-lightred v12-font-">
¥ ¥
<text class="num v12-font-40">{{ attr.productSelect.price }}</text> <text class="num v12-font-40">{{ attrObj.productSelect.price }}</text>
<text class="v12-ml-2 v12-font-weight-300 v12-font-22" style="color: #BBBBBB; text-decoration: line-through;">¥</text> <text class="v12-ml-2 v12-font-weight-300 v12-font-22" style="color: #BBBBBB; text-decoration: line-through;">¥</text>
<text class="v12-mr-2 v12-font-weight-300 v12-font-22" style="color: #BBBBBB; text-decoration: line-through;">{{ attr.productSelect.otPrice }}</text> <text class="v12-mr-2 v12-font-weight-300 v12-font-22" style="color: #BBBBBB; text-decoration: line-through;">{{ attrObj.productSelect.otPrice }}</text>
<text class="v12-white-text v12-red v12-font-22 v12-radius-40 v12-px-1 v12-font-weight-400">会员价</text> <text class="v12-white-text v12-red v12-font-22 v12-radius-40 v12-px-1 v12-font-weight-400">会员价</text>
<!-- <text class="stock">库存: {{ attr.productSelect.stock }}</text> --> <!-- <text class="stock">库存: {{ attrObj.productSelect.stock }}</text> -->
</view> </view>
<view class="more-t">{{ attr.productSelect.store_name }}</view> <view class="more-t">{{ attrObj.productSelect.store_name }}</view>
</view> </view>
<view class="iconfont icon-guanbi" @click="closeAttr"></view> <view class="iconfont icon-guanbi" @click="closeAttr"></view>
</view> </view>
<view class="productWinList"> <view class="productWinList">
<view class="item" v-for="(item, indexw) in attr.productAttr" :key="indexw"> <view
v-for="(item, index) in attrObj.productAttr"
:key="index"
class="item"
>
<view class="title">{{ item.attrName }}</view> <view class="title">{{ item.attrName }}</view>
<view class="listn acea-row v12-justify-start"> <view class="listn acea-row v12-justify-start">
<view <view
v-for="(itemn, indexn) in item.attrValue" v-for="(subItem, subIndex) in item.attrValue"
:key="indexn" :key="subIndex"
:class="{ :class="{
'actived': item.index == indexn, 'actived': subItem.check,
'disabled': getAttrItemData(itemn.attr).stock === 0 'disabled': !subItem.canUsed
}" }"
class="itemn v12-radius-40" class="itemn v12-radius-40"
@click="tapAttr(indexw, indexn, itemn)" @click="tapAttr(index, subIndex, subItem)"
> >
{{ itemn.attr }} {{ subItem.attr }}
<text v-if="getAttrItemData(itemn.attr).stock === 0" class="less-tag" style="color: #fff !important;">缺货</text> <text v-if="!subItem.canUsed" class="less-tag" style="color: #fff !important;">缺货</text>
</view> </view>
</view> </view>
</view> </view>
@@ -47,7 +51,7 @@
style="border-radius:0 40rpx 40rpx 0" style="border-radius:0 40rpx 40rpx 0"
class="item plus v12-font-bold v12-white-text v12-primary v12-primary-border v12-font-36 cart-btn" class="item plus v12-font-bold v12-white-text v12-primary v12-primary-border v12-font-36 cart-btn"
:class=" :class="
cartNum >= attr.productSelect.stock cartNum >= attrObj.productSelect.stock
? 'on' ? 'on'
: '' : ''
" "
@@ -71,82 +75,75 @@ export default {
} }
} }
}, },
// 使用字符串再转成对象的原因是,当key='2.5g'时,会变成key='2',导致数据丢失
productValueStr: {
type: String,
default: '{}'
},
productValueArr: {
type: Array,
default: () => {
return []
}
},
cartNum: { cartNum: {
type: Number, type: Number,
default: () => 1 default: () => 1
} }
}, },
data() {
return {
attrObj: {
productSelect: {},
productAttr: []
}
}
},
created() {
this.$set(this, 'attrObj', JSON.parse(JSON.stringify(this.attr)))
console.log(this.attrObj)
},
methods: { methods: {
previewImg:function(imgUrl){ reRender(data) {
this.$set(this, 'attrObj', JSON.parse(JSON.stringify(data)))
// console.log(this.attrObj.productAttr)
this.$forceUpdate()
},
previewImg(imgUrl) {
uni.previewImage({ uni.previewImage({
urls:[imgUrl] urls:[imgUrl]
}) })
}, },
closeAttr: function() { closeAttr() {
this.$emit("changeFun", { action: "changeattr", value: false }) this.$emit("changeFun", { action: "changeattr", value: false })
}, },
CartNumDes: function() { CartNumDes() {
this.$emit("changeFun", { action: "ChangeCartNum", value: false }) this.$emit("changeFun", { action: "ChangeCartNum", value: false })
}, },
CartNumAdd: function() { CartNumAdd() {
this.$emit("changeFun", { action: "ChangeCartNum", value: 1 }) this.$emit("changeFun", { action: "ChangeCartNum", value: 1 })
}, },
getAttrItemData(attr) { tapAttr(index, subIndex, subItem) {
let result = { // 缺货的点击了没效果
stock: 0 if (!subItem.canUsed || subItem.check) {
}
if (this.attr.productAttr.length === 1) {
this.productValueArr.map(item => {
if (item.attrItemkey === attr) {
result = item
}
})
} else {
result.stock = 1
}
return result
},
tapAttr: function(indexw, indexn, itemn) {
if (this.getAttrItemData(itemn.attr).stock === 0) {
return return
} }
// 修改商品规格不生效的原因: this.attrObj.productAttr[index].attrValue.map((subItem, subIdx) => {
// H5端下面写法,attr更新,但是除H5外其他端不支持, subItem.check= false
// 尽量避免下面的骚写法,不要在子组件内更新props if (subIndex === subIdx) {
// 这里修改是为了能获取到被选中的属性 subItem.check = true
this.attr.productAttr[indexw].index = indexn }
})
const value = this.getCheckedValue().sort().join(",") const value = this.getCheckedValue().sort().join(",")
this.$emit("changeFun", { this.$emit("changeFun", {
action: "ChangeAttr", action: "ChangeAttr",
value: { value: {
value, value,
indexw, index,
indexn subIndex
} }
}) })
}, },
// 获取被选中属性 // 获取被选中属性
getCheckedValue: function() { getCheckedValue() {
const productAttr = this.attr.productAttr const productAttr = this.attrObj.productAttr
const value = [] const value = []
for (let i = 0; i < productAttr.length; i++) { productAttr.map(item => {
for (let j = 0; j < productAttr[i].attrValueArr.length; j++) { item.attrValue.map(subItem => {
if (productAttr[i].index === j) { if (subItem.check) {
value.push(productAttr[i].attrValueArr[j]) value.push(subItem.attr)
} }
} })
} })
return value return value
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name" : "地标文化特产", "name" : "地标文化特产",
"appid" : "__UNI__7880B21", "appid" : "__UNI__281C173",
"description" : "", "description" : "",
"versionName" : "4.0.0", "versionName" : "4.0.0",
"versionCode" : 4, "versionCode" : 4,
+5 -1
View File
@@ -19,7 +19,11 @@
<u-icon name="arrow-down"></u-icon> <u-icon name="arrow-down"></u-icon>
</view> </view>
</view> </view>
<view class="v12-font-28 v12-font-bold v12-dark-text" @click="editCart">{{ isEdit ? '完成' : '管理' }}</view> <view
v-if="list.length > 0"
class="v12-font-28 v12-font-bold v12-dark-text"
@click="editCart"
>{{ isEdit ? '完成' : '管理' }}</view>
</view> </view>
<view <view
v-if="list.length === 0" v-if="list.length === 0"
+3 -3
View File
@@ -300,9 +300,9 @@ export default {
padding: 20rpx 20rpx 0 20rpx; padding: 20rpx 20rpx 0 20rpx;
.item { .item {
width: 185rpx; width: 154rpx;
height: 185rpx; height: 154rpx;
margin-right: 20rpx; // margin-right: 20rpx;
border-radius: 26rpx; border-radius: 26rpx;
image { image {
File diff suppressed because it is too large Load Diff
+5
View File
@@ -459,6 +459,11 @@ export default {
uni.hideLoading() uni.hideLoading()
}).catch(err => { }).catch(err => {
uni.hideLoading() uni.hideLoading()
if (err.toLogin) {
uni.reLaunch({
url: '/pages/authorization/index'
})
}
}).finally(() => { }).finally(() => {
uni.hideLoading() uni.hideLoading()
}) })
+2 -2
View File
@@ -157,9 +157,9 @@
</view> </view>
<image <image
v-if="!searchEvent" v-if="!searchEvent"
:src="webUrl + '/orderIcon/nodata.png'" :src="webUrl + '/home/no-data-bg.png'"
mode="widthFix" mode="widthFix"
class="loadend v12-mt-16" class="loadend"
/> />
</view> </view>
<image <image
+2 -2
View File
@@ -494,7 +494,7 @@
</view> </view>
</view> </view>
</view> </view>
<view v-else class="no-data">暂无村屋资讯</view> <view v-else class="no-data">暂无租售资讯</view>
</view> </view>
</view> </view>
</view> </view>
@@ -655,7 +655,7 @@ export default {
industryTab: [ industryTab: [
{ name: '产业项目', icon: '/page/qianxian/icon-04.png' }, { name: '产业项目', icon: '/page/qianxian/icon-04.png' },
{ name: '招商政策', icon: '/page/qianxian/icon-03.png' }, { name: '招商政策', icon: '/page/qianxian/icon-03.png' },
{ name: '村屋资讯', icon: '/page/qianxian/icon-07.png' } { name: '租售资讯', icon: '/page/qianxian/icon-07.png' }
], ],
industryTabIndex: 0, industryTabIndex: 0,
// 产品 // 产品
@@ -140,7 +140,7 @@
<rich-text :nodes="inn.content" /> <rich-text :nodes="inn.content" />
</view> </view>
</view> </view>
<!-- 村屋资讯 --> <!-- 租售资讯 -->
<view <view
v-if="activeIndex === 2" v-if="activeIndex === 2"
class="info-section" class="info-section"