فهرست منبع

添加配送远管理,订单对应修改

huangyan 2 ماه پیش
والد
کامیت
0ce2f1ca15
3فایلهای تغییر یافته به همراه20 افزوده شده و 1 حذف شده
  1. 12 0
      controllers/Order.go
  2. 1 1
      models/Function/Couriers.go
  3. 7 0
      models/Function/Order.go

+ 12 - 0
controllers/Order.go

@@ -92,6 +92,8 @@ func (c *OrderController) Order_Add() {
 	ChildPid := c.GetString("ChildPid")
 	CouriesName := c.GetString("CouriesName")
 	CouriesId := c.GetString("CouriesId")
+	DeliveryAddress := c.GetString("DeliveryAddress")
+	ReceivingAddress := c.GetString("ReceivingAddress")
 	if len(EstimateStartTime) <= 0 || len(EstimateEndTime) <= 0 {
 		c.Data["json"] = lib.JSONS{Code: 207, Msg: "时间参数异常!"}
 		c.ServeJSON()
@@ -127,6 +129,8 @@ func (c *OrderController) Order_Add() {
 		ChildPid:          ChildPid,
 		CouriesName:       CouriesName,
 		CouriesId:         CouriesId,
+		DeliveryAddress:   DeliveryAddress,
+		ReceivingAddress:  ReceivingAddress,
 	}
 	if var_.IsExpatriate == 2 {
 		if len(var_.Phone) < 0 {
@@ -209,6 +213,8 @@ func (c *OrderController) Order_Edit() {
 	T_State, _ := c.GetInt("T_State")
 	CouriesName := c.GetString("CouriesName")
 	CouriesId := c.GetString("CouriesId")
+	DeliveryAddress := c.GetString("DeliveryAddress")
+	ReceivingAddress := c.GetString("ReceivingAddress")
 	if len(EstimateStartTime) <= 0 || len(EstimateEndTime) <= 0 {
 		c.Data["json"] = lib.JSONS{Code: 207, Msg: "时间参数异常!"}
 		c.ServeJSON()
@@ -224,6 +230,12 @@ func (c *OrderController) Order_Edit() {
 	if len(WaybillNo) > 0 {
 		r.WaybillNo = WaybillNo
 	}
+	if len(DeliveryAddress) > 0 {
+		r.DeliveryAddress = DeliveryAddress
+	}
+	if len(ReceivingAddress) > 0 {
+		r.ReceivingAddress = ReceivingAddress
+	}
 	if len(T_sn) > 0 {
 		r.T_sn = T_sn
 	}

+ 1 - 1
models/Function/Couriers.go

@@ -17,7 +17,7 @@ type Couriers struct {
 	Id         int       `json:"Id" orm:"column(ID);size(11);auto;pk"`
 	Name       string    `json:"T_name" orm:"size(256);null"`                          // 配送员
 	Phone      string    `orm:"size(256);null"`                                        // 电话
-	UserId     int       `orm:"index;size(256);null"`                                  // 用户ID
+	UserId     int       `orm:"index;size(256);null"`                                  // 用户ID   pid
 	CreateTime time.Time `orm:"column(create_time);type(timestamp);null;auto_now_add"` // 创建时间
 	UpdateTime time.Time `orm:"column(update_time);type(timestamp);null;auto_now"`     // 更新时间
 }

+ 7 - 0
models/Function/Order.go

@@ -37,6 +37,9 @@ type Order struct {
 	Phone               string    `orm:"size(256);"`                                            //电话
 	CouriesName         string    `orm:"size(256);"`                                            //配送员姓名
 	CouriesId           string    `orm:"size(256);"`                                            //配送员id
+	TransportUnits      string    `orm:"size(256);"`                                            //运输单位
+	DeliveryAddress     string    `orm:"size(256);"`                                            //发货地址
+	ReceivingAddress    string    `orm:"size(256);"`                                            //收货地址
 	CreateTime          time.Time `orm:"column(create_time);type(timestamp);null;auto_now_add"` //auto_now_add 第一次保存时才设置时间
 	UpdateTime          time.Time `orm:"column(update_time);type(timestamp);null;auto_now"`     //auto_now 每次 model 保存时都会对时间自动更新
 }
@@ -64,6 +67,8 @@ type OrderR struct {
 	EstimateEndTime   string
 	CouriesName       string
 	CouriesId         string
+	DeliveryAddress   string //发货地址
+	ReceivingAddress  string //收货地址
 }
 
 func OrderToOrderR(t Order) (r OrderR) {
@@ -100,6 +105,8 @@ func OrderToOrderR(t Order) (r OrderR) {
 	r.T_State = t.T_State
 	r.CouriesName = t.CouriesName
 	r.CouriesId = t.CouriesId
+	r.DeliveryAddress = t.DeliveryAddress
+	r.ReceivingAddress = t.ReceivingAddress
 	return
 }