Procházet zdrojové kódy

添加订单页面

liguorui před 6 roky
rodič
revize
8731da31d2

+ 3 - 2
app.json

@@ -1,5 +1,6 @@
           {
   "pages":[
+    "pages/mybuy/mybuy",
     "pages/index/index",
     "pages/hot/hot",
     "pages/hotdt/hotdt",
@@ -13,8 +14,8 @@
     "pages/cardetail/cardetail",
     "pages/usercenter/usercenter",
     "pages/mysuggest/mysuggest",
-    "pages/mybuy/mybuy",
-    "pages/test/test"
+    "pages/test/test",
+    "pages/orderdetail/orderdetail"
   ],
   "window":{
     "navigationBarBackgroundColor": "#fede18",

+ 2 - 1
common/pathmap.js

@@ -32,5 +32,6 @@ export default{
   "sellingcar":"/api/selling_car",
   "carmodel":"/api/car_model",
   "brandlist":"/api/brand_list",
-  "estimatedprice":"/api/estimated_price"
+  "estimatedprice":"/api/estimated_price",
+  "orderdetail":"/api/order_detail"
 }

+ 6 - 6
data/car.js

@@ -5,12 +5,12 @@ export const retCartData = function(list){
         var date = new Date(item.license_time.replace(/-/g,"/"));
         item.licensetime = `${date.getFullYear()}年${date.getMonth()+1}月`
       }
-      // if (item.sale_price){
-      //   item.saleprice = (item.sale_price / 10000).toFixed(2)
-      // }
-      // if (item.guide_price){
-      //   item.guideprice = (item.guide_price / 10000).toFixed(2)
-      // }
+      if (item.order_price){
+        item.orderprice = (item.order_price / 100).toFixed(2)
+      }
+      if (item.booking_price){
+        item.bookingprice = (item.booking_price / 100).toFixed(2)
+      }
     })
     return list;
   }else{

+ 31 - 0
module/caritem/caritem.wxss

@@ -86,4 +86,35 @@
   height: 26rpx;
   bottom: 22rpx;
   right: 40rpx;
+}
+.order_inof_b{
+  height: 98rpx;
+  background-color: white;
+  display: flex;
+  align-items: center;
+  line-height: 26rpx;
+  color: rgba(56, 55, 53, 1);
+  font-size: 26rpx;
+}
+.order_price{
+  flex: 1;
+  border-left:4rpx solid #FFE600;
+  margin-left:38rpx;
+  font-family: NotoSansHans-DemiLight;
+}
+.order_earnest{
+  width:200rpx;
+}
+.order_loans{
+  width:110rpx;
+}
+.order_status{
+  width:80rpx;
+  font-weight: bold;
+}
+.order_link{
+  width:22rpx;
+  height: 22rpx;
+  margin-right: 38rpx;
+  margin-left:20rpx;
 }

+ 50 - 0
module/caritem/mybuycaritem.wxml

@@ -0,0 +1,50 @@
+<template name="mybuycaritem">
+  <view>
+    <navigator 
+      open-type="navigateTo" 
+      class="caritem_b"
+      url="../orderdetail/orderdetail?id={{car.id}}"
+      >
+      <view 
+        class="caritem_img" 
+        style="background-image:url({{car.img}})"
+      />
+      <view class="caritem_info">
+        <view 
+          class="caritem_t"
+        >{{car.title?car.title:'--'}}</view>
+        <view class="caritem_time">
+          <view class="caritem_time_i">{{car.licensetime}}年上牌|{{car.mileage}}万公里</view>
+          <navigator 
+            wx:if='{{car.store_id}}'
+            open-type="navigateTo"
+            url="../shop/shop?id={{car.store_id}}"
+            class="caritem_store"
+          >
+            {{car.store_name}}
+          </navigator>
+        </view>
+        <view class="caritem_p">
+          {{car.sale_price}}万 
+          <image class="caritem_p_img" src="../../img/placard.png"/>
+        </view>
+        <view class="caritem_guide_p">
+          新手指导价:<view class="caritem_guidep">{{car.guide_price}}万</view>
+        </view>
+      </view>
+    </navigator>
+    <view class="order_inof_b">
+      <view class="order_price">订单总额:{{car.orderprice}}万</view>
+      <view class="order_earnest">定金:{{car.bookingprice}}万</view>
+      <view class="order_loans">{{car.paid_type}}</view>
+      <view class="order_status">{{car.order_status===0?'已预订':car.order_status===1?'已成交':'已违约'}}</view>
+      
+      <navigator 
+        open-type="navigateTo"
+        url="../orderdetail/orderdetail?id={{car.id}}"
+        >
+        <image class="order_link" src = "../../img/right.png"/>
+      </navigator>
+    </view>
+  </view>
+</template>

