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