123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- let app = getApp();
- let host = app.globalData.servsers; // 请求的url
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- goodsList:[],
- host: app.globalData.servsers,
- amount:''
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- let goodsList=[],that=this;
- goodsList = [...wx.getStorageSync('goodsList')];
- that.setData({
- goodsList: goodsList,
- amount: wx.getStorageSync('amount')
- })
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
- submitOrder(){
- let that = this, goodsList = that.data.goodsList;
- //生成订单
- goodsList.forEach(res=>{
- res['userId'] = app.globalData.user_id, //'oovpNwjlsY6xx8ceCebFa1dOLd9E',
- res['adress'] = '虹漕路88号',
- res['area'] = '闵行区',
- res['city'] = '上海市',
- res['province'] = '上海市',
- res['consignee'] = '阿哥子',
- res['phone'] = '18888888888'
- });
- // let params = {
- // userId: 'oovpNwjlsY6xx8ceCebFa1dOLd9E', //app.globalData.user_id,
- // adress: '',// string 街道
- // area: '闵行区',// string 区
- // city: '上海市',// string 市
- // province: '上海市',// string 省
- // consignee: '王勇',// string 收件人
- // phone: '15055166539',// string 收件人电话
- // shopCarList: [...that.data.goodsList]
- // }
- wx.request({
- url: host + '/createNewOrderCustomer',
- method:'post',
- // header: {
- // 'content-type': 'application/x-www-form-urlencoded'
- // },
- data: {
- shopCarList:goodsList
- },
- success(res){
- console.log(res)
- }
- })
- }
- })
|