+ 2 - 2
pages/buy/buy.js

@@ -53,7 +53,7 @@ Page({
       },
       {
         title:"车龄最短",
-        value:"car_age&asc"
+        value:"car_age&desc"
       },
       {
         title:"里程最少",
@@ -61,7 +61,7 @@ Page({
       },
       {
         title:"最新发布",
-        value:"new&asc"
+        value:"new&desc"
       }
     ],
     searchdata:{

+ 8 - 6
pages/cardetail/cardetail.js

@@ -148,12 +148,14 @@ Page(Object.assign({
         _self.setData({
           detail:detail
         })
-      }else{
-        wx.showToast({
-          title:json.data.message,
-          icon:"none",
-          duration:2000
-        })
+      }else{        
+        if(json.data.message){
+          wx.showToast({
+            title:json.data.message,
+            icon:"none",
+            duration:2000
+          })
+        }
       }
     })
   },

+ 0 - 1
pages/mybuy/mybuy.wxml

@@ -7,7 +7,6 @@
 <page-scroll 
   className="conent"
   styleSheet="height:{{windowh-headerheight}}rpx;"
-  scroll-y="{{selectbar==''?'true':'false'}}"
   bind:scrolltolower="{{hasloadall?'':'getMyBuy'}}"
 >
 

+ 3 - 0
pages/mybuy/mybuy.wxss

@@ -1,8 +1,11 @@
+
+@import "../../module/caritem/caritem.wxss"
 .conent{
 	background-color:#F9F9F9;
 }
 .mybuy_list{
 	margin-top:-20rpx;
+	background-color:#F9F9F9;
 }
 .mybuy_empty{
 	margin-top:260rpx;

+ 9 - 5
pages/mysuggest/mysuggest.js

@@ -77,13 +77,17 @@ Page({
       post(pathmap.feedback,{
         content:this.data.value
       },function(json){
-        var obj = {          
-          title:json.data.message
-        }
         if(json.statusCode!=200){
-          obj.icon="none"
+          wx.showToast({
+            title:json.data.message,
+            icon:"none"
+          });
+        }else{
+          wx.showToast({
+            title:json.data.message
+          })
+          wx.navigateBack();
         }
-        wx.showToast(obj);
       })
     }else{
       wx.showToast({

+ 99 - 0
pages/orderdetail/orderdetail.js

@@ -0,0 +1,99 @@
+// pages/orderdetail/orderdetail.js
+import { get,post } from "../../common/request.js"
+import pathmap from "../../common/pathmap"
+import stylemap from "../../common/stylemap"
+import { retCartData } from "../../data/car"
+
+const app = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    windowh: app.globalData.windowh, 
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) { 
+    this.setData(Object.assign({id:options.id},stylemap));     
+    this.getOrder();
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+  
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+  
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+  
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+  
+  },
+  getOrder:function(){
+    var _self=this;
+    get(pathmap.orderdetail,{
+      order_id:this.data.id
+    },function(json){
+      if(json.statusCode==200){
+        _self.setData(json.data);
+      }else{
+        if(json.data.message){
+          wx.showToast({
+            title:json.data.message,
+            icon:"none",
+            duration:2000
+          })
+        }
+      }
+    })
+  },
+  showPic:function(e){
+    var url = e.target.dataset.url;
+    wx.previewImage({
+      current: url, // 当前显示图片的http链接
+      urls: [url] // 需要预览的图片http链接列表
+    })
+  }
+})

+ 6 - 0
pages/orderdetail/orderdetail.json

@@ -0,0 +1,6 @@
+{
+	"disableScroll":true,
+  	"usingComponents":{
+		"page-scroll":"../../components/page-scroll/page-scroll"
+	}
+}

+ 85 - 0
pages/orderdetail/orderdetail.wxml

@@ -0,0 +1,85 @@
+<!--pages/orderdetail/orderdetail.wxml-->
+<import src="../../module/header.wxml"/>
+<template 
+  is="header"
+  data="{{title:'订单详情',headerheight:headerheight,hasback:true}}"
+/>
+<page-scroll 
+  className="conent"
+  styleSheet="height:{{windowh-headerheight}}rpx;"
+>
+	<view class="order_info">
+		<view class="order_info_t">
+			<view class="order_info_n">
+				订单号:{{id}}
+			</view>
+		</view>
+		<view class="order_de_inof">
+			<view class="order_de_t">
+				成交车源:
+			</view>
+			<view class="order_de_v">
+				{{title}}
+			</view>
+		</view>
+
+		<view class="order_de_inof">
+			<view class="order_de_t">
+				订单总额:
+			</view>
+			<view class="order_de_v">
+				{{order_price/100}}万元
+			</view>
+		</view>
+
+		<view class="order_de_inof">
+			<view class="order_de_t">
+				订金金额:
+			</view>
+			<view class="order_de_v">
+				{{booking_price/100}}万元
+			</view>
+		</view>
+
+		<view class="order_de_inof">
+			<view class="order_de_t">
+				付款时间:
+			</view>
+			<view class="order_de_v">
+				{{pay_time}}
+			</view>
+		</view>
+
+		<view class="order_de_inof">
+			<view class="order_de_t">
+				付款方式:
+			</view>
+			<view class="order_de_v">
+				{{paid_type}}
+			</view>
+		</view>
+
+		<view class="order_de_inof">
+			<view class="order_de_t">
+				合同扫描件:
+			</view>
+			<view class="order_de_v">
+				<image 
+					bindtap="showPic"
+					data-url="{{contract_img}}" 
+					src="{{contract_img}}"/>
+			</view>
+		</view>
+
+		<view class="order_de_inof">
+			<view class="order_de_t">
+				订单备注:
+			</view>
+			<view class="order_de_v">
+			</view>
+		</view>
+		<view class="order_de_remark">
+			{{remark}}
+		</view>
+	</view>
+</page-scroll>

+ 51 - 0
pages/orderdetail/orderdetail.wxss

@@ -0,0 +1,51 @@
+/* pages/orderdetail/orderdetail.wxss */
+.order_info{
+	background-color: white;
+}
+.order_info_t{	
+	border-bottom:1rpx solid rgba(235, 235, 235, 1);
+}
+.order_info_n{
+	margin: 18rpx 0rpx 18rpx 38rpx;
+	height: 22rpx;
+	line-height: 22rpx;
+	color: rgba(56, 55, 53, 1);
+	font-size: 22rpx;
+	font-family: NotoSansHans-DemiLight;
+	text-indent: 4rpx;
+	border-left:4rpx solid #FFE600;
+}
+.order_de_inof{
+	display: flex;
+	margin-top:24rpx;
+}
+.order_de_t{
+	margin-left: 38rpx;
+	width: 160rpx;
+	line-height: 38rpx;
+	color: rgba(56, 55, 53, 1);
+	font-size: 26rpx;
+	text-align: left;
+	font-family: NotoSansHans-DemiLight;
+}
+.order_de_v{
+	flex: 1;
+	line-height: 38rpx;
+	color: rgba(33, 36, 37, 1);
+	font-size: 28rpx;
+	font-weight: bold;
+	font-family: NotoSansHans-Bold;
+}
+.order_de_v image{
+	width:140rpx;
+}
+.order_de_remark{
+	margin:20rpx auto;
+	width: 662rpx;
+	line-height: 34rpx;
+	color: rgba(104, 104, 104, 1);
+	font-size: 24rpx;
+	text-align: justify;
+	font-family: NotoSansHans-Light;
+
+}