修复购物车多规格bug, 搜索记录bug
This commit is contained in:
parent
8850af2e9f
commit
4749269a09
@ -2,8 +2,8 @@
|
||||
"name" : "惠农生活",
|
||||
"appid" : "__UNI__3A527D1",
|
||||
"description" : "",
|
||||
"versionName" : "2.0.34",
|
||||
"versionCode" : 2034,
|
||||
"versionName" : "2.0.35",
|
||||
"versionCode" : 2035,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
|
@ -218,22 +218,22 @@
|
||||
},
|
||||
methods: {
|
||||
getHistoryList(){
|
||||
userLog({
|
||||
type: this.isShop ? 2 : 1, // 1是商品搜索记录, 2是店铺搜索记录
|
||||
}).then(res=>{
|
||||
this.historyList = res.data;
|
||||
})
|
||||
// try {
|
||||
// this.historyList = []
|
||||
// this.tempStorage = []
|
||||
// let arr = uni.getStorageSync('historyList')
|
||||
// if (arr.length > 0) {
|
||||
// this.historyList = arr
|
||||
// } else {
|
||||
// this.historyList = []
|
||||
// }
|
||||
// this.tempStorage = this.historyList
|
||||
// } catch (e) {}
|
||||
// userLog({
|
||||
// type: this.isShop ? 2 : 1, // 1是商品搜索记录, 2是店铺搜索记录
|
||||
// }).then(res=>{
|
||||
// this.historyList = res.data;
|
||||
// })
|
||||
try {
|
||||
this.historyList = []
|
||||
this.tempStorage = []
|
||||
let arr = uni.getStorageSync('historyList')
|
||||
if (arr.length > 0) {
|
||||
this.historyList = arr
|
||||
} else {
|
||||
this.historyList = []
|
||||
}
|
||||
this.tempStorage = this.historyList
|
||||
} catch (e) {}
|
||||
},
|
||||
// 清空历史记录
|
||||
remove() {
|
||||
@ -245,12 +245,13 @@
|
||||
if (res.confirm) {
|
||||
self.tempStorage = []
|
||||
try {
|
||||
userLogDelete({
|
||||
type: this.isShop ? 2 : 1,
|
||||
}).then(res=>{
|
||||
console.log(res);
|
||||
})
|
||||
// userLogDelete({
|
||||
// type: this.isShop ? 2 : 1,
|
||||
// }).then(res=>{
|
||||
// console.log(res);
|
||||
// })
|
||||
self.historyList = []
|
||||
uni.setStorageSync('historyList', self.historyList);
|
||||
} catch (e) {}
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
@ -292,6 +293,12 @@
|
||||
this.$set(this, 'searchValue', event.detail.value);
|
||||
},
|
||||
searchBut: function() {
|
||||
if(this.searchValue!='') {
|
||||
this.historyList.unshift({
|
||||
word: this.searchValue
|
||||
});
|
||||
uni.setStorageSync('historyList', this.historyList);
|
||||
}
|
||||
if (this.back) {
|
||||
return uni.navigateBack({
|
||||
success: () => {
|
||||
|
@ -176,7 +176,7 @@
|
||||
@ChangCouponsUseState="ChangCouponsUseState"></couponListWindow>
|
||||
</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>
|
||||
<Authorize :isShowAuth="isShowAuth"></Authorize>
|
||||
<!--自定义底部tab栏-->
|
||||
@ -254,6 +254,7 @@ import { Toast } from '../../libs/uniApi';
|
||||
}],
|
||||
tabsCurr: 1,
|
||||
subsecCurr: 0,
|
||||
addcartKey: 0,
|
||||
domain: HTTP_REQUEST_URL,
|
||||
loading: false, //是否加载中
|
||||
loadend: false, //是否加载完毕
|
||||
@ -299,6 +300,7 @@ import { Toast } from '../../libs/uniApi';
|
||||
currSku: '',
|
||||
newData: {},
|
||||
activeRouter: '',
|
||||
attrTxt: '',
|
||||
userInfo: {},
|
||||
mer_info: {
|
||||
mer_settlement_agree_status: 0
|
||||
@ -505,7 +507,7 @@ import { Toast } from '../../libs/uniApi';
|
||||
// that.DefaultSelect(goods)
|
||||
cartProductAttr(id).then(res => {
|
||||
if(res.data.attr.length==0)return Toast('此商品为单规格商品');
|
||||
const sku = {}
|
||||
const sku = {};
|
||||
res.data.attrValue.forEach((itemn) => {
|
||||
if(this.tabsCurr==2) itemn.price = itemn.wholesale_price; //把价格设置为批发价
|
||||
sku[itemn.sku] = itemn;
|
||||
@ -520,6 +522,7 @@ import { Toast } from '../../libs/uniApi';
|
||||
that.$set(that, 'productValue', sku);
|
||||
let productSelect = sku[that.attrValue];
|
||||
that.isOpen = that.attr.cartAttr = true;
|
||||
this.newVal = sku[goods.productAttr.sku] || Object.keys(sku)[0];
|
||||
that.DefaultSelect(goods)
|
||||
}).catch(err => {
|
||||
return that.$util.Tips({
|
||||
|
Loading…
x
Reference in New Issue
Block a user