ソースを参照

如果没有登录代码则显示手机号码(pcweb)
提货单交易商品数量按小数位缩小

zou.yingbin 4 年 前
コミット
f5c6fecef2
1 ファイル変更20 行追加3 行削除
  1. 20 3
      models/qhj.go

+ 20 - 3
models/qhj.go

@@ -523,8 +523,10 @@ type QhjTradeGoodsPickup struct {
 	GOODSNAME            string  `json:"goodsname"  xorm:"'GOODSNAME'"`                     // 商品名称
 	GOODSCODE            string  `json:"goodscode"  xorm:"'GOODSCODE'"`                     // 商品代码
 	DECIMALPLACE         int32   `json:"decimalplace"  xorm:"'DECIMALPLACE'"`               // 商品报价小数位
+	QTYDECIMALPLACE      int     `json:"qtydecimalplace"  xorm:"'QTYDECIMALPLACE'"`         // 商品数量小数位
 	LOGINCODE            string  `json:"logincode"  xorm:"'LOGINCODE'"`                     // 账号(登录代码, 有可能为空)
 	USERINFOTYPE         int32   `json:"userinfotype"  xorm:"'USERINFOTYPE'"`               // 客户类型 1-个人 2-企业
+	MOBILE               string  `json:"-"  xorm:"'MOBILE'"`                                // 手机号码(userinfo表中的手机号码)
 
 	ENUMDICNAME   string `json:"enumdicname"`   // 单位名称(提货商品)
 	USERNAME      string `json:"username"`      // 用户名称
@@ -543,10 +545,15 @@ func (r *QhjTradeGoodsPickup) calc() {
 	r.CITYNAME = mtpcache.GetDivisionName(r.CITYID)
 	r.PROVINCENAME = mtpcache.GetDivisionName(r.PROVINCEID)
 	r.DISTRICTNAME = mtpcache.GetDivisionName(r.DISTRICTID)
+	if len(r.LOGINCODE) == 0 {
+		// 如果登录代码为空, 取手机号码显示
+		r.LOGINCODE = DecryptField(r.MOBILE)
+	}
+	ZoomByDecimal(r.QTYDECIMALPLACE, &r.GOODSQTY)
 }
 
 func (r *QhjTradeGoodsPickup) buildSql() string {
-	var sqlId utils.SQLVal = "with k as (select t.userid, wm_concat(t.logincode) logincode from loginaccount t group by t.userid)" +
+	var sqlId utils.SQLVal = "with tmp as (select t.userid, wm_concat(t.logincode) logincode from loginaccount t group by t.userid)" +
 		"SELECT t.AUDITSRC," +
 		"       t.STOREUSERID," +
 		"       t.ARTRADEDATE," +
@@ -591,9 +598,11 @@ func (r *QhjTradeGoodsPickup) buildSql() string {
 		"       g.PICKUPGOODSUNITID," +
 		"       g2.goodsname," +
 		"       g2.decimalplace," +
+		"       g2.qtydecimalplace," +
 		"       g2.goodscode," +
 		"       u.userinfotype," +
-		"       k.logincode" +
+		"       u.mobile," +
+		"       tmp.logincode" +
 		"  FROM TRADE_GOODSPICKUP t" +
 		"  LEFT JOIN TRADE_GOODSPICKUPDETAIL k" +
 		"    on t.takeorderid = k.takeorderid" +
@@ -603,7 +612,7 @@ func (r *QhjTradeGoodsPickup) buildSql() string {
 		"    on t.goodsid = g2.goodsid" +
 		"  LEFT JOIN USERINFO u" +
 		"    on t.storeuserid = u.userid" +
-		"  LEFT JOIN k on t.userid=k.userid" +
+		"  LEFT JOIN tmp on t.userid=tmp.userid" +
 		" WHERE 1 = 1"
 	// 获取角色=20组织的角色数据, 判断机构类型
 	m := QhjAreaRole{USERID: r.USERID, ROLETYPE: 20}
@@ -1057,6 +1066,9 @@ func (r *QhjCustomer) calc() {
 	r.CARDNUM = DecryptField(r.CARDNUM)
 	r.MOBILE = DecryptField(r.MOBILE)
 	r.EMAIL = DecryptField(r.EMAIL)
+	if len(r.LOGINCODE) == 0 {
+		r.LOGINCODE = r.MOBILE
+	}
 }
 
 func (r *QhjCustomer) level() int32 {
@@ -1469,6 +1481,7 @@ type QhjAccountOutInApply struct {
 	LOGINCODE           string  `json:"logincode"  xorm:"'LOGINCODE'"`                   // 登录账号(账号)
 	USERINFOTYPE        int32   `json:"userinfotype"  xorm:"'USERINFOTYPE'"`             // 账户类型 1-个人 2-企业
 	ACCOUNTNAME         string  `json:"accountname"  xorm:"'ACCOUNTNAME'"`               // 用户名称(名称)
+	MOBILE              string  `json:"-"  xorm:"'MOBILE'"`                              // 手机号
 
 	BeginDate  string `json:"-"` // 开始日期(yyyymmdd)
 	EndDate    string `json:"-"` // 结束日期(yyyymmdd)
@@ -1478,6 +1491,9 @@ type QhjAccountOutInApply struct {
 func (r *QhjAccountOutInApply) calc() {
 	r.BANKACCOUNTNAME = DecryptField(r.BANKACCOUNTNAME)
 	r.BANKACCOUNTNO = DecryptField(r.BANKACCOUNTNO)
+	if len(r.LOGINCODE) == 0 {
+		r.LOGINCODE = DecryptField(r.MOBILE)
+	}
 }
 
 func (r *QhjAccountOutInApply) buildSql() string {
@@ -1523,6 +1539,7 @@ func (r *QhjAccountOutInApply) buildSql() string {
 		"       u.userid," +
 		"       u.accountname," +
 		"       ui.userinfotype," +
+		"       ui.mobile," +
 		"       tmp.logincode" +
 		"  FROM BANK_ACCOUNTOUTINAPPLY t" +
 		"  INNER JOIN TAACCOUNT ta on t.accountcode=to_char(ta.accountid)" +