纸通宝SAAS仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

58 lines
1.9 KiB

// pages/home/qrcode/index.js
import Scene from '../../index/scene'
import { configFactory } from "../../../api/saas"
const util = require('../../../utils/util')
const app = getApp()
Scene({
/**
* 页面的初始数据
*/
data: {
settlePriceType: '1',
settleType: '1',
userInfo: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({ settlePriceType: String(app.userInfo.factory.settlePriceType), settleType: String(app.userInfo.factory.settleType)})
},
onTypeChange: function({detail}){
this.setData({ settlePriceType: detail })
},
onTypeClick(e) {
this.setData({ settlePriceType: e.currentTarget.dataset.name })
},
onPaymentChange: function({detail}){
this.setData({ settleType: detail })
},
onPaymentClick(e) {
this.setData({ settleType: e.currentTarget.dataset.name })
},
submitForm: function () {
wx.showLoading({ title: '处理中', mask: true })
var data = {settlePriceType: Number(this.data.settlePriceType), settleType: Number(this.data.settleType) }
configFactory(data).then(result => {
wx.hideLoading()
for (let mIndex = app.userInfo.enterpriseInfos.length - 1; mIndex >= 0; mIndex--) {
const element = app.userInfo.enterpriseInfos[mIndex]
for (let nIndex = element.factoryInfos.length - 1; nIndex >= 0; nIndex--) {
const item = element.factoryInfos[nIndex]
if(item.factoryId == app.userInfo.factoryId){
item.settlePriceType = Number(this.data.settlePriceType)
item.settleType = Number(this.data.settleType)
break
}
}
}
app.userInfo.factory.settlePriceType = Number(this.data.settlePriceType)
app.userInfo.factory.settleType = Number(this.data.settleType)
util.showBackToast('保存成功')
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
}
})