Commit 27fa9bd0 by 张立顺

bug修复

1 parent aa501146
......@@ -54,6 +54,9 @@ App({
},
login(relogin, context) {
// debugger
// util.debounce( this.test,1000)
// return
// console.log(relogin, 'relogin')
let that = this
// 清空多账号信息
......@@ -78,6 +81,9 @@ App({
}
})
} else {
// 标志位 解决安卓查复弹框问题
if (wx.__HAS_NOTLOGIN_MODAL) return false
wx.__HAS_NOTLOGIN_MODAL = true
wx.showModal({
title: '温馨提示',
content: context || '登录过期,请重新登录。',
......@@ -92,7 +98,14 @@ App({
wx.$relogin = relogin
router.reLaunch('pages.wxLogin')
}
}
},
complete: () => {
// 这个延迟的目的是为了避免短时间内重复弹出
// 你要是没有这个需要也可以去掉,直接把标志位改成 false 就行
setTimeout(() => {
wx.__HAS_NOTLOGIN_MODAL = false;
}, 2000);
}
})
}
} else {
......@@ -104,12 +117,77 @@ App({
router.reLaunch('pages.wxLogin')
}
},
test (){
// console.log('loginOut');
// this.debounceWithParams()
const count = this.globalData.count
console.log(this.globalData.count);
let that = this
console.log(this.globalData.count,'globalData.count');
if (count) {
clearTimeout(this.globalData.count)
this.globalData.count = setTimeout(()=>{
// console.log('object');
console.log(that.globalData.count);
that.globalData.count = null
console.log('that.globalData.count',that.globalData.count);
},2000)
}else{
this.globalData.count = setTimeout(()=>{
// console.log('object');
console.log(that.globalData.count);
that.globalData.count = null
console.log('that.globalData.count',that.globalData.count);
},2000)
}
// globalData.count = setTimeout(()=>{
// console.log('object');
// console.log(globalData.count);
// },2000)
// globalData.count++
// setTimeout
// let timeCount
// console.log(timeCount);
// if (timeCount) {
// clearTimeout(timeCount)
// timeCount = setTimeout(()=>{
// console.log('这是一个寂寞的天');
// },1000)
// }else{
// timeCount = setTimeout(()=>{
// console.log('这是一个寂寞的天');
// },1000)
// }
// function doSomething() {
// console.log("Doing something!");
// }
// const debouncedDoSomething = util.debounce(doSomething, 500, false);
// debouncedDoSomething()
},
debounceWithParams(callback, delay) {
let timeoutId; // 用于保存定时器ID
return function (...args) {
const executeLater = function () {
// 定义一个延迟执行的函数
timeoutId = null; // 清空定时器ID,用于标记函数可以再次执行
callback(...args); // 执行回调函数,并将参数传递给回调函数
};
clearTimeout(timeoutId); // 清除之前的定时器
timeoutId = setTimeout(executeLater, delay); // 创建一个新的定时器
};
},
globalData: {
statusBarHeight: wx.getSystemInfoSync()['statusBarHeight'], // 头部导航栏的高度
yqdInfo: {},
isYqdSuper: true,
isStaff: false,
YQorderSetting: ''
YQorderSetting: '',
count:'',
}
})
......@@ -94,10 +94,11 @@ Component({
let value = e.detail
let { attr, item } = e.target.dataset
let { dataAttrName } = this.data
if (attr == 'price') {
value = value >= 2000000 ? '2000000' : value
wx.$eventbus.emit('delete_goodsSelect')
}
// if (attr == 'price') {
// value = value >= 2000000 ? '2000000' : value
// // wx.$eventbus.emit('delete_goodsSelect')
// }
// console.log(item,'handleInput');
let thisPage = wx.$router.getPageInstance()
if (item.inputLimit && item.inputLimit.maxVal) {
value = value >= item.inputLimit.maxVal ? item.inputLimit.maxVal : value
......@@ -113,9 +114,14 @@ Component({
value = number
}
}
const diffValue = value.toString()
const trimValue = value.toString().trim()
if (diffValue != trimValue) {
value = trimValue
}
thisPage.setData({
[dataAttrName + '.' + attr]: value.toString().trim()
// [dataAttrName + '.' + attr]: value
[dataAttrName + '.' + attr]: value
})
},
handlePickerChange(e) {
......
......@@ -215,6 +215,7 @@ Page({
userInfo: { ...wx.$util.getUserInfo(), default4SStoreInfo }
})
this.getMerchant4SMode()
this.initList()
},
initList() {
let { tabIndex } = this.data
......
{
"component": true,
"usingComponents": {
"custom-content": "/components/ContentHiden/content"
}
}
......@@ -72,6 +72,9 @@ Component({
formRule[item][0].required = false
})
}
this.setData({
formRule
})
},
// 删除图片
......
......@@ -57,13 +57,18 @@ Component({
*/
methods: {
dealFormRule() {
var { formData, formRule } = this.data
let formData = this.getPageData()
var { formRule } = this.data
const list = ['tireBrand', 'frontTireSpecification', 'rearTireSpecification']
if(formData && formData.tireFlag == 0) {
list.forEach(item => {
formRule[item][0].required = false
})
}
console.log(formRule);
this.setData({
formRule
})
},
handleUpDown(e) {
let { attr } = e.currentTarget.dataset
......
......@@ -36,9 +36,10 @@ page {
.prevIcon {
margin-left: auto;
margin-right: 20prx;
}
.downloadIcon{
margin-left: 20prx;}
.icon {
width: 40rpx;
height: 40rpx;
......
......@@ -8,10 +8,10 @@
<!-- <image src="" binderror="" bindload=""></image> -->
<!-- <view class="arrow"></view> -->
<view class="icon prevIcon" bindtap="handlePreviewContract" data-target="{{ item }}">
<image webp="{{ true }}" src="../../image/previewIcon.webp" mode="" binderror="" bindload=""></image>
<image wepb="true" src="../../image/previewIcon.png" mode="" binderror="" bindload=""></image>
</view>
<view class="icon" bindtap="handlePreviewContract" data-target="{{ item }}" data-type="download">
<image webp="{{ true }}" src="../../image/downloadIcon.webp" mode="" binderror="" bindload=""></image>
<view class="icon downloadIcon" bindtap="handlePreviewContract" data-target="{{ item }}" data-type="download">
<image wepb="true" src="../../image/downloadIcon.png" mode="" binderror="" bindload=""></image>
</view>
</view>
</view>
......
......@@ -33,6 +33,9 @@ Page({
},
selectPayType: 1
},
back() {
wx.$router.back()
},
async changePayType(e) {
console.log(e)
// pos支付
......
......@@ -20,7 +20,6 @@ Component({
},
minPrice: {
type: Number
// value:0
}
},
......@@ -29,53 +28,72 @@ Component({
*/
data: {
goodsList: [],
test: () => {
return false
}
recordList: [],
// totalGoodsList:[],
},
/**
* 组件的方法列表
*/
methods: {
cancel (){
let {goodsData} = this.data
this.setData({
goodsList: goodsData,
})
this.setGoodsActive()
},
setGoodsActive() {
let { chooseGoodsList, goodsList } = this.data
let {
chooseGoodsList,
goodsList,
recordList
} = this.data
if (chooseGoodsList.length == 0) {
goodsList.forEach(e => {
e.active = false
// e.map(c => (c.active = false))
})
recordList.forEach(e => {
e.active = false
})
} else {
// let indexList = []
// debugger
goodsList.map((e, index) => {
// e.upgradeGoodsList.map((c, ind) => {
e.active = false
chooseGoodsList.map(s => {
console.log(s.goodsId == e.id, 's.id == e.id')
if (s.goodsId == e.id) {
e.active = true
}
})
// })
})
// indexList.map(e => {
// goodsList[e.index].upgradeGoodsList[e.ind].active = true
// })
recordList.map((e, index) => {
e.active = false
chooseGoodsList.map(s => {
if (s.goodsId == e.id) {
e.active = true
}
})
})
}
this.setData({
goodsList
goodsList,
recordList
})
},
getOrderBaseGoodsList(data) {
this.setData({
goodsList: data
goodsList: data,
recordList: data
})
},
getChooseList() {
let { goodsList, chooseGoodsList } = this.data
let {
// goodsList,
recordList,
chooseGoodsList
} = this.data
let chooseList = []
goodsList.map(c => {
recordList.map(c => {
// e.upgradeGoodsList.map(c => {
if (c.active) {
if (!c.count) c.count = 1
......@@ -98,9 +116,18 @@ Component({
return chooseList
},
choose(e) {
let { item, index, ind } = e.currentTarget.dataset
let { active } = item
let { minPrice } = this.data
let {
item,
index,
ind
} = e.currentTarget.dataset
let {
active
} = item
let {
minPrice,
recordList
} = this.data
// item
// console.log(item)
// console.log(minPrice)
......@@ -111,12 +138,20 @@ Component({
// 太阳膜类商品 未配置部位不可选择
// if (item?.goodsInfo?.goodsType == 1 && !item.merchantGoodsPosition) return false
let target = `goodsList[${ind}].active`
let recordIndex = recordList.findIndex(el=>el.id == item.id )
this.setData({
[`recordList[${recordIndex}].active`]:!active,
[target]: !active
})
},
addCount(e) {
let { index, count, item, ind } = e.currentTarget.dataset
let {
index,
count,
item,
ind
} = e.currentTarget.dataset
let target = `goodsList[${index}].upgradeGoodsList[${ind}].count`
if (!item.count) item.count = 1
item.count += count
......@@ -127,9 +162,14 @@ Component({
})
},
input(e) {
let { index, ind } = e.currentTarget.dataset
let {
index,
ind
} = e.currentTarget.dataset
let target = `goodsList[${index}].upgradeGoodsList[${ind}].count`
let { value } = e.detail
let {
value
} = e.detail
if (value < 1) value = 1
if (value > 999) value = 999
this.setData({
......@@ -137,16 +177,21 @@ Component({
})
},
searchGoods(e) {
let { goodsData } = this.data
let { value } = e.detail
let {
goodsData,
recordList
} = this.data
let {
value
} = e.detail
if (!value) {
this.getOrderBaseGoodsList(goodsData)
setTimeout(() => {
this.setGoodsActive()
}, 500)
this.getOrderBaseGoodsList(recordList)
// setTimeout(() => {
// this.setGoodsActive()
// }, 500)
return
}
let _DATA_ = JSON.parse(JSON.stringify(goodsData))
let _DATA_ = JSON.parse(JSON.stringify(recordList))
let arr = []
_DATA_.map(c => {
let upgradeGoodsList = []
......@@ -170,7 +215,9 @@ Component({
confirm() {
let chooseList = this.getChooseList()
let { goodsList } = this.data
let {
goodsList
} = this.data
if (goodsList.length < 1) return
if (!chooseList.length) return wx.$util.showToast('请勾选商品')
this.triggerEvent('confirm', chooseList)
......@@ -191,4 +238,4 @@ Component({
})
}
}
})
})
\ No newline at end of file
<wxs src="index.wxs" module="filter" />
<popup show="{{show}}" title="选择商品" bindconfirm="confirm">
<popup show="{{show}}" title="选择商品" bindconfirm="confirm" bindcancel="cancel">
<view class="coupon-box">
<search-input bindsearch="searchGoods" />
<scroll-view class="coupon" scroll-y>
......@@ -24,7 +24,8 @@
data-ind="{{ind}}"
data-item="{{i}}">
<view class="name text-hide ">
<view>{{filter.replaceItemText(i.upgradeGoodsAlias) ||filter.replaceItemText(i.upgradeGoodsName) || filter.replaceItemText(i.goodsInfo.goodsName)}}</view>
<!-- filter.replaceItemText(i.upgradeGoodsAlias) || -->
<view>{{filter.replaceItemText(i.upgradeGoodsName) || filter.replaceItemText(i.goodsInfo.goodsName)}}</view>
<!-- <text wx:if="{{i.merchantGoodsPosition && i.goodsInfo.goodsType == 1}}">{{'「' + i.positionStr+'」'}}</text> -->
<view class="serveName">(包含{{i.serveName}})</view>
<!-- <text class="warning_text" wx:if="{{!i.merchantGoodsPosition && i.goodsInfo.goodsType == 1}}">无部位</text> -->
......
......@@ -119,7 +119,7 @@ Component({
}
console.log(item.shopMinPrice||0,'item?.shopMinPrice||0');
if ((item.shopMinPrice||0) > value) {
wx.$util.showToast('单价不可低于商品最低价')
return wx.$util.showToast('单价不可低于商品最低价')
}
thisPage.setData({
......@@ -142,9 +142,10 @@ Component({
setGoodsListTotal () {
let thisPage = wx.$router.getPageInstance()
let {orderInfo} = thisPage.data
// console.log(orderInfo,'orderInfo');
let total = 0
orderInfo.vdQuotationGoodsList.map(i => (total += i.count * i.price))
orderInfo.vdQuotationGoodsList.map(i => (total += parseFloat(i.count||1) * parseFloat(i.price)))
// console.log(total,'total');
thisPage.setData({
['orderInfo.total']:wx.$util.decimal(total, 2)
})
......
......@@ -7,7 +7,6 @@
"van-collapse-item": "@vant/weapp/collapse-item/index",
"van-checkbox": "@vant/weapp/checkbox/index",
"popup-input": "../PopupInput/PopupInput",
"custom-content": "/components/ContentHiden/content",
"goods": "../Goods/Goods"
}
}
......@@ -57,9 +57,9 @@ const scrmSecretKey_items = {
const domain_items = {
ip: {
// dj: 'http://192.168.1.165:8292',
// dj: 'http://192.168.1.170:8292', //叶立庆
dj: 'http://192.168.1.170:8292', //叶立庆
// dj: 'http://192.168.1.169:8292',//蔡远明
dj: 'http://192.168.1.174:8292',//范富荣
// dj: 'http://192.168.1.174:8292',//范富荣
// dj: 'http://192.168.1.203:8292',//周杭
// dj: 'http://192.168.1.53:8292',//陈希
// dj:'http://192.168.2.59:8292/',//周立明
......
......@@ -48,11 +48,6 @@ class Request {
getApp().login(true)
}
}
// else if (code == 32){
// resolve(data)
// // console.log(subErrors);
// throw subErrors
// }
else if (code == -1) {
wx.showToast({
title: message || '网络请求失败',
......@@ -60,6 +55,8 @@ class Request {
})
resolve(data)
} else {
// util.debounce( getApp().test(true),500)
// getApp().test()
resolve(data)
}
},
......
......@@ -226,6 +226,38 @@ const pointRecord = clickEventType => {
console.log('burialPointRecord', res)
})
}
/**
* 函数防抖:在指定的时间内,如果连续触发事件,则只执行一次,避免频繁触发。
* @param {Function} func - 要防抖的函数。
* @param {number} delay - 防抖的时间间隔,单位毫秒。
* @param {boolean} immediate - 是否立即执行一次。若为true,第一次触发会立即执行一次函数。
* @returns {Function} - 返回一个经过防抖处理的函数。
*/
const debounce = (func, delay, immediate)=> {
let timeoutId; // 用于保存定时器ID
return function (...args) {
const context = this; // 保存函数执行时的上下文环境
const executeLater = function () {
// 定义一个延迟执行的函数
timeoutId = null; // 清空定时器ID,用于标记函数可以再次执行
if (!immediate) {
// 如果不是立即执行模式,则执行函数
func.apply(context, args);
}
};
const callNow = immediate && !timeoutId; // 是否立即执行的条件
clearTimeout(timeoutId); // 清除之前的定时器
timeoutId = setTimeout(executeLater, delay); // 创建一个新的定时器
if (callNow) {
// 如果满足立即执行的条件,则立即执行函数
func.apply(context, args);
}
};
}
const util = {
onReachBottom,
......@@ -247,7 +279,8 @@ const util = {
deepClone,
getTimeState,
checkRule,
pointRecord
pointRecord,
debounce
}
const Util = Object.assign(util, wxApi, format)
// console.log('Util', Util)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!