Commit 4922c052 by chenwq

按钮重复点击;详情页loading加到800ms

1 parent 33f943dd
......@@ -64,7 +64,7 @@ Component({
setTimeout(() => {
wx.hideLoading()
this.getImgHeight()
}, 400)
}, 800)
},
},
......
......@@ -118,9 +118,11 @@ page {
.crowd-video {
width: calc(100% - 64rpx);
height: 386rpx;
position: absolute;
top: 264rpx;
margin: 0 32rpx;
border-radius: 16rpx;
}
.more-btn {
......
......@@ -2,7 +2,7 @@
const navStyle = 'background-color: transparent;'
import { IMG_URL } from '~/utils/constantData.js'
import applyApi from '~/api/applyApi/index'
import { addCoProductApi } from '~/api/applyProd.js'
import { addCoProductApi } from '~/api/applyProd.js'
// `${IMG_URL}index/car2.png`,
//本地图片路径
let IMG_URLLocal = '../../images/'
......@@ -24,7 +24,8 @@ Page({
}, {
title: '申请产品',
name: 2
}]
}],
isLoading: false
},
// computed: {
// hasProdAct(data) {
......@@ -47,6 +48,9 @@ Page({
},
// 申请业务
applyBusiness() {
if (this.data.isLoading) {
return
}
const subCompData = this.selectComponent('#apply-business').data
let { name } = subCompData.carObj
// console.log('name: ', name)
......@@ -63,7 +67,7 @@ Page({
let { carObj, selectProdArr } = subCompData
let { clueId } = this.data
let selectProdArrStr = ''
selectProdArr.forEach((item,index)=>{selectProdArrStr+=`${item.productName}${selectProdArr.length-1 == index?'':';'}`})
selectProdArr.forEach((item, index) => { selectProdArrStr += `${item.productName}${selectProdArr.length - 1 == index ? '' : ';'}` })
let { userInfo } = wx.$storage.get()
let MerchantInfo = userInfo.subLoginUser
......@@ -77,9 +81,11 @@ Page({
carType: carObj.model,
baseCustomer: carObj.selNum,
clueId,
intentProducts:selectProdArrStr
intentProducts: selectProdArrStr
}
this.setData({
isLoading: true
})
// return wx.$api.showToast('申请成功')
applyApi
.merchantApply(params)
......@@ -94,10 +100,17 @@ Page({
}, 1000)
}
})
.catch(err => {})
.catch(err => {
this.setData({
isLoading: false
})
})
},
// 申请产品
applyProduct() {
if (this.data.isLoading) {
return
}
const subCompData = this.selectComponent('#apply-product').data
let { prodName, selectStoreItem } = subCompData
if (!prodName) {
......@@ -107,7 +120,7 @@ Page({
})
return
}
if(utils.isEmptyObj(selectStoreItem)){
if (utils.isEmptyObj(selectStoreItem)) {
wx.pro.showToast({
title: '请选择合作门店',
icon: 'error'
......@@ -118,27 +131,34 @@ Page({
this.submitProductForm(subCompData)
},
async submitProductForm(subCompData) {
let {prodName,selectStoreItem} = subCompData
let { prodName, selectStoreItem } = subCompData
let userInfo = wx.$storage.get('userInfo')
let params = {
let params = {
...selectStoreItem,
serviceMerchantId:userInfo.merchantId,
serviceMerchantName:userInfo.merchantName,
coProduct:prodName
serviceMerchantId: userInfo.merchantId,
serviceMerchantName: userInfo.merchantName,
coProduct: prodName
}
let {code} = await addCoProductApi(params)
if(code == 0){
this.setData({
isLoading: true
})
let { code } = await addCoProductApi(params)
if (code == 0) {
wx.$api.showToast('申请成功')
setTimeout(() => {
wx.$router.back()
}, 1000)
} else {
this.setData({
isLoading: false
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {},
onLoad(options) { },
onRoute(params) {
// 线索id
this.setData({
......@@ -150,35 +170,35 @@ Page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
onReady() { },
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
onShow() { },
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
onHide() { },
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
onUnload() { },
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
onPullDownRefresh() { },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
onReachBottom() { },
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
onShareAppMessage() { }
})
......@@ -27,6 +27,7 @@ Page({
},
sceneActive: 1,
sceneCodeActive: 'SC001',
isLoading: false,
// 活动内容
activityList: [],
sceneActivityObj: {
......@@ -103,6 +104,9 @@ Page({
},
handleConfirm() {
if(this.data.isLoading) {
return
}
var params = {
serviceMerchantId: this.data.merchantInfo.pMerchantId,
serviceMerchantName: this.data.merchantInfo.pMerchantName,
......@@ -116,6 +120,9 @@ Page({
wx.$api.showToast('请选产品/活动')
return true
}
this.setData({
isLoading: true
})
outputApi.applyActivity(params).then(res => {
wx.showToast({
title: '提交成功',
......@@ -126,6 +133,10 @@ Page({
this.handleJump()
}
})
}).catch(() => {
this.setData({
isLoading: false
})
})
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!