牛嘟嘟 2023-12-06 17:41 采纳率: 0%
浏览 2

小程序表单提交成功以后,后端数据库表单没有数值?

wxml代码

<view class="wrap {{ticketFlag?'prevent':''}}">
    <view class="box shadow-blue">
        <view class="buy-title ellips1">{{info.info.title}}</view>
        <view class="buy-time">开课时间: {{info.showTime}} / 共{{info.lesson_num}}课时</view>
        <view class="buy-money">{{showmoney}}</view>
        <view class="buy-old">原价:¥{{info.info.money}}</view>
    </view>
    <view class="sign-box shadow-blue">
        <view class="input-item">
            <text class="input-txt">选择分校:</text>
            <picker bindchange="onChangeSchoolTab" class="input-el" range="{{info.teacher}}" rangeKey="school_name" value="{{index}}">
                <view class="picker">{{info.teacher[schoolChoose].school_name}}</view>
            </picker>
            <image class="input-arrow" src="../../resource/images/arroww.png"></image>
        </view>
        <view bindtap="closeTicket" class="input-item" wx:if="{{ticket.length>0}}">
            <text class="input-txt">选优惠券:</text>
            <view class="input-el">{{choose==-1?'不使用优惠券':ticket[choose].money+'元优惠券'}}</view>
            <image class="input-arrow" src="../../resource/images/arroww.png"></image>
        </view>
        <view class="input-item">
                <text class="input-txt">班级信息:</text>
                <input bindinput="getRemark" class="input-el" placeholder="请填写班级信息" value="{{remark}}"></input>
            </view>
        <view class="input-item">
            <text class="input-txt">姓名:</text>
            <input bindinput="getUserName" class="input-el" placeholder="请填写姓名" value="{{username}}"></input>
        </view>
        <view class="input-item">
            <text class="input-txt">联系电话:</text>
            <input bindinput="getTel" class="input-el" placeholder="请填写联系电话" type="number" value="{{tel}}"></input>
        </view>
    </view>


<form bindsubmit="onSendBuyTab" reportSubmit="true">
        <button class="input-button shadow-blue" disabled="{{prevent}}" formType="submit">提交支付</button>
    </form>
</view>
<zan-popup bind:click-overlay="closeTicket" show="{{ticketFlag}}" type="bottom">
    <view class="ticket-box">
        <view bindtap="chooseTicketTab" class="ticket-item shadow-blue" data-idx="{{index}}" wx:for="{{ticket}}" wx:key="{{index}}">
            <view class="item-top">
                <view class="ellips1">{{item.money}}元优惠券</view>
                <button>使用</button>
            </view>
            <view class="item-time ellips1">{{item.full}}元可用/有效期至:{{item.showtime}}</view>
        </view>
        <view catchtap="delTicketTab" class="cancle-ticket shadow-blue">不使用优惠券</view>
    </view>
</zan-popup>
<sec-login bind:watch="onloadData" isLogin="true"></sec-login>


js代码

var _extends = Object.assign || function(t) {
    for (var a = 1; a < arguments.length; a++) {
        var o = arguments[a];
        for (var e in o) Object.prototype.hasOwnProperty.call(o, e) && (t[e] = o[e]);
    }
    return t;
}, _reload = require("../../resource/js/reload.js"), _api = require("../../resource/js/api.js"), app = getApp();


