소스 검색

Merge branch 'feature/v4.9.21' into dev/v4.9.21_rjj

renjiaojiao 1 년 전
부모
커밋
c3d1198ed3

+ 63 - 1
src/jfw/front/dataExport.go

@@ -346,6 +346,58 @@ func (d *DataExport) CancelOrder() error {
 	return nil
 }
 
+// 查询订单最后开票状态
+func QmxInvoice(res map[string]interface{}) bool {
+	if res["is_backstage_order"] == 1 && res["order_channel"] != "xdqd04" {
+		if res["return_status"] == 1 && public.Mysql.Count("invoice", map[string]interface{}{
+			"order_code": res["order_code"],
+		}) == 0 && res["signing_subject"] == "北京剑鱼信息技术有限公司" {
+			return true
+		}
+	}
+	return false
+}
+
+// 剩余金额
+func InvoicePrice(orderData map[string]interface{}) int64 {
+	residueMoney := int64(0)
+	if util.Int64All(orderData["applybill_status"]) == 2 {
+		return residueMoney
+	}
+
+	return util.Int64All(orderData["pay_money"]) - InvoiceAmount(util.InterfaceToStr(orderData["order_code"]))
+}
+
+func InvoiceAmount(orderCode string) (invoicedMoney int64) {
+	invoicedInfo := public.Mysql.SelectBySql(fmt.Sprintf("SELECT invoice_order_money,only_Identifying FROM invoice WHERE order_code = '%s' and invoice_status>=0", orderCode))
+	if invoicedInfo != nil && len(*invoicedInfo) > 0 {
+		onlyMap := make(map[string]int64)
+		for _, m := range *invoicedInfo {
+			if m["only_Identifying"] != nil { //过滤换票过程中的数据
+				onlyMap[util.InterfaceToStr(m["only_Identifying"])] = util.Int64All(m["invoice_order_money"])
+			} else {
+				invoicedMoney += util.Int64All(m["invoice_order_money"])
+			}
+		}
+		if len(onlyMap) > 0 {
+			for _, i := range onlyMap {
+				invoicedMoney += i
+			}
+		}
+	}
+	return
+}
+
+func ShowList(order_code string) []map[string]interface{} {
+	data := public.Mysql.SelectBySql(fmt.Sprintf(`SELECT *,(
+  SELECT count(1) as count FROM invoice b WHERE b.order_code = a.order_code and  b.only_Identifying is not null and b.only_Identifying = a.only_Identifying
+) as isChanged FROM invoice a WHERE order_code = '%s' and invoice_status != -2 and invoice_variety is not null and invoice_variety not  LIKE '%s' ORDER BY create_time DESC`, order_code, "%纸质%"))
+	if data == nil {
+		return nil
+	}
+	return *data
+}
+
 /*
 *
 根据 订单编号+userId 查询
@@ -367,7 +419,17 @@ func (d *DataExport) ToOrderDetail(orderCode string) error {
 	if orderCode != "" {
 		orderDetail = *public.Mysql.FindOne(tableName_order, queryMap, "", "")
 		//最后一次开票查询
-		orderDetail["source"] = LastInvoiceSource(orderCode)
+		//orderDetail["source"] = LastInvoiceSource(orderCode)
+		//如果是管理后台的单子 是否满足可开票
+		orderDetail["qmx_invoice"] = QmxInvoice(orderDetail)
+		//剩余可开票金额
+		var invoicePrice bool
+		if util.Int64All(orderDetail["create_time"]) > 1704038400 {
+			invoicePrice = InvoicePrice(orderDetail) > 0
+		}
+		orderDetail["invoice_price"] = invoicePrice
+		//是否存在可查看发票
+		orderDetail["invoice_show"] = len(ShowList(util.InterfaceToStr(orderDetail["order_code"]))) > 0
 	}
 	//	log.Println("ToOrderDetail", orderCode, orderDetail)
 	if orderDetail["pay_money"] != nil {

+ 3 - 1
src/jfw/modules/subscribepay/src/config.json

@@ -234,5 +234,7 @@
       }
     }
   },
-  "newOrderTime": 1709827200
+  "newOrderTime": 1709827200,
+  "signing_Subject":"北京剑鱼信息技术有限公司",
+  "orderTime":1704038400
 }

+ 1 - 1
src/jfw/modules/subscribepay/src/service/invoice.go

@@ -522,7 +522,7 @@ func (this *Invoice) NewInvoiceShow() {
 	case "1": //订单回显金额
 		data["pay_money"] = ResidueMoney(code)
 	case "2": //发票信息回显
-		invoice := util.Mysql.FindOne("invoice", map[string]interface{}{"id": code}, "id,order_code,invoice_money,invoice_type,invoice_content,invoice_variety,company_name,phone,mail,taxpayer_identnum,invoice_money,invoice_order_money,company_address,bank_name,recipient,delivery_address,bank_account,company_phone", "")
+		invoice := util.Mysql.FindOne("invoice", map[string]interface{}{"id": code}, "id,only_Identifying,order_code,invoice_money,invoice_type,invoice_content,invoice_variety,company_name,phone,mail,taxpayer_identnum,invoice_money,invoice_order_money,company_address,bank_name,recipient,delivery_address,bank_account,company_phone", "")
 		data["invoice"] = invoice
 	}
 	this.ServeJson(map[string]interface{}{

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 918 - 903
src/jfw/modules/subscribepay/src/service/orderListDetails.go


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.