luck 2 жил өмнө
parent
commit
8247032833

+ 1 - 1
pages/home/map/list.wxml

@@ -34,7 +34,7 @@
           </view>
           <view class="main3">
             <icon class="label2 iconfont iconshouye2"></icon>
-            <text lines="1" class="word7">24h开放·支持上门</text>
+            <text lines="1" class="word7"> {{item.unit[0].type_name}}·{{item.unit[1].type_name}}·{{item.unit[2].type_name}}</text>
           </view>
         </view>
         <view class="wrap4"></view>

+ 1 - 1
pages/home/map/map.wxml

@@ -39,7 +39,7 @@
 
             <view class="box flex m-top-15">
                 <van-icon name="clock-o" class="m-right-10" />
-                <text>24h开放·支持上门</text>
+                <text> {{workedesc.unit[0].type_name}}·{{workedesc.unit[1].type_name}}·{{workedesc.unit[2].type_name}}</text>
             </view>
         </view>
 

+ 100 - 14
pages/order/placeOrder/placeOrder.js

@@ -1,5 +1,5 @@
 // pages/order/placeOrder/placeOrder.js
-const app=getApp();
+const app = getApp();
 Page({
 
     /**
@@ -17,18 +17,20 @@ Page({
         carNum: 0,
         carPrice: '',
         shoppingList: [],
-        worke:"",
-        status:""
+        shop: [],
+        worke: "",
+        status: ""
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-        
-        var worke=JSON.parse(options.parmise)
+
+        var worke = JSON.parse(options.parmise)
+        console.log(worke)
         this.setData({
-            worke:worke,
+            worke: worke,
             status: app.globalData.status
         })
         this.getHeight()
@@ -44,6 +46,10 @@ Page({
                 console.log(item);
 
                 this.changeCarList(item)
+                var good_id = items.id;
+                var money = items.price.sale_price;
+                var stock = item.num;
+                this.cartChang(good_id, money, stock);
 
             }
         })
@@ -59,8 +65,18 @@ Page({
             if (items.id == item.id) {
                 item.num++
                 this.changeCarList(item)
+
+                var good_id = items.id;
+                var money = items.price.sale_price;
+                var stock = item.num;
+                this.cartChang(good_id, money, stock);
+
+
             }
         })
+    
+
+
         this.setData({
             shoppingList: list
         })
@@ -103,6 +119,42 @@ Page({
 
     },
 
+    //修改购物车
+    cartChang(good_id, money, stock) {
+        var nid = this.data.worke.id;
+        app.api.useApi(app.globalData.baseAppUrl + "api/change_cart", {
+            network_id: nid,
+            good_id: good_id,
+            money: money,
+            stock: stock
+        }, "post").then(function (res) {
+            console.log(res);
+            if (res.code != 200) {
+                wx.showLoading({
+                    title: res.message.status,
+                })
+            } else {
+                var data = res.message.data;
+                var shop = [];
+                for (var index in data) {
+                    shop[data[index].id] = data[index].goods
+                }
+
+
+                that.setData({
+                    navList: res.message.data,
+                    shoppingList: res.message.data[0].goods,
+                    shop: shop
+                })
+            }
+
+            wx.hideLoading();
+
+        }).catch(function (err) {
+            console.log(222);
+        })
+    },
+
     changeShoppingList(item) {
         console.log(item);
         let shoppingList = this.data.shoppingList;
@@ -118,16 +170,39 @@ Page({
     },
 
     getCarAll() {
-        this.setData({
-            carNum: 0,
-            carPrice: 0
+        var nid = this.data.worke.id;
+        var that=this;
+        app.api.useApi(app.globalData.baseAppUrl + "api/cart_info", {
+            network_id: nid,
+        }, "get").then(function (res) {
+            console.log(res);
+            if (res.code != 200) {
+                wx.showLoading({
+                    title: res.message.msg,
+                })
+            } else {
+                console.log(res.message.data.carPrice)
+                that.setData({
+                    carList:res.message.data.cart.data, 
+                    carNum: res.message.data.carNum,
+                    carPrice: res.message.data.carPrice
+                })
+              
+            }
+
+            wx.hideLoading();
+
+        }).catch(function (err) {
+            console.log(222);
         })
+
+
         let carList = this.data.carList
         carList.map(item => {
             wx.nextTick(() => {
                 this.setData({
                     carNum: this.data.carNum + item.num,
-                    carPrice: this.data.carPrice + item.price * item.num
+                    carPrice: this.data.carPrice + item.price.sale_price * item.num
                 })
 
             })
@@ -197,8 +272,11 @@ Page({
     },
     changeActive(e) {
         let { activekey } = e.currentTarget.dataset
+        var id = e.target.dataset.id;
+
         this.setData({
-            activeKey: activekey
+            activeKey: activekey,
+            shoppingList: this.data.shop[id]
         })
     },
     addressDetail() {
@@ -248,19 +326,27 @@ Page({
     leftList: function () {
         var that = this;
         var nid = this.data.worke.id;
-    
+
         app.api.useApi(app.globalData.baseAppUrl + "api/good", {
             network_id: nid,
         }, "get").then(function (res) {
             console.log(res);
             if (res.code != 200) {
                 wx.showLoading({
-                    title:  res.message.status,
+                    title: res.message.status,
                 })
             } else {
+                var data = res.message.data;
+                var shop = [];
+                for (var index in data) {
+                    shop[data[index].id] = data[index].goods
+                }
+
+
                 that.setData({
                     navList: res.message.data,
-                    shoppingList:res.message.data[0].good
+                    shoppingList: res.message.data[0].goods,
+                    shop: shop
                 })
             }
 

+ 13 - 12
pages/order/placeOrder/placeOrder.wxml

@@ -12,7 +12,7 @@
             </view>
             <view class="tips">
                 <text class="tag">{{status[worke.signing_status]}}</text>
-                <text>24h开放·支持上门</text>
+                <text> {{worke.unit[0].type_name}}·{{worke.unit[1].type_name}}·{{worke.unit[2].type_name}}</text>
             </view>
         </view>
         <view class="lr">
@@ -44,7 +44,7 @@
 
     <view class="slidebar">
         <scroll-view scroll-y>
-            <view class="sliderItem b-bottom {{activeKey == index?'active':''}}" wx:for="{{navList}}" wx:key="*this" bindtap="changeActive" data-activeKey="{{index}}">
+            <view class="sliderItem b-bottom {{activeKey == index?'active':''}}" wx:for="{{navList}}" wx:key="*this" data-id="{{item.id}}" bindtap="changeActive" data-activeKey="{{index}}">
                 {{item.title}}
             </view>
         </scroll-view>
@@ -59,10 +59,11 @@
 
             <view class="box">
                 <view class="items flex b-bottom" wx:for="{{shoppingList}}" wx:key="{{item.id}}">
+                   <navigator url="/pages/order/serviceDetails/serviceDetails?goods_id={{item.id}}&title={{worke.title}}&address={{worke.address}}&worke_id={{worke.id}}">
                     <view class="le">
                         <image src="{{item.thumb?item.thumb:'/image/order/houwaitao.png'}}" class="picture"></image>
-
                     </view>
+                </navigator>
                     <view class="lr">
                         <view class="message flex ju-b">
                             <view class="tit">{{item.title}}</view>
@@ -140,10 +141,10 @@
                     </view>
                     <view class="lr">
                         <view class="message flex ju-b">
-                            <view class="name">薄上衣(春夏装)</view>
+                            <view class="name">{{item.title}}</view>
                             <view class="num flex ju-b">
                                 <view>
-                                    <text class="price">¥<text class="number">{{item.price}}</text></text>
+                                    <text class="price">¥<text class="number">{{item.money}}</text></text>
                                     <text class="oldPrice">¥9</text>
                                 </view>
 
@@ -152,7 +153,7 @@
                                         <van-icon name="minus" size="12" color="#191C27" />
                                     </view>
                                     <view class="nums">
-                                        {{item.num}}
+                                        {{item.stock}}
                                     </view>
                                     <view class="btn-sky btn flex ju-c" bindtap="carPlus" data-item="{{item}}">
                                         <van-icon name="plus" size="12" />
@@ -172,27 +173,27 @@
 <van-popup z-index="300" show="{{ detailsShow }}" position="bottom" bind:close="addressDetail" close-icon="/image/icon/close.png" round close-on-click-overlay closeable>
     <view class="details">
         <view class="title">
-            中央美术学院9号楼洗衣房1号柜这里展示全部完整柜子信息
+            {{worke.title}}
         </view>
 
         <view class="tag">
-            可存衣
+            {{status[worke.signing_status]}}
         </view>
 
         <view class="grayText">
-            地址:洪山区茅店山西路4号创星汇科技园洪山区茅店山西路4号创星汇科技园
+            地址:{{worke.address}}
         </view>
 
         <view class="grayText">
-            电话:027-98987654
+            电话:{{worke.contact}}
         </view>
 
         <view class="grayText">
-            营业时间:24h开放
+            营业时间:{{worke.unit[0].svctm}}
         </view>
 
         <view class="grayText">
-            配送:支持上门
+            配送:{{worke.unit[0].type_name}}·{{worke.unit[1].type_name}}·{{worke.unit[2].type_name}}
         </view>
     </view>
 </van-popup>

+ 40 - 2
pages/order/serviceDetails/serviceDetails.js

@@ -1,18 +1,56 @@
 // pages/order/serviceDetails/serviceDetails.js
+const app=getApp();
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        goods:{},
+        carNum:1,
+        carPrice:0,
+        title:"",
+        address:"",
+        worke_id:"",
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-
+        var goods_id=options.goods_id;
+        var title=options.title;
+        var address=options.address;
+        var worke_id=options.worke_id;
+        this.setData({
+            title:title,
+            address:address,
+            worke_id:worke_id,
+        })
+        var that=this;
+        app.api.useApi(app.globalData.baseAppUrl + "api/goods_info", {
+            network_id: wx.getStorageSync('nid'),
+            good_id:goods_id
+        }, "get").then(function (res) {
+            console.log(res);
+            if (res.code != 200) {
+                console.log(res.code);
+                wx.showLoading({
+                    title: res.message.msg,
+                })
+            } else {
+                that.setData({
+                    goods:res.message.data.good, 
+                    carPrice:res.message.data.good.price.sale_price,
+                })
+              
+            }
+
+            wx.hideLoading();
+
+        }).catch(function (err) {
+            console.log(222);
+        })
     },
 
     /**

+ 11 - 36
pages/order/serviceDetails/serviceDetails.wxml

@@ -1,12 +1,12 @@
 <!--pages/order/serviceDetails/serviceDetails.wxml-->
 <view class="topBox">
-    <image src="/image/order/houwaitao.png" class="picture"></image>
+    <image src="{{goods.thumb?goods.thumb:'/image/order/houwaitao.png'}}" class="picture"></image>
 
-    <view class="tit">厚东装(秋冬装)</view>
+    <view class="tit">{{goods.title}}</view>
 
     <view class="message">
-        <text>¥<text class="num">9</text></text>
-        <text class="old">¥40</text>
+        <text>¥<text class="num">{{goods.price.sale_price}}</text></text>
+        <text class="old">¥{{goods.price.price}}</text>
     </view>
 
     <view class="flex ju-c btnBox">
@@ -14,7 +14,7 @@
             <van-icon name="minus" size="12" color="#191C27" />
         </view>
         <view class="nums">
-            1
+            {{carNum}}
         </view>
         <view class="btn-sky btn flex ju-c">
             <van-icon name="plus" size="12" />
@@ -26,50 +26,25 @@
     <view class="tit">服务详情</view>
 
     <view class="content">
-        <view class="items">
-            <view class="t">洗护保障</view>
-
-            <view class="message">
-                10年以上经验的高级洗护技师全程负责您的衣物清洗
-            </view>
+        {{goods.detail}}
         </view>
-
-        <view class="items">
-            <view class="t">服务时效</view>
-
-            <view class="message">
-                正常情况下3-5天
-            </view>
-        </view>
-
-        <view class="items">
-            <view class="t">购买限制</view>
-
-            <view class="message">
-                每人限购1单,1单限购2份
-            </view>
-            <view class="message">
-                可清洗海星洗护目前提供的洗衣品类,不包含《不可清洗衣物说明》中的衣物
-            </view>
-        </view>
-    </view>
 </view>
 
 <view class="addressBox">
     <view class="top flex ju-b b-bottom">
         <view>
-            中央美术学院9号楼洗衣房1号柜
+            {{title}}
         </view>
-
+        <navigator url="/pages/home/map/map">
         <view class="btns btn-border">
             更换
         </view>
+    </navigator>
     </view>
 
     <view class="footer flex ju-b">
         <view class="address">
-            洪山区茅店山西路4号创星汇科技园南门
-            创星汇科技园B栋洪山区创星汇
+            {{address}}
         </view>
 
         <view class="iconBoxs flex">
@@ -82,7 +57,7 @@
 
 <view class="footerNav flex ju-b">
     <view class="price">
-        <text>¥<text class="num">40</text></text>
+        <text>¥<text class="num">{{carPrice}}</text></text>
     </view>
 
     <view class="footerBtn btn-sky">下单洗衣</view>

+ 18 - 0
project.private.config.json

@@ -77,6 +77,24 @@
           "pathName": "pages/my/address/addSite/addSite",
           "query": "parmise=%E6%B7%BB%E5%8A%A0",
           "scene": null
+        },
+        {
+          "name": "",
+          "pathName": "pages/order/serviceDetails/serviceDetails",
+          "query": "",
+          "scene": null
+        },
+        {
+          "name": "",
+          "pathName": "pages/order/serviceDetails/serviceDetails",
+          "query": "goods_id=1",
+          "scene": null
+        },
+        {
+          "name": "",
+          "pathName": "pages/order/serviceDetails/serviceDetails",
+          "query": "goods_id=1&title=%E5%A4%96%E9%83%A8%E6%B5%8B%E8%AF%95%E7%BD%91%E7%82%B9%20%20&address=22%20&worke_id=1",
+          "scene": null
         }
       ]
     }

+ 3 - 1
utils/api.js

@@ -3,7 +3,9 @@
 var useApi = (url, data = {}, method = "get") => {
 var that=this;
 var requrestTask=wx.request
-    console.log(url);
+wx.showLoading({
+    title: '数据加载中...',
+})
     return new Promise((resolve, reject) => {
         requrestTask ({
             url: `${url}`, // 云端正式服