修复购物车多规格bug, 搜索记录bug

This commit is contained in:
weipengfei 2024-04-19 09:35:35 +08:00
parent 8850af2e9f
commit 4749269a09
3 changed files with 35 additions and 25 deletions

View File

@ -2,8 +2,8 @@
"name" : "惠农生活", "name" : "惠农生活",
"appid" : "__UNI__3A527D1", "appid" : "__UNI__3A527D1",
"description" : "", "description" : "",
"versionName" : "2.0.34", "versionName" : "2.0.35",
"versionCode" : 2034, "versionCode" : 2035,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {

View File

@ -218,22 +218,22 @@
}, },
methods: { methods: {
getHistoryList(){ getHistoryList(){
userLog({ // userLog({
type: this.isShop ? 2 : 1, // 1, 2 // type: this.isShop ? 2 : 1, // 1, 2
}).then(res=>{ // }).then(res=>{
this.historyList = res.data; // this.historyList = res.data;
}) // })
// try { try {
// this.historyList = [] this.historyList = []
// this.tempStorage = [] this.tempStorage = []
// let arr = uni.getStorageSync('historyList') let arr = uni.getStorageSync('historyList')
// if (arr.length > 0) { if (arr.length > 0) {
// this.historyList = arr this.historyList = arr
// } else { } else {
// this.historyList = [] this.historyList = []
// } }
// this.tempStorage = this.historyList this.tempStorage = this.historyList
// } catch (e) {} } catch (e) {}
}, },
// //
remove() { remove() {
@ -245,12 +245,13 @@
if (res.confirm) { if (res.confirm) {
self.tempStorage = [] self.tempStorage = []
try { try {
userLogDelete({ // userLogDelete({
type: this.isShop ? 2 : 1, // type: this.isShop ? 2 : 1,
}).then(res=>{ // }).then(res=>{
console.log(res); // console.log(res);
}) // })
self.historyList = [] self.historyList = []
uni.setStorageSync('historyList', self.historyList);
} catch (e) {} } catch (e) {}
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击取消'); console.log('用户点击取消');
@ -292,6 +293,12 @@
this.$set(this, 'searchValue', event.detail.value); this.$set(this, 'searchValue', event.detail.value);
}, },
searchBut: function() { searchBut: function() {
if(this.searchValue!='') {
this.historyList.unshift({
word: this.searchValue
});
uni.setStorageSync('historyList', this.historyList);
}
if (this.back) { if (this.back) {
return uni.navigateBack({ return uni.navigateBack({
success: () => { success: () => {

View File

@ -176,7 +176,7 @@
@ChangCouponsUseState="ChangCouponsUseState"></couponListWindow> @ChangCouponsUseState="ChangCouponsUseState"></couponListWindow>
</block> </block>
<!-- 组件 --> <!-- 组件 -->
<addcartWindow :attr="attr" :isShow='1' :iSplus='1' :destri='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr" <addcartWindow :key="addcartKey" :attr="attr" :isShow='1' :iSplus='1' :destri='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr"
@goCat="goCat" @attrVal="attrVal" id='product-window'></addcartWindow> @goCat="goCat" @attrVal="attrVal" id='product-window'></addcartWindow>
<Authorize :isShowAuth="isShowAuth"></Authorize> <Authorize :isShowAuth="isShowAuth"></Authorize>
<!--自定义底部tab栏--> <!--自定义底部tab栏-->
@ -254,6 +254,7 @@ import { Toast } from '../../libs/uniApi';
}], }],
tabsCurr: 1, tabsCurr: 1,
subsecCurr: 0, subsecCurr: 0,
addcartKey: 0,
domain: HTTP_REQUEST_URL, domain: HTTP_REQUEST_URL,
loading: false, // loading: false, //
loadend: false, // loadend: false, //
@ -299,6 +300,7 @@ import { Toast } from '../../libs/uniApi';
currSku: '', currSku: '',
newData: {}, newData: {},
activeRouter: '', activeRouter: '',
attrTxt: '',
userInfo: {}, userInfo: {},
mer_info: { mer_info: {
mer_settlement_agree_status: 0 mer_settlement_agree_status: 0
@ -505,7 +507,7 @@ import { Toast } from '../../libs/uniApi';
// that.DefaultSelect(goods) // that.DefaultSelect(goods)
cartProductAttr(id).then(res => { cartProductAttr(id).then(res => {
if(res.data.attr.length==0)return Toast('此商品为单规格商品'); if(res.data.attr.length==0)return Toast('此商品为单规格商品');
const sku = {} const sku = {};
res.data.attrValue.forEach((itemn) => { res.data.attrValue.forEach((itemn) => {
if(this.tabsCurr==2) itemn.price = itemn.wholesale_price; // if(this.tabsCurr==2) itemn.price = itemn.wholesale_price; //
sku[itemn.sku] = itemn; sku[itemn.sku] = itemn;
@ -520,6 +522,7 @@ import { Toast } from '../../libs/uniApi';
that.$set(that, 'productValue', sku); that.$set(that, 'productValue', sku);
let productSelect = sku[that.attrValue]; let productSelect = sku[that.attrValue];
that.isOpen = that.attr.cartAttr = true; that.isOpen = that.attr.cartAttr = true;
this.newVal = sku[goods.productAttr.sku] || Object.keys(sku)[0];
that.DefaultSelect(goods) that.DefaultSelect(goods)
}).catch(err => { }).catch(err => {
return that.$util.Tips({ return that.$util.Tips({