wangyong 6 years ago
parent
commit
41f857639e

+ 10 - 22
customized/pages/accounts/accounts.js

@@ -90,35 +90,23 @@ Page({
 
 
   },
   },
   submitOrder(){
   submitOrder(){
-    let that = this, goodsList = that.data.goodsList;
+    let that = this, goodsList = that.data.goodsList, address = that.data.address;
     //生成订单
     //生成订单
     goodsList.forEach(res=>{
     goodsList.forEach(res=>{
-      res['userId'] = app.globalData.user_id, //'oovpNwjlsY6xx8ceCebFa1dOLd9E',
-      res['adress'] = '虹漕路88号',
-      res['area'] = '闵行区',
-      res['city'] = '上海市',
-      res['province'] = '上海市',
-      res['consignee'] = '阿哥子',
-      res['phone'] = '18888888888'
+      res['userId'] = app.globalData.user_id; //'oovpNwjlsY6xx8ceCebFa1dOLd9E',
+      res['adress'] = address.adress;
+      res['area'] = address.area;
+      res['city'] = address.city;
+      res['province'] = address.province;
+      res['consignee'] = address.consignee;
+      res['phone'] = address.phone;
+      delete res.imgArray
     });
     });
-    // 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({
     wx.request({
       url: host + '/createNewOrderCustomer',
       url: host + '/createNewOrderCustomer',
       method:'post',
       method:'post',
-      // header: {
-      //   'content-type': 'application/x-www-form-urlencoded'
-      // },
       data: {
       data: {
-        shopCarList:goodsList
+        shopCarList:JSON.stringify(goodsList)
       },
       },
       success(res){
       success(res){
         console.log(res)
         console.log(res)

+ 6 - 6
customized/pages/made/madeImg/madeImg.js

@@ -182,10 +182,10 @@ Page({
     })
     })
     let that = this
     let that = this
     wx.request({
     wx.request({
-      url: host+'/queryCustomGoodsUserListByUserId',
-      data:{
-        userId: app.globalData.user_id,
-      },
+      url: host +'/queryCustomGoodsImg',
+      // data:{
+      //   userId: app.globalData.user_id,
+      // },
       type:'get',
       type:'get',
       success(res){
       success(res){
         console.log(res,'图片列表请求结束')
         console.log(res,'图片列表请求结束')
@@ -238,8 +238,8 @@ Page({
       success: function (res) {
       success: function (res) {
         console.log(res, "fff")
         console.log(res, "fff")
         that.setData({
         that.setData({
-          'touch.width': 300,
-          'touch.height': res.height * 300 / res.width,
+          'touch.width': that.data.dataPositionObj.width,
+          'touch.height': res.height * that.data.dataPositionObj.width / res.width,
           'touch.scale': res.width / res.height, // 宽高比例
           'touch.scale': res.width / res.height, // 宽高比例
         })
         })
         console.log(that.data.touch)
         console.log(that.data.touch)

+ 26 - 6
customized/pages/order/order.js

@@ -7,7 +7,11 @@ Page({
    * 页面的初始数据
    * 页面的初始数据
    */
    */
   data: {
   data: {
-    state:null, // 请求状态
+    state:null, // 请求状态]
+    orderList:[], // 订单列表
+    host: host,
+    rows:1, //默认第一页
+    requestState:true, //请求状态,默认是true
   },
   },
 
 
   /**
   /**
@@ -17,6 +21,7 @@ Page({
     this.setData({
     this.setData({
       state:options.state
       state:options.state
     })
     })
+    
   },
   },
 
 
   /**
   /**
@@ -30,7 +35,7 @@ Page({
    * 生命周期函数--监听页面显示
    * 生命周期函数--监听页面显示
    */
    */
   onShow: function () {
   onShow: function () {
-
+    this.getOrderList(this, this.data.state, this.data.rows)
   },
   },
 
 
   /**
   /**
@@ -51,14 +56,17 @@ Page({
    * 页面相关事件处理函数--监听用户下拉动作
    * 页面相关事件处理函数--监听用户下拉动作
    */
    */
   onPullDownRefresh: function () {
   onPullDownRefresh: function () {
-
+    console.log("上拉")
   },
   },
 
 
   /**
   /**
    * 页面上拉触底事件的处理函数
    * 页面上拉触底事件的处理函数
    */
    */
   onReachBottom: function () {
   onReachBottom: function () {
-
+    if(this.data.requestState){
+      this.getOrderList(this,this.data.state,this.data.rows + 1)
+    }
+    console.log('到底了')
   },
   },
 
 
   /**
   /**
@@ -67,7 +75,8 @@ Page({
   onShareAppMessage: function () {
   onShareAppMessage: function () {
 
 
   },
   },
-  getOrderList(that,state,page){
+  getOrderList(that, state, rows){
+    let orderList = that.data.orderList;
     wx.showLoading({
     wx.showLoading({
       title: '加载中...',
       title: '加载中...',
     })
     })
@@ -81,10 +90,21 @@ Page({
         userId:app.globalData.user_id,
         userId:app.globalData.user_id,
         orderStatus: state, //订单状态  0未支付\\1: 待定制\\2: 待发货\\3: 已发货\\4: 已完成\\5: 取消'
         orderStatus: state, //订单状态  0未支付\\1: 待定制\\2: 待发货\\3: 已发货\\4: 已完成\\5: 取消'
         limit:10,
         limit:10,
-        offset:page,
+        offset: rows,
       },
       },
       success(res){
       success(res){
         console.log(res,"orderList")
         console.log(res,"orderList")
+        orderList.push(...res.data)
+        if(res.data.length < 10){
+          that.setData({
+            requestState:false,
+          })
+        }
+        that.setData({
+          orderList: orderList
+        })
+
+        console.log(that.data.orderList,"orderList")
       },
       },
       complete(){
       complete(){
         wx.hideLoading()
         wx.hideLoading()

+ 11 - 11
customized/pages/order/order.wxml

@@ -1,22 +1,22 @@
-<view class='order-box bg-white c-333'>
-  <view class='order-list mar-b20'>
+<view class='order-box bg-white c-333' wx:if="{{orderList.length !== 0}}">
+  <view class='order-list mar-b20' wx:for="{{orderList}}">
     <view class='mar-r20 mar-l20'>
     <view class='mar-r20 mar-l20'>
-      <text class='f-s30'>奶钢 杯子 300ml</text>
+      <text class='f-s30'>{{item.orderCustomGoodsList[0].customGoodsName}}</text>
       <view  class='f-box f-align-items-center f-s28 mar-t20 mar-b20'>
       <view  class='f-box f-align-items-center f-s28 mar-t20 mar-b20'>
-        <text class='f-item f-s30 c-orange'>¥18.80</text>
-        <view> × 1</view>
+        <text class='f-item f-s30 c-orange'>¥{{item.customGoodsPriceSum}}</text>
+        <view> × {{item.orderCustomGoodsList[0].customGoodsNum}}</view>
       </view>
       </view>
     </view>      
     </view>      
       <!-- 图片list -->
       <!-- 图片list -->
-    <view class='f-box goods-img-list' >
-      <image src='https://dlz.info666.com//temp/101b865a-44b5-4e87-8181-2ee7d366b502.png' mode="aspectFit"></image>
+    <view class='f-box goods-img-list'>
+      <image wx:for="{{item.orderCustomGoodsList}}" wx:for-item="imageItem" wx:if="imageItem !='null'" src='{{host}}{{imageItem.imgList}}' mode="aspectFit"></image>
     </view>
     </view>
     <!-- 操作按钮 -->
     <!-- 操作按钮 -->
     <view class='f-box f-justify-content-end pad-t20 pad-b20 f-s30'>
     <view class='f-box f-justify-content-end pad-t20 pad-b20 f-s30'>
-      <view class='order-btn bg-orange'>立即付款</view>
-      <view class='order-btn bg-orange'>查看物流</view>
-      <view class='order-btn bg-green'>确认收货</view>
+      <view class='order-btn bg-orange' wx:if="{{item.orderStatus === '0'}}">立即付款</view>
+      <view class='order-btn bg-orange' wx:if="{{item.orderStatus === '3'}}">查看物流</view>
+      <view class='order-btn bg-green' wx:if="{{item.orderStatus === '3'}}">确认收货</view>
     </view>
     </view>
   </view>
   </view>
 </view>
 </view>
-<data-none></data-none>
+<data-none wx:else></data-none>