Page(_extends({}, _reload.reload, {
    data: {
        ticketFlag: !1,
        schoolChoose: 0,
        choose: 0,
        tel: "",
        remark: ""
    },
    onLoad: function(t) {
        this.setData({
            cid: t.cid
        });
    },
    onloadData: function() {
        var o = this, t = {
            cid: this.data.cid,
            uid: wx.getStorageSync("userInfo").wxInfo.id
        };
        (0, _api.CourseDetailsData)(t).then(function(t) {
            o.setData({
                info: t
            });
            var a = {
                money: o.data.info.info.nowmoney,
                uid: wx.getStorageSync("userInfo").wxInfo.id,
                sid: o.data.info.teacher[o.data.schoolChoose].sid
            };
            return (0, _api.CanUseData)(a);
        }).then(function(t) {
            o.setData({
                ticket: t,
                choose: 0
            }), t.length < 1 && o.setData({
                choose: -1
            }), o.setData({
                showmoney: -1 != o.data.choose ? (o.data.info.info.nowmoney - o.data.ticket[o.data.choose].money).toFixed(2) : o.data.info.info.nowmoney
            });
        }).catch(function(t) {
            -1 === t.code ? o.tips(t.msg) : o.tips("false");
        });
    },
    closeTicket: function() {
        this.setData({
            ticketFlag: !this.data.ticketFlag
        });
    },
    onChangeSchoolTab: function(t) {
        this.setData({
            schoolChoose: t.detail.value
        }), this.setData({
            choose: 0
        }), this.getTicketAjax();
    },
    getTicketAjax: function() {
        var a = this, t = {
            money: this.data.info.info.nowmoney,
            uid: wx.getStorageSync("userInfo").wxInfo.id,
            sid: this.data.info.teacher[this.data.schoolChoose].sid
        };
        (0, _api.CanUseData)(t).then(function(t) {
            a.setData({
                ticket: t
            }), t.length < 1 && a.setData({
                choose: -1
            }), a.setData({
                showmoney: -1 != a.data.choose ? (a.data.info.info.nowmoney - a.data.ticket[a.data.choose].money).toFixed(2) : a.data.info.info.nowmoney
            });
        }).catch(function(t) {
            -1 === t.code ? a.tips(t.msg) : a.tips("false");
        });
    },
    getUserName: function(t) {
        var a = t.detail.value.trim();
        this.setData({
            username: a
        });
    },
    getTel: function(t) {
        var a = t.detail.value.trim();
        this.setData({
            tel: a
        });
    },
    chooseTicketTab: function(t) {
        var a = t.currentTarget.dataset.idx;
        this.setData({
            choose: a
        }), this.setData({
            showmoney: -1 != this.data.choose ? (this.data.info.info.nowmoney - this.data.ticket[this.data.choose].money).toFixed(2) : this.data.info.info.nowmoney
        }), this.closeTicket();
    },
    delTicketTab: function() {
        this.setData({
            choose: -1
        }), this.setData({
            showmoney: -1 != this.data.choose ? (this.data.info.info.nowmoney - this.data.ticket[this.data.choose].money).toFixed(2) : this.data.info.info.nowmoney
        }), this.closeTicket();
    },
    getRemark: function(t) {
      var a = t.detail.value.trim();
      this.setData({
          remark: a
      });
  },
    onSendBuyTab: function(t) {
        var a = this, i  = t.detail.formId, n = wx.getStorageSync("userInfo"), o = {
            cid: this.data.cid,
            uid: n.wxInfo.id,
            username: this.data.username,
            remark: this.data.remark,
            tel: this.data.tel,
            headurl: n.wxInfo.headimg,
            formId: i,
            sid: this.data.info.teacher[this.data.schoolChoose].sid
        };
        -1 != this.data.choose && 0 < this.data.ticket.length && (o.coupon_money = this.data.ticket[this.data.choose].money), 
        o.username.length < 2 ? wx.showToast({
            title: "请填写正确姓名!",
            icon: "none",
            duration: 2e3
        }) : o.tel.length < 11 ? wx.showToast({
            title: "请填写正确手机号码!",
            icon: "none",
            duration: 2e3
        }) : (0, _api.CourseSignData)(o).then(function(t) {
            var o = a;
            if (0 == a.data.info.info.nowmoney) return wx.showToast({
                title: "恭喜您,报名课程成功!",
                icon: "none",
                duration: 2e3
            }), void setTimeout(function() {
                wx.navigateBack({
                    delta: 1
                });
            }, 1e3);
            var e = t.sid;
            wx.requestPayment({
                timeStamp: t.timeStamp,
                nonceStr: t.nonceStr,
                package: t.package,
                signType: t.signType,
                paySign: t.paySign,
                success: function(t) {
                    var a = {
                        sid: e,
                        formId: i,
                        cid: o.data.cid,
                        uid: n.wxInfo.id
                    };
                    -1 != o.data.choose && (a.couponid = o.data.ticket[o.data.choose].couponid, a.coupon_money = o.data.ticket[o.data.choose].money), 
                    (0, _api.PaySuccessData)(a).then(function(t) {
                        wx.showToast({
                            title: "恭喜您,购买课程成功!",
                            icon: "none",
                            duration: 2e3
                        }), setTimeout(function() {
                            wx.navigateBack({
                                delta: 1
                            });
                        }, 1e3);
                    });
                }
            });
        }).catch(function(t) {
            wx.showToast({
                title: t.msg,
                icon: "none",
                duration: 2e3
            });
        });
 

数据库remark里面没有数值

img

  • 写回答

1条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2023-12-06 23:31
    关注

    【相关推荐】




    如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^
    评论

报告相同问题?

问题事件

  • 创建了问题 12月6日

悬赏问题

  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大