2025-03-28 18:36:17 +08:00
|
|
|
import ProjectService from '../../../net/api/projectApi'
|
|
|
|
|
2025-03-21 18:05:54 +08:00
|
|
|
Page({
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
2025-03-28 18:36:17 +08:00
|
|
|
urgent: 0,
|
|
|
|
projTypes: [], //全托管,写材料 type= ALL type =MATERIAL
|
|
|
|
allPrice: 0,
|
|
|
|
materialPrice: 0,
|
|
|
|
isUrgent: false, //是否加急
|
2025-03-21 18:05:54 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad(options) {
|
|
|
|
wx.setNavigationBarTitle({
|
2025-03-24 18:05:54 +08:00
|
|
|
title: '创建软著',
|
2025-03-21 18:05:54 +08:00
|
|
|
})
|
2025-03-28 18:36:17 +08:00
|
|
|
this.doGetPrice()
|
|
|
|
},
|
|
|
|
//是否加急
|
|
|
|
doUrgent(e) {
|
|
|
|
const _self = this
|
|
|
|
_self.setData({
|
|
|
|
isUrgent: !_self.data.isUrgent
|
|
|
|
})
|
|
|
|
},
|
|
|
|
//获取单价
|
|
|
|
doGetPrice() {
|
|
|
|
wx.showLoading({
|
|
|
|
title: '加载中...',
|
|
|
|
})
|
|
|
|
const _self = this
|
|
|
|
ProjectService.doGetPrice()
|
|
|
|
.then(res => {
|
|
|
|
wx.hideLoading()
|
|
|
|
console.log(res)
|
|
|
|
res.projTypes.forEach(el => {
|
|
|
|
if (el.type == 'ALL') {
|
|
|
|
_self.setData({
|
|
|
|
allPrice: el.price
|
|
|
|
})
|
|
|
|
} else if (el.type == 'MATERIAL') {
|
|
|
|
_self.setData({
|
|
|
|
materialPrice: el.price
|
|
|
|
})
|
|
|
|
}
|
|
|
|
});
|
|
|
|
_self.setData({
|
|
|
|
urgent: res.additional.urgent, //加急办理
|
|
|
|
})
|
|
|
|
}, err => {
|
|
|
|
wx.hideLoading()
|
|
|
|
wx.showToast({
|
|
|
|
title: '数据有误,请稍后重试',
|
|
|
|
icon: 'error',
|
|
|
|
success: () => {
|
|
|
|
wx.navigateBack()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
2025-03-21 18:05:54 +08:00
|
|
|
},
|
2025-03-24 18:05:54 +08:00
|
|
|
//打开项目信息编辑页面
|
|
|
|
doBuy(e) {
|
2025-03-28 18:36:17 +08:00
|
|
|
//计算价格
|
|
|
|
const _self = this
|
|
|
|
var price = e.currentTarget.dataset.type == 'ALL' ? _self.data.allPrice : _self.data.materialPrice
|
|
|
|
var type = e.currentTarget.dataset.type
|
|
|
|
if (type == 'ALL' && _self.data.isUrgent) {
|
|
|
|
price += _self.data.urgent
|
|
|
|
}
|
2025-03-24 18:05:54 +08:00
|
|
|
wx.navigateTo({
|
2025-03-28 18:36:17 +08:00
|
|
|
url: '../createProjectInfo/createProjectInfo?type=' + type + '&price=' + price + '&isUrgent=' + _self.data.isUrgent,
|
2025-03-24 18:05:54 +08:00
|
|
|
})
|
|
|
|
}
|
2025-03-21 18:05:54 +08:00
|
|
|
})
|