123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- const _Http = getApp().globalData.http;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- detailsData: {}, //详情数据
- butText: false, //底部按钮文本
- content: "", //提交内容
- loading: false, //按钮加载状态
- recordL: {}, //记录
- isCommit: false, //是否提交
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- let detailsData = JSON.parse(options.item);
- this.setData({
- detailsData,
- butText: options.type
- })
- /* 详情计数 */
- if (options.type == '开始提报') {
- this.select_submitdetailed();
- } else if (options.type == 'false') {
- /* 查看记录 */
- this.setData({
- recordL: JSON.parse(options.record)
- })
- }
- console.log("是否一事一报", detailsData.oneToOne)
- },
- /* 查询详情 */
- select_submitdetailed() {
- _Http.basic({
- "classname": "saletool.submitedit.submitedit",
- "method": "select_submitdetailed",
- "content": {
- "sat_submiteditmodelid": this.data.detailsData.sat_submiteditmodelid
- }
- }).then(res => {
- console.log("提报详情", res)
- this.setData({
- 'detailsData.submitedit': res.data[0].submitedit
- })
- });
- },
- /* 文本域输入 */
- textareaInput(e) {
- this.setData({
- content: e.detail.value.trim()
- })
- },
- /* 去详情 */
- toDetails() {
- if (this.data.butText == '开始提报') {
- wx.navigateTo({
- url: './details?type=保存&item=' + JSON.stringify(this.data.detailsData),
- })
- } else {
- if (this.data.isCommit) return wx.showToast({
- title: '请勿重新提交',
- icon: "none"
- })
- if (!this.data.content) return wx.showToast({
- title: '您还未输入提报内容',
- icon: "none"
- })
- if (this.data.loading) return wx.showToast({
- title: '正在提交中,请勿重新提交',
- icon: "none"
- })
- this.setData({
- loading: true
- })
- _Http.basic({
- "classname": "saletool.submitedit.submitedit",
- "method": "sub_submitdetailed",
- "content": {
- "sat_submiteditmodelid": this.data.detailsData.sat_submiteditmodelid,
- "content": this.data.content,
- "sat_submiteditid": 0
- }
- }).then(res => {
- this.setData({
- loading: false
- })
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- this.setData({
- isCommit: true
- })
- let pages = getCurrentPages();
- let prevPage = pages[pages.length - 2];
- if (prevPage.data.butText == '开始提报') prevPage.select_submitdetailed();
- wx.showToast({
- title: '提交成功',
- icon: "success"
- });
- setTimeout(() => {
- wx.navigateBack({
- delta: 0,
- })
- }, 300)
- })
- }
- },
- /* 查看提报记录 */
- seeHistory(e) {
- const {
- item
- } = e.currentTarget.dataset;
- wx.navigateTo({
- url: `./details?type=false&item=${JSON.stringify(this.data.detailsData)}&record=${JSON.stringify(item)}`,
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|