123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- // pages/detailsonthereceipt/index.js
- // pages/index/index.js
- import {
- Home
- } from '../../utils/home.js';
- let home = new Home(); //实例化 首页 对象
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- index:0,
- data:[],
- toast:true,
- },
- inputNum:function(e){
- let that=this
- that.setData({
- num:e.detail.value
- })
- },
- /**
- * 交付
- */
- delivery: function() {
- let that = this
- if(!that.data.num){
- that.setData({
- toast:false
- })
- wx.showToast({
- title: '请输入数量',
- icon: 'none',
- duration: 1500,
- mask: true,
- success: function(res) {},
- fail: function(res) {},
- complete: function(res) {},
- })
- return
- }
- var param = {
- id: that.data.data[that.data.index].id,
- num:that.data.num
- }
- home.delivery(param, (res) => {
- (res.code == 1) ? wx.showToast({ title: res.msg, icon: 'success' }) : wx.showToast({ title: res.msg, icon: 'none' });
- that.setData({ toast: true})
- setTimeout(function () { wx.navigateBack({}) }, 1000);
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function(options) {
- let that = this
- console.log(JSON.parse(options.data))
- var data = JSON.parse(options.data)
- var index = options.index
- var type = options.type
- that.setData({
- data: data,
- index: index,
- type: type
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function() {
- }
- })
|