Browse Source

Merge branch 'dev2.6.6' into release

lianbingjie 5 năm trước cách đây
mục cha
commit
8082d12f5c

+ 2 - 0
core/README.md

@@ -0,0 +1,2 @@
+v2.6.6
+电子发票-退款

+ 4 - 3
core/src/config.json

@@ -55,8 +55,8 @@
         "s_industry": [7,99],
 		"s_avatar": [8,99]
     },
-	"jyWebdomain":"http://192.168.110.101:82",
-	"qmxWebdomain":"http://wxlxl.qmx.top",
+	"jyWebdomain":"http://web-jydev-xzh.jianyu360.cn",
+	"qmxWebdomain":"http://web-jydev-xzh.jianyu360.cn",
 	"jyadd":"http://webws.qmx.top/jyapp/free/message/",
 	"jyopSmtp":{
 		"addr": "smtp.exmail.qq.com",
@@ -84,5 +84,6 @@
 		"passWord": "Topnet123"
 	},
 	"pushSubscribeRpc":"127.0.0.1:1122",
-	"jyRpc":"127.0.0.1:8084"
+	"jyRpc":"127.0.0.1:8084",
+	"invoice_interface_address": "http://192.168.3.14:7080/Invoice/Add"
 }

+ 45 - 44
core/src/qfw/coreconfig/SysConfig.go

@@ -5,50 +5,51 @@ package coreconfig
 
 //系统配置
 type config struct {
-	Webserverport      string                 `json:"webServerPort"` //web服务器端口
-	Redisservers       string                 `json:"redisServers"`  //redis缓存服务器列表
-	Useredis           bool                   `json:"useRedis"`
-	Mongodbservers     string                 `json:"mongodbServers"` //mongodb节点
-	MongodbPoolSize    int                    `json:"mongodbPoolSize"`
-	MongodbName        string                 `json:"mongodbName"`
-	Cassandra          []string               `json:"cassandra"`
-	Cassandrasize      int                    `json:"cassandrasize"`
-	Elasticsearch      string                 `json:"elasticsearch"`
-	JyEscsearch        string                 `json:"jyescsearch"` //content内容
-	Smtp               smtp                   `json:"smtp"`
-	JyopSmtp           smtp                   `json:"jyopSmtp"`
-	Sms                sms                    `json:"sms"`
-	Entrelation        entrelation            `json:"entrelation”`
-	Allownfiletype     string                 `json:"allownfiletype"`
-	Filesize           int                    `json:"filesize"`
-	TemplateCache      bool                   `json:"templateCache"`
-	HttpCache          bool                   `json:"httpCache"`
-	MailFailureTime    int                    `json:"mailFailureTime"`
-	ChatServer         string                 `json:"chatServer"`
-	ChatRpc            string                 `json:"chatRpc"`
-	PushRpc            string                 `json:"pushRpc"`
-	ElasticPoolSize    int                    `json:"elasticPoolSize"`
-	Ocr_uid            string                 `json:"orc_uid"`
-	Ocr_servicekey     string                 `json:"ocr_servicekey"`
-	Ocr_servicecode    string                 `json:"ocr_servicecode"`
-	EntMongodbservers  string                 `json:"entMongodbServers"` //mongodb节点
-	EntMongodbPoolSize int                    `json:"entMongodbPoolSize"`
-	EntMongodbName     string                 `json:"entMongodbName"`
-	EntMongodbAlias    string                 `json:"entMongodbAlias"`
-	FollowEnterprise   int                    `json:"followEnterprise"`
-	AtrrTitle          map[string]interface{} `json:"atrrTitle"`
-	JyWebdomain        string                 `json:"jyWebdomain"`
-	QmxWebdomain       string                 `json:"qmxWebdomain"`
-	ServiceApp         int                    `json:"serviceApp"`
-	Jyadd              string                 `json:"jyadd"`
-	JyopWebdomain      string                 `json:"jyopWebdomain"`
-	UdpHandle          udphandle              `json:"udpHandle"`
-	Per_del_openid     []string               `json:"per_del_openid"`
-	AppPushServiceRpc  string                 `json:"appPushServiceRpc"`
-	Pchelper           Pchelper               `json:"pcHelper"`
-	Mysql              map[string]string      `json:"mysql"`
-	PushSubscribeRpc   string                 `json:"pushSubscribeRpc"`
-	JyRpc              string                 `json:"jyRpc"`
+	Webserverport             string                 `json:"webServerPort"` //web服务器端口
+	Redisservers              string                 `json:"redisServers"`  //redis缓存服务器列表
+	Useredis                  bool                   `json:"useRedis"`
+	Mongodbservers            string                 `json:"mongodbServers"` //mongodb节点
+	MongodbPoolSize           int                    `json:"mongodbPoolSize"`
+	MongodbName               string                 `json:"mongodbName"`
+	Cassandra                 []string               `json:"cassandra"`
+	Cassandrasize             int                    `json:"cassandrasize"`
+	Elasticsearch             string                 `json:"elasticsearch"`
+	JyEscsearch               string                 `json:"jyescsearch"` //content内容
+	Smtp                      smtp                   `json:"smtp"`
+	JyopSmtp                  smtp                   `json:"jyopSmtp"`
+	Sms                       sms                    `json:"sms"`
+	Entrelation               entrelation            `json:"entrelation”`
+	Allownfiletype            string                 `json:"allownfiletype"`
+	Filesize                  int                    `json:"filesize"`
+	TemplateCache             bool                   `json:"templateCache"`
+	HttpCache                 bool                   `json:"httpCache"`
+	MailFailureTime           int                    `json:"mailFailureTime"`
+	ChatServer                string                 `json:"chatServer"`
+	ChatRpc                   string                 `json:"chatRpc"`
+	PushRpc                   string                 `json:"pushRpc"`
+	ElasticPoolSize           int                    `json:"elasticPoolSize"`
+	Ocr_uid                   string                 `json:"orc_uid"`
+	Ocr_servicekey            string                 `json:"ocr_servicekey"`
+	Ocr_servicecode           string                 `json:"ocr_servicecode"`
+	EntMongodbservers         string                 `json:"entMongodbServers"` //mongodb节点
+	EntMongodbPoolSize        int                    `json:"entMongodbPoolSize"`
+	EntMongodbName            string                 `json:"entMongodbName"`
+	EntMongodbAlias           string                 `json:"entMongodbAlias"`
+	FollowEnterprise          int                    `json:"followEnterprise"`
+	AtrrTitle                 map[string]interface{} `json:"atrrTitle"`
+	JyWebdomain               string                 `json:"jyWebdomain"`
+	QmxWebdomain              string                 `json:"qmxWebdomain"`
+	ServiceApp                int                    `json:"serviceApp"`
+	Jyadd                     string                 `json:"jyadd"`
+	JyopWebdomain             string                 `json:"jyopWebdomain"`
+	UdpHandle                 udphandle              `json:"udpHandle"`
+	Per_del_openid            []string               `json:"per_del_openid"`
+	AppPushServiceRpc         string                 `json:"appPushServiceRpc"`
+	Pchelper                  Pchelper               `json:"pcHelper"`
+	Mysql                     map[string]string      `json:"mysql"`
+	PushSubscribeRpc          string                 `json:"pushSubscribeRpc"`
+	JyRpc                     string                 `json:"jyRpc"`
+	Invoice_interface_address string                 `json:"invoice_interface_address"`
 }
 type smtp struct {
 	Addr     string `json:"addr"`

+ 10 - 1
core/src/qfw/manage/dataExport.go

@@ -48,6 +48,7 @@ func (d *DataExport) DataDetail(order_code string) error {
 	downloadUrl := util.ObjToString((*res)["download_url"])
 	//订单状态 用于判断是否取消 -2 为取消
 	order_status := util.IntAll((*res)["order_status"])
+	apply_refund_name := util.ObjToString((*res)["apply_refund_name"])
 
 	//申请发票
 	applybill_status := util.IntAll((*res)["applybill_status"])
@@ -56,7 +57,11 @@ func (d *DataExport) DataDetail(order_code string) error {
 	} else if applybill_status == 0 {
 		(*res)["applybill_status"] = "未申请"
 	}
-	//0个人 1单位
+	//2020-4-22电子发票:徐志恒
+	data := cutil.Mysql.Find("invoice", qMap, "", "create_time", 0, 0)
+	if *data != nil && len(*data) != 0 {
+		(*res)["invoice"] = *data
+	}
 	applybill_type := util.IntAll((*res)["applybill_type"])
 	if applybill_type == 1 {
 		(*res)["applybill_type"] = "单位"
@@ -93,6 +98,10 @@ func (d *DataExport) DataDetail(order_code string) error {
 
 	if pay_time != "" {
 		(*res)["order_status"] = "已支付"
+		if apply_refund_name != "" {
+			(*res)["order_status"] = "已取消"
+			(*res)["cancel"] = "已取消"
+		}
 		if serviceStatus == 1 {
 			(*res)["service_status"] = "发送成功"
 		} else {

+ 4 - 0
core/src/qfw/manage/entnicheOrder.go

@@ -108,8 +108,12 @@ func (v *EntnicheOrder) EntnicheOrderDetail(order_code string) error {
 		payway := util.ObjToString((*res)["pay_way"])
 		//
 		pay_money := util.Float64All((*res)["pay_money"])
+		apply_refund_name := util.ObjToString((*res)["apply_refund_name"])
 		if pay_money != 0 && pay_time != "" {
 			(*res)["order_status"] = "已支付"
+			if apply_refund_name != "" {
+				(*res)["order_status"] = "已取消"
+			}
 		} else {
 			if order_status == -2 {
 				(*res)["order_status"] = "已取消"

+ 97 - 0
core/src/qfw/manage/refund.go

@@ -0,0 +1,97 @@
+package manage
+
+import (
+	"encoding/json"
+	"log"
+	"qfw/coreconfig"
+	cutil "qfw/coreutil"
+	"qfw/util"
+
+	//"qfw/util/mongodb"
+	"bytes"
+	"io/ioutil"
+	"net/http"
+	"strconv"
+
+	"github.com/go-xweb/xweb"
+)
+
+type Refund struct {
+	*xweb.Action
+	refundInfo xweb.Mapper `xweb:"/manage/refund/(\\w+)"` //退款信息保存
+}
+
+func init() {
+	xweb.AddAction(&Refund{})
+}
+
+func (d *Refund) RefundInfo(orderCode string) {
+	apply_refund_name := d.GetString("applyName")
+	apply_refund_time, _ := strconv.ParseInt(d.GetString("applyTime"), 10, 64)
+	apply_refund_reason := d.GetString("applyReason")
+	qMap := map[string]interface{}{}
+	qMap["order_code"] = orderCode
+	ok := cutil.Mysql.Update("dataexport_order", qMap, map[string]interface{}{
+		"order_status":        -2,
+		"apply_refund_name":   apply_refund_name,
+		"apply_refund_time":   apply_refund_time,
+		"apply_refund_reason": apply_refund_reason,
+	})
+	if ok {
+		data := cutil.Mysql.Find("invoice", qMap, "", "create_time", 0, 0)
+		if *data != nil || len(*data) != 0 {
+			if len(*data) > 1 {
+				// if (*status)[1]["url"] != nil {
+				invoice_serialnum := util.ObjToString((*data)[1]["invoice_serialnum"])
+				RefundInvoice(invoice_serialnum)
+				// }
+			} else {
+				// if (*status)[0]["url"] != nil {
+				invoice_serialnum := util.ObjToString((*data)[0]["invoice_serialnum"])
+				RefundInvoice(invoice_serialnum)
+				// }
+			}
+		}
+		d.ServeJson(map[string]interface{}{
+			"success": "true",
+		})
+	}
+}
+
+//退票 发票流水号
+func RefundInvoice(invoice_serialnum string) {
+	var refund_flag = -1
+	if invoice_serialnum != "" {
+		query := make(map[string]interface{})
+		query["invoice_serialnum"] = invoice_serialnum
+		res := cutil.Mysql.FindOne("invoice", query, "invoice_code,invoice_number", "")
+		if res != nil {
+			req_ := make(map[string]interface{})
+			req_["fpdm"] = (*res)["invoice_code"]
+			req_["fphm"] = (*res)["invoice_number"]
+			b, _ := json.Marshal(req_)
+			buffer := bytes.NewBuffer(b)
+			request, err := http.NewRequest("POST", coreconfig.SysConfig.Invoice_interface_address, buffer)
+			if err == nil {
+				client := &http.Client{}
+				response, _ := client.Do(request)
+				res, _ := ioutil.ReadAll(response.Body)
+				defer response.Body.Close()
+				result := map[string]interface{}{}
+				err := json.Unmarshal(res, &result)
+				if err != nil {
+					log.Println("json序列化错误")
+				} else {
+					if result["code"].(string) == "0" {
+						refund_flag = 0
+					} else if result["code"].(string) == "1" {
+						refund_flag = 1
+					} else {
+						refund_flag = 2
+					}
+				}
+				go cutil.Mysql.Update("invoice", query, map[string]interface{}{"refund_flag": refund_flag})
+			}
+		}
+	}
+}

+ 4 - 0
core/src/qfw/manage/vipOrder.go

@@ -166,8 +166,12 @@ func (v *VipOrder) VipOrderDetail(order_code string) error {
 		order_status := util.IntAll((*res)["order_status"])
 		payway := util.ObjToString((*res)["pay_way"])
 		original_price := util.Int64All((*res)["original_price"])
+		apply_refund_name := util.ObjToString((*res)["apply_refund_name"])
 		if pay_time != "" && original_price != 0 {
 			(*res)["order_status"] = "已支付"
+			if apply_refund_name != "" {
+				(*res)["order_status"] = "已取消"
+			}
 		} else {
 			if order_status == -2 {
 				(*res)["order_status"] = "已取消"

+ 201 - 10
core/src/web/staticres/dataexport/dataExport.css

@@ -9,19 +9,210 @@
 .right { float: right; width: calc(100% - 220px); border: 1px solid #ddd; min-height: 506px; }
 .right .title { height: 78px; line-height: 78px; padding-left: 80px; font-size: 16px; background: #fff; }
 .right .title span { width: 36px; height: 1px; background: #333333; display: inline-block; vertical-align: middle; }
-.right .order_info .hd, .right .download_link .hd, .right .filter .hd { height: 34px; line-height: 34px; background: #f7f8fa; padding-left: 120px; font-size: 14px; border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }
-.right .order_info .bd, .right .download_link .bd, .right .filter .bd { padding: 0 120px; background: #fff; }
-.right .order_info .bd .line, .right .download_link .bd .line, .right .filter .bd .line { float: left; width: 1px; height: 155px; background: #ddd; margin-top: 20px; }
-.right .order_info .bd .row, .right .download_link .bd .row, .right .filter .bd .row { float: left; padding: 0px 30px 30px 30px; }
-.right .order_info .bd .row .row-list, .right .download_link .bd .row .row-list, .right .filter .bd .row .row-list { line-height: 1.8; font-size: 14px;  }
-.right .order_info .bd .first, .right .download_link .bd .first, .right .filter .bd .first { padding-left: 14px; width: 37%; }
-.right .order_info .bd .second, .right .download_link .bd .second, .right .filter .bd .second { width: 30%; }
+.right .order_info .hd, .right .download_link .hd, .right .filter .hd, .right .invoice .hd { height: 34px; line-height: 34px; background: #f7f8fa; padding-left: 120px; font-size: 14px; border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }
+.right .order_info .bd, .right .download_link .bd, .right .filter .bd, .right .invoice .bd { padding: 0 120px; background: #fff; }
+.right .order_info .bd .line, .right .download_link .bd .line, .right .filter .bd .line, .right .invoice .bd .line { float: left; width: 1px; height: 155px; background: #ddd; margin-top: 20px; }
+.right .order_info .bd .row, .right .download_link .bd .row, .right .filter .bd .row, .right .invoice .bd .row { float: left; padding: 0px 30px 30px 30px; }
+.right .order_info .bd .row .row-list, .right .download_link .bd .row .row-list, .right .filter .bd .row .row-list, .right .invoice .bd .row .row-list { line-height: 1.8; font-size: 14px;  }
+.right .order_info .bd .first, .right .download_link .bd .first, .right .filter .bd .first, .right .invoice .bd .first { padding-left: 14px; width: 37%; }
+.right .order_info .bd .second, .right .download_link .bd .second, .right .filter .bd .second, .right .invoice .bd .second { width: 30%; }
 .right .order_info .bd .third, .right .download_link .bd .third, .right .filter .bd .third { width: 38%; }
-.right .order_info .bd .link, .right .download_link .bd .link, .right .filter .bd .link { height: 56px; line-height: 56px; font-size: 14px; }
-.right .order_info .bd .link:hover, .right .download_link .bd .link:hover, .right .filter .bd .link:hover { color: #f00; }
-.right .order_info .bd .filter_cont, .right .download_link .bd .filter_cont, .right .filter .bd .filter_cont { padding: 20px 0 60px 0;margin-left: -2px }
+.right .order_info .bd .link, .right .download_link .bd .link, .right .filter .bd .link, .right .invoice .bd .link { height: 56px; line-height: 56px; font-size: 14px; }
+.right .order_info .bd .link:hover, .right .download_link .bd .link:hover, .right .filter .bd .link:hover, .right .invoice .bd .link:hover { color: #f00; }
+.right .order_info .bd .filter_cont, .right .download_link .bd .filter_cont, .right .filter .bd .filter_cont { padding: 20px 0 30px 0;margin-left: -2px }
 .right .order_info .bd .filter_cont .filter-list, .right .download_link .bd .filter_cont .filter-list, .right .filter .bd .filter_cont .filter-list { width: 100%; margin-bottom: 10px; font-size: 14px; }
 .right .order_info .bd .filter_cont .filter-list label, .right .download_link .bd .filter_cont .filter-list label, .right .filter .bd .filter_cont .filter-list label { float: left; width: 70px; }
 .right .order_info .bd .filter_cont .filter-list .ul, .right .download_link .bd .filter_cont .filter-list .ul, .right .filter .bd .filter_cont .filter-list .ul { float: left; }
 .right .order_info .bd .filter_cont .filter-list .ul li, .right .download_link .bd .filter_cont .filter-list .ul li, .right .filter .bd .filter_cont .filter-list .ul li { float: left; margin-right: 8px; }
 .right .order_info .bd .filter_cont .filter-list .ul .keywords, .right .download_link .bd .filter_cont .filter-list .ul .keywords, .right .filter .bd .filter_cont .filter-list .ul .keywords { margin-right: 16px; border: 1px solid #ddd; padding: 14px 36px 14px 14px; }
+.order_status {
+	position: absolute;
+	width: 48px;
+	height: 21px;
+	left: 520px;
+	top: 152px;
+	font-family: Microsoft YaHei;
+	font-style: normal;
+	font-weight: normal;
+	font-size: 16px;
+	line-height: 21px;
+	color: #4DB443;
+}
+.refund {
+	position: absolute;
+	width: 110px;
+	height: 38px;
+	left: 85%;
+	top: 142px;
+	background: #FF3A20;
+	border-radius: 4px;
+	color: #FFFFFF;
+}
+.refund_success{
+	position: absolute;
+	width: 110px;
+	height: 38px;
+	left: 1611px;
+	top: 142px;
+	background: #C2C2C2;
+	border-radius: 4px;
+	color: #FFFFFF;
+}
+.refund_info{
+	position: absolute;
+	width: 56px;
+	height: 24px;
+	left: 1745px;
+	top: 149px;
+	font-family: Microsoft YaHei;
+	font-style: normal;
+	font-weight: normal;
+	font-size: 14px;
+	line-height: 24px;
+	color: #2CB7CA;
+}
+.invoice a {
+	color: #2CB7CA;
+}
+.right-two, .right-three{
+	height: 600px;
+}
+.apply_refund {
+	width: 72px;
+	height: 24px;
+	font-family: Microsoft YaHei;
+	font-style: normal;
+	font-weight: bold;
+	font-size: 18px;
+	line-height: 24px;
+	color: #4E5051;
+	margin-top: 25px;
+	margin-left: 101px;
+}
+.heng {
+	width: 80%;
+	height: 0px;
+	border: 1px solid #9FD6DD;
+	margin-top: 9px;
+	margin-left: 66px;
+}
+.apply_info{
+	width: 100px;
+	margin-top: 32px;
+	margin-left: 182px;
+	float: left;
+}
+.apply_infos{
+	float: left;
+	margin-top: 32px;
+	margin-left: 16px;
+}
+.apply{
+	font-family: Microsoft YaHei;
+	font-style: normal;
+	font-weight: normal;
+	font-size: 14px;
+	line-height: 24px;
+	color: #4E5051;
+	float: right;
+}
+.applys{
+	font-family: Microsoft YaHei;
+	font-style: normal;
+	font-weight: normal;
+	font-size: 14px;
+	line-height: 24px;
+	color: #4E5051;
+}
+.apply_time{
+	padding-top: 16px;
+}
+.apply_reason{
+	padding-top: 23px;
+}
+.apply_times{
+	padding-top: 16px;
+}
+.apply_reasons{
+	margin-top: 23px;
+	padding: 7px 16px;
+	width: 680px;
+	height: 269px;
+}
+.select_refund{
+	position: absolute;
+	width: 110px;
+	height: 38px;
+	left: 543px;
+	top: 593px;
+	background: #FF3A20;
+	border-radius: 4px;
+	color: #fff;
+}
+.select_qx{
+	position: absolute;
+	width: 110px;
+	height: 38px;
+	left: 669px;
+	top: 593px;
+	background: #FFFFFF;
+	border: 1px solid #CCCCCC;
+	box-sizing: border-box;
+	border-radius: 4px;
+	color: #000;
+}
+.isrefund{
+	position: fixed;
+	width: 360px;
+	height: 174px;
+	left: 40%;
+	top: 32%;
+	background: #FFFFFF;
+	box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.2);
+	border-radius: 8px;
+}
+.isrefund .ts{
+	width: 360px;
+	height: 24px;
+	font-family: Microsoft YaHei;
+	font-style: normal;
+	font-weight: normal;
+	font-size: 18px;
+	line-height: 24px;
+	text-align: center;
+	color: #4E5051;
+	margin-top: 24px;
+}
+.isrefund .isre{
+	width: 360px;
+	height: 24px;
+	font-family: Microsoft YaHei;
+	font-style: normal;
+	font-weight: normal;
+	font-size: 14px;
+	line-height: 24px;
+	text-align: center;
+	color: #4E5051;
+	margin-top: 16px;
+	margin-left: 5px;
+}
+#select_quxiao{
+	width: 110px;
+	height: 38px;
+	background: #C2C2C2;
+	border-radius: 4px;
+	margin-top: 24px;
+	margin-left: 24px;
+	float: left;
+	color: #fff;
+}
+.btn-save{
+	width: 110px;
+	height: 38px;
+	background: #FF3A20;
+	border-radius: 4px;
+	margin-top: 24px;
+	margin-left: 92px;
+	float: left;
+	color: #fff;
+}

BIN
core/src/web/templates/.DS_Store


+ 368 - 102
core/src/web/templates/manage/dataExport.html

@@ -66,99 +66,20 @@
 					<a class="pbtn" href="/manage/dataExport/toOfflinePayPage/{{.T.res.orderCode}}">已线下支付</a>
           {{end}}
 				</div>
-				<!-- 订单信息 -->
-				<div class="order_info" >
-					<div class="hd">订单信息</div>
-					<div class="bd clearfix" style="padding-right: 65px;">
-						<ul class="row first"  style="margin-top:20px  !important;">
-							<li class="row-list nofloat">支付状态:{{.T.res.order_status}}</li>
-							<li class="row-list nofloat">数据发送状态:{{.T.res.service_status}}</li>
-							<li class="row-list nofloat">订单编号:{{.T.res.order_code}}</li>
-							<li class="row-list nofloat">下单时间:{{.T.res.create_time}}</li>
-							{{if .T.res.order_status}}
-							{{if eq .T.res.order_status "已支付"}}
-							<li class="row-list nofloat">支付时间:{{.T.res.pay_time}}</li>
-                {{if .T.transaction_id}}
-							  <li class="row-list nofloat">{{.T.res.pay_way}}支付单号:{{.T.transaction_id}}</li>
-                {{end}}
-							{{else}}
-							<li class="row-list nofloat">支付时间:-</li>
-							<li class="row-list nofloat">{{.T.res.pay_way}}支付单号:-</li>
-							{{end}}
-							{{end}}
-						</ul>
-						<div class="line"></div>
-						<ul class="row second"  style="margin-top:20px  !important;">
-							<li class="row-list nofloat">产品类型:{{.T.res.product_type}}</li>
-							<li class="row-list nofloat">数据规格:{{.T.res.data_spec}}</li>
-							<li class="row-list nofloat">数量:{{.T.res.data_count}}条</li>
-							<li class="row-list nofloat">价格:{{.T.res.order_money}}元</li>
-							<li class="row-list nofloat">邮箱地址:{{.T.res.user_mail}}</li>
-							<li class="row-list nofloat">手机号:{{.T.res.user_phone}}</li>
-						</ul>
-						<div class="line"></div>
-						<ul class="row third"  style="margin-top:20px  !important;padding-right: 0px;">	
-							{{if .T.res.order_status}}
-							{{if eq .T.res.order_status "未支付"}}
-							<li class="row-list nofloat">发票类型:-</li>
-							<li class="row-list nofloat">发票内容:-</li>
-							<li class="row-list nofloat">发票抬头:-</li>
-							{{else}}
-							{{if .T.res.applybill_status}}
-							{{if eq .T.res.applybill_status "已申请"}}
-							<li class="row-list nofloat">发票状态:{{.T.res.applybill_status}}</li>
-							<li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
-							<li class="row-list nofloat">发票内容:明细</li>
-							<li class="row-list nofloat">发票抬头:{{.T.res.applybill_type}}</li>
-							{{else}}
-							<li class="row-list nofloat">发票状态:{{.T.res.applybill_status}}</li>
-							<li class="row-list nofloat">发票类型:-</li>
-							<li class="row-list nofloat">发票内容:-</li>
-							<li class="row-list nofloat">发票抬头:-</li>
-							{{end}}
-							{{end}}
-							{{if .T.res.applybill_type}}
-							{{if eq .T.res.applybill_type "个人"}}
-							<li class="row-list nofloat" style="display:none">单位名称:{{.T.res.applybill_company}}</li>
-							<li class="row-list nofloat" style="display:none">纳税人识别号:{{.T.res.applybill_taxnum}}</li>
-							{{else}}
-							<li class="row-list nofloat">单位名称:{{.T.res.applybill_company}}</li>
-							<li class="row-list nofloat">纳税人识别号:{{.T.res.applybill_taxnum}}</li>
-							{{end}}
-							{{end}}
-							{{end}}
-							{{end}}
-						</ul>
-					</div>
-				</div>
-       {{if .T.offlineImg}}
-        <div class="download_link">
-					<div class="hd">线下支付材料</div>
-					<div class="imgdiv">
-						{{range $k, $v := .T.offlineImg}} 
-              <img onclick="view(this)" src={{$v}}>
-            {{end}}
-					</div>
-				</div>
-        {{end}}
-				{{if .T.isExit.urlExit}}
-				{{if eq .T.isExit.urlExit "T"}}
-				<!-- 下载链接 -->
-				<div class="download_link" style="display:none">
-					<div class="hd">下载链接</div>
-					<div class="bd">
-						<a href="#" class="link">{{.T.res.download_url}}</a>
-					</div>
-				</div>
-				{{else}}
-				<div class="download_link">
-					<div class="hd">下载链接</div>
-					<div class="bd">
-						<a href="{{.T.res.download_url}}" class="link">{{.T.res.download_url}}</a>
-					</div>
-				</div>
-				{{end}}
-				{{end}}
+				<div class="order_status">{{.T.res.order_status}}</div>
+				<button class="refund" style="display: none;">退款</button>
+				<button type="button" class="refund_success" style="display: none;">已退款</button>
+				<a class="refund_info" style="display: none;">退款信息</a>
+				<script>
+					var order_status={{.T.res.order_status}};
+					if (order_status=="已取消"){
+						$(".order_status").css("color","#686868")
+					}else if (order_status=="已支付"){
+						$(".order_status").css("color","green")
+					}else if (order_status=="未支付") {
+						$(".order_status").css("color","red")
+					}
+				</script>
 				
 				<!-- 筛选条件 -->
 				<div class="filter">
@@ -183,7 +104,7 @@
 							</div>
 							
 							<div class="filter-list clearfix">
-
+				
 								<label>区域:</label>
 								{{range $k, $v := .T.filterData.area}}
 								<ul class="ul">
@@ -192,7 +113,7 @@
 								{{end}}
 							</div>
 							<div class="filter-list clearfix">
-
+				
 								<label>行业:</label>
 								<ul class="ul" style="width:92%">
 								{{range $k, $v := .T.filterData.industry}}
@@ -239,38 +160,186 @@
 								{{end}}
 							</div>
 							<div class="filter-list clearfix">
-
+				
 								<label>信息类型:</label>
 								<ul class="ul">
 									<li>{{.T.filterData.subtype}}</li>
 								</ul>
 							</div>
 							<div class="filter-list clearfix">
-
+				
 								<label>采购单位:</label>
 								<ul class="ul">
 								{{range $k, $v := .T.filterData.buyer}}
 									<li>{{$v}}</li>
 								{{end}}
 								</ul>
-
+				
 							</div>
 							<div class="filter-list clearfix">
-
+				
 								<label>中标单位:</label>
 								<ul class="ul">
 								{{range $k,$v :=.T.filterData.winner}}
 									<li>{{$v}}</li>
 								{{end}}
 								</ul>
-
+				
 							</div>
 						</div>
 					</div>
 				</div>
-
+				
+				{{if .T.offlineImg}}
+				 <div class="download_link">
+									<div class="hd">线下支付材料</div>
+									<div class="imgdiv">
+										{{range $k, $v := .T.offlineImg}} 
+				       <img onclick="view(this)" src={{$v}}>
+				     {{end}}
+									</div>
+								</div>
+				 {{end}}
+								{{if .T.isExit.urlExit}}
+								{{if eq .T.isExit.urlExit "T"}}
+								<!-- 下载链接 -->
+								<div class="download_link" style="display:none">
+									<div class="hd">下载链接</div>
+									<div class="bd">
+										<a href="#" class="link">{{.T.res.download_url}}</a>
+									</div>
+								</div>
+								{{else}}
+								<div class="download_link">
+									<div class="hd">下载链接</div>
+									<div class="bd">
+										<a href="{{.T.res.download_url}}" class="link">{{.T.res.download_url}}</a>
+									</div>
+								</div>
+								{{end}}
+								{{end}}
+								
+				<!-- 订单信息 -->
+				<div class="order_info" >
+					<div class="hd">支付信息</div>
+					<div class="bd clearfix" style="padding-right: 65px;">
+						<ul class="row first"  style="margin-top:20px  !important;">
+							<!-- <li class="row-list nofloat">数据发送状态:{{.T.res.service_status}}</li> -->
+							<li class="row-list nofloat">订单编号:{{.T.res.order_code}}</li>
+							{{if .T.res.order_status}}
+							{{if eq .T.res.order_status "已支付"}}
+							<li class="row-list nofloat">支付方式:{{.T.res.pay_way}}</li>
+							<li class="row-list nofloat">下单时间:{{.T.res.create_time}}</li>
+							<li class="row-list nofloat">支付时间:{{.T.res.pay_time}}</li>
+                {{if .T.transaction_id}}
+							  <li class="row-list nofloat">支付单号:{{.T.transaction_id}}</li>
+                {{end}}
+							{{else}}
+							<li class="row-list nofloat">支付方式:-</li>
+							<li class="row-list nofloat">下单时间:{{.T.res.create_time}}</li>
+							<li class="row-list nofloat">支付时间:-</li>
+							<li class="row-list nofloat">{{.T.res.pay_way}}支付单号:-</li>
+							{{end}}
+							{{end}}
+						</ul>
+						<div class="line"></div>
+						<ul class="row second"  style="margin-top:20px  !important;">
+							<li class="row-list nofloat">支付单号:{{.T.transaction_id}}</li>
+							<li class="row-list nofloat">产品类型:{{.T.res.product_type}}</li>
+							<li class="row-list nofloat">数据规格:{{.T.res.data_spec}}</li>
+							<li class="row-list nofloat">数量:{{.T.res.data_count}}条</li>
+							<li class="row-list nofloat">实付金额:{{.T.res.order_money}}元</li>
+							<li class="row-list nofloat">邮箱地址:{{.T.res.user_mail}}</li>
+							<li class="row-list nofloat">手机号:{{.T.res.user_phone}}</li>
+						</ul>
+						<!-- <div class="line"></div>
+						<ul class="row third"  style="margin-top:20px  !important;padding-right: 0px;">	
+							{{if .T.res.order_status}}
+							{{if eq .T.res.order_status "未支付"}}
+							<li class="row-list nofloat">发票类型:-</li>
+							<li class="row-list nofloat">发票内容:-</li>
+							<li class="row-list nofloat">发票抬头:-</li>
+							{{else}}
+							{{if .T.res.applybill_status}}
+							{{if eq .T.res.applybill_status "已申请"}}
+							<li class="row-list nofloat">发票状态:{{.T.res.applybill_status}}</li>
+							<li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+							<li class="row-list nofloat">发票内容:明细</li>
+							<li class="row-list nofloat">发票抬头:{{.T.res.applybill_type}}</li>
+							{{else}}
+							<li class="row-list nofloat">发票状态:{{.T.res.applybill_status}}</li>
+							<li class="row-list nofloat">发票类型:-</li>
+							<li class="row-list nofloat">发票内容:-</li>
+							<li class="row-list nofloat">发票抬头:-</li>
+							{{end}}
+							{{end}}
+							{{if .T.res.applybill_type}}
+							{{if eq .T.res.applybill_type "个人"}}
+							<li class="row-list nofloat" style="display:none">单位名称:{{.T.res.applybill_company}}</li>
+							<li class="row-list nofloat" style="display:none">纳税人识别号:{{.T.res.applybill_taxnum}}</li>
+							{{else}}
+							<li class="row-list nofloat">单位名称:{{.T.res.applybill_company}}</li>
+							<li class="row-list nofloat">纳税人识别号:{{.T.res.applybill_taxnum}}</li>
+							{{end}}
+							{{end}}
+							{{end}}
+							{{end}}
+						</ul> -->
+					</div>
+				</div>
+				
+				<div class="invoice">
+					<div class="hd">发票信息</div>
+					<div class="bd clearfix" id="applyHtmls">
+						<ul class="row first" id="applyHtml">
+							
+						</ul>
+						<div class="line" style="margin-left: 20px;"></div>
+						<ul class="row second" id="lineHtml" style="margin-top:20px  !important;">
+							
+						</ul>
+					</div>
+				</div>
+				
+				<div class="right-two" style="display: none;" >
+					<div class="apply_refund">申请退款</div>
+					<div class="heng"></div>
+					<div class="apply_info">
+						<div class="apply apply_name">申请退款人员:</div>
+						<div class="apply apply_time">申请时间:</div>
+						<div class="apply apply_reason">申请原因:</div>
+					</div>
+					<div class="apply_infos">
+						<div class="applys apply_names" id="apply_name">{{session "loginName"}}</div>
+						<div class="applys apply_times" id="apply_refund_time"></div>
+						<textarea class="applys apply_reasons" placeholder="请输入申请原因" id="applyReason"></textarea>
+					</div>
+					<button type="button" class="select_refund">确定退款</button>
+					<button type="button" class="select_qx">取消</button>
+				</div>
+				<div class="right-three" style="display: none;" >
+					<div class="apply_refund">退款信息</div>
+					<div class="heng"></div>
+					<div class="apply_info">
+						<div class="apply apply_name">申请退款人员:</div>
+						<div class="apply apply_time">申请时间:</div>
+						<div class="apply apply_reason">申请原因:</div>
+					</div>
+					<div class="apply_infos">
+						<div class="applys apply_names" id="apply_names"></div>
+						<div class="applys apply_times" id="apply_refund_times"></div>
+						<div class="applys" style="margin-top: 23px;width: 680px;height: 269px;" id="applyReasons"></div>
+					</div>
+				</div>
 			</div>
 		</div>
+		<div class="isrefund" style="display: none;">
+			<div class="ts">提示</div>
+			<div class="isre">确定退款?</div>
+			<button type="button" id="select_quxiao">取消</button>
+			<button type="button" class="btn-save">确定退款</button>
+		</div>
+		
 		{{include "/common/bottom.html"}}
     <script>
       function view(obj){
@@ -280,7 +349,7 @@
       	}
       	if($("#tooltip1").size()>0){
       		$("#tooltip1").remove()
-      	}else{	
+      	}else{
       		var nimg=getNaturalWH(src);
       		var mt=$(document).scrollTop();
       		var tw1=nimg[0],th1=nimg[1];
@@ -303,6 +372,203 @@
   	    image.src = src;		
   	    return [image.width+10,image.height+10];
       }
+		$(".refund").on("click", function(){
+			$(".right").children().hide();
+			$(".right-two").show();
+		})
+		
+		$(".refund_info").on("click", function(){
+			$(".right").children().hide();
+			$(".right-three").show();
+		})
+		
+		$("#apply_refund_time").text(formatDate(new Date().getTime(), true))
+		var invoice = {{.T.res.invoice}};
+		var applyStatus = {{.T.res.applybill_status}};
+		var orderStatus = {{.T.res.order_status}};
+		var applyHtml = "";
+		var lineHtml = "";
+		console.log({{.T.res}})
+		var applyName = {{.T.res.apply_refund_name}}
+		var applyTime = {{.T.res.apply_refund_time}}
+		var applyReason = {{.T.res.apply_refund_reason}}
+		var applybill_type = {{.T.res.applybill_type}};
+		var applybill_company = {{.T.res.applybill_company}};
+		var applybill_taxnum = {{.T.res.applybill_taxnum}};
+		if(invoice !== null){
+				  var applyType = invoice[0].invoice_type;
+				  var taxpayer_identnum = invoice[0].taxpayer_identnum
+				  var create_time = invoice[0].create_time
+				  var create_times = formatDate(create_time *1000)
+				  var billing_time = invoice[0].billing_time
+				  var company_name = invoice[0].company_name
+				  
+				  if(orderStatus === "未支付"){
+				  	applyHtml  += `<li class="row-list nofloat">发票类型:-</li>
+				  	<li class="row-list nofloat">发票抬头:-</li>`
+				  	lineHtml += `<li class="row-list nofloat">开具时间:-</li>
+				  					<li class="row-list nofloat">发票:-</li>`
+				  }else{
+				  	if(applyStatus === "已申请"){
+				  		lineHtml += `<li class="row-list nofloat">开具时间:${formatDate(invoice[0].billing_time *1000)}</li>
+				  					<li class="row-list nofloat">发票:<a target="_blank" href="${invoice[0].url}">查看详情</a></li>`
+				  		if(applyType === "个人"){
+				  			
+				  			applyHtml  += `
+				  			<li class="row-list nofloat">申请时间:${create_times}</li>
+				  			<li class="row-list nofloat">申请状态:发票开具</li>
+				  			<li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+				  			<li class="row-list nofloat">发票抬头:个人</li>`
+				  		}else{
+				  			applyHtml  += `
+				  			<li class="row-list nofloat">申请时间:${create_times}</li>
+				  			<li class="row-list nofloat">申请状态:发票开具</li>
+				  			<li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+				  			<li class="row-list nofloat">发票抬头:单位</li>
+				  			<li class="row-list nofloat">单位名称:${company_name}</li>
+				  			<li class="row-list nofloat">纳税人识别号:${taxpayer_identnum}</li>
+				  			`
+				  		}
+				  	}else{
+				  		applyHtml  += `<li class="row-list nofloat">申请状态:${applyStatus}</li>
+				  		<li class="row-list nofloat">发票类型:-</li>
+				  		<li class="row-list nofloat">发票抬头:-</li>`
+				  		lineHtml += `<li class="row-list nofloat">开具时间:-</li>
+				  						<li class="row-list nofloat">发票:-</li>`
+				  	}
+				  }
+				  //
+				  $("#applyHtml").append(applyHtml);
+				  $("#lineHtml").append(lineHtml);
+				  if(invoice.length == 2){
+				  	var applyHtmls = "";
+				  	if(invoice[1].invoice_type === "个人"){
+				  		applyHtmls  += `
+				  		<div class="bd clearfix">
+				  			<ul class="row first">
+				  				<li class="row-list nofloat">申请时间:${formatDate(invoice[1].create_time *1000)}</li>
+				  				<li class="row-list nofloat">申请状态:发票开具</li>
+				  				<li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+				  				<li class="row-list nofloat">发票抬头:个人</li>
+				  			</ul>
+				  			<div class="line" style="margin-left: 20px;float: left;width: 1px;height: 155px;background: #ddd;margin-top: 20px;"></div>
+				  			<ul class="row second"  style="margin-top:20px  !important;">
+				  				<li class="row-list nofloat">开具时间:${formatDate(invoice[1].billing_time *1000)}</li>
+				  				<li class="row-list nofloat">发票:<a target="_blank" href="${invoice[1].url}">查看详情</a></li>
+				  			</ul>
+				  		</div>`
+				  	}else{
+				  		applyHtmls  += `
+				  		<div class="bd clearfix">
+				  			<ul class="row first">
+				  				<li class="row-list nofloat">申请时间:${formatDate(invoice[1].create_time *1000)}</li>
+				  				<li class="row-list nofloat">申请状态:发票开具</li>
+				  				<li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+				  				<li class="row-list nofloat">发票抬头:单位</li>
+				  				<li class="row-list nofloat">单位名称:${invoice[1].company_name}</li>
+				  				<li class="row-list nofloat">纳税人识别号:${invoice[1].taxpayer_identnum}</li>
+				  			</ul>
+				  			<div class="line" style="margin-left: 20px;float: left;width: 1px;height: 155px;background: #ddd;margin-top: 20px;"></div>
+				  			<ul class="row second"  style="margin-top:20px  !important;">
+				  				<li class="row-list nofloat">开具时间:${formatDate(invoice[1].billing_time *1000)}</li>
+				  				<li class="row-list nofloat">发票:<a target="_blank" href="${invoice[1].url}">查看详情</a></li>
+				  			</ul>
+				  		</div>`
+				  	}
+				  	$(".invoice").append(applyHtmls);
+				  }
+		}else{
+				  
+				  if(applyStatus === "已申请"){
+				  			  if(applybill_type === "个人"){
+				  				  applyHtml  += `
+				  				  <li class="row-list nofloat">申请时间:-</li>
+				  				  <li class="row-list nofloat">申请状态:发票开具</li>
+				  				  <li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+				  				  <li class="row-list nofloat">发票抬头:个人</li>`
+				  			  }else{
+				  				  applyHtml  += `
+				  				  <li class="row-list nofloat">申请时间:-</li>
+				  				  <li class="row-list nofloat">申请状态:发票开具</li>
+				  				  <li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+				  				  <li class="row-list nofloat">发票抬头:单位</li>
+				  				  <li class="row-list nofloat">单位名称:${applybill_company}</li>
+				  				  <li class="row-list nofloat">纳税人识别号:${applybill_taxnum}</li>
+				  				  `
+				  			  }
+				  			  lineHtml += `<li class="row-list nofloat">开具时间:-</li>
+				  			  			<li class="row-list nofloat">发票:-</li>`
+				  }else{
+				  			  applyHtml  += `<li class="row-list nofloat">申请状态:${applyStatus}</li>
+				  			  <li class="row-list nofloat">发票类型:-</li>
+				  			  <li class="row-list nofloat">发票抬头:-</li>`
+				  			  lineHtml += `<li class="row-list nofloat">开具时间:-</li>
+				  			  				<li class="row-list nofloat">发票:-</li>`
+				  }
+				  	  		  $("#applyHtml").append(applyHtml);
+				  	  		  $("#lineHtml").append(lineHtml);
+		}
+		
+		if(orderStatus === "已支付"){
+			$(".refund").show();
+		}else{
+			if(applyName !== null && applyName !== "" && applyName !== undefined){
+				$("#apply_names").text(applyName);
+				$("#apply_refund_times").text(formatDate(applyTime*1000, true));
+				console.log(applyReason)
+				$("#applyReasons").text(applyReason);
+				$(".refund_success").show();
+				$(".refund_info").show();
+			}
+		}
+		$(".select_refund").on("click", function(){
+			if(applyReason === ""){
+				alert("申请原因不能为空!")
+				return
+			}
+			$(".isrefund").show();
+		});
+		
+		$(".btn-save").on("click", function(){
+			var applyName = $("#apply_name").text();
+			var applyTime = new Date().getTime().toString().substr(0,10);
+			var applyReason = $("#applyReason").val();
+			var param = {
+				"applyName": applyName,
+				"applyTime": applyTime,
+				"applyReason": applyReason
+			}
+			console.log(param);
+			var url = "/manage/refund/"+ {{.T.res.order_code}};
+			$.post(url,param,function(r){
+				if(r.success){
+					location.reload();
+				}
+			})
+		})
+		
+		$("#select_quxiao").on("click", function(){
+			$(".isrefund").hide();
+		})
+		
+		function formatDate(date,hms) {
+			if(date ===null || date==="" || date === 0){
+				return "-"
+			}
+		    var date = new Date(date);
+		    var YY = date.getFullYear() + '-';
+		    var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
+		    var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
+		    var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
+		    var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
+		    var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
+			if(!hms){
+				return YY + MM + DD + " " + hh + mm + ss
+			}else{
+				return YY + MM + DD
+			}
+		}
+		
     </script>
 	</body>
 </html>

+ 258 - 53
core/src/web/templates/manage/entniche_order/entorderdetail.html

@@ -65,7 +65,7 @@
     width: calc(100% - 220px);
     border: 1px solid #ddd;
     min-height: 658px;
-    background-color: #fff;
+    /* background-color: #fff; */
 }
 
 /*--------------------------------------------------------*/
@@ -101,16 +101,20 @@
 			{{include "/manage/slider.html"}}</div>
 			<div class="right" style="color:#4e5051">
 				<div class="title">
-					<h4>企业商机管理<div class="orderstatus">{{.T.res.order_status}}</div></h4>
+					<span></span>订单详情 <span></span>
 				</div>
+				<div class="order_status">{{.T.res.order_status}}</div>
+				<button class="refund" style="display: none;">退款</button>
+				<button type="button" class="refund_success" style="display: none;">已退款</button>
+				<a class="refund_info" style="display: none;">退款信息</a>
 				<script>
 					var order_status={{.T.res.order_status}};
 					if (order_status=="已取消"){
-						$(".orderstatus").css("color","orange")
+						$(".order_status").css("color","#686868")
 					}else if (order_status=="已支付"){
-						$(".orderstatus").css("color","green")
+						$(".order_status").css("color","green")
 					}else if (order_status=="未支付") {
-						$(".orderstatus").css("color","red")
+						$(".order_status").css("color","red")
 					}
 				</script>
 				
@@ -122,9 +126,6 @@
 							<li class="row-list nofloat">企业信息:{{.T.filterData.entname}}</li>
 							<li class="row-list nofloat">管理员:{{.T.filterData.adminname}}</li>
 							<li class="row-list nofloat">使用产品人数:{{.T.filterData.personnum}}人</li>
-						</ul>
-						<div class="line"></div>
-						<ul class="row third"  style="margin-top:20px  !important;padding-right: 0px; margin-left:20px ">	
 							<li class="row-list nofloat">行业:{{.T.filterData.industry}}</li>
 							<li class="row-list nofloat">手机号:{{.T.filterData.phone}}</li>
 							<li class="row-list nofloat">使用周期:{{.T.filterData.cycle}}年</li>
@@ -138,71 +139,78 @@
 					<div class="bd clearfix" style="padding-right: 65px;">
 						<ul class="row first"  style="margin-top:20px  !important;">
 							<li class="row-list nofloat">订单编号:{{.T.res.order_code}}</li>
-							<li class="row-list nofloat">下单时间:{{.T.res.create_time}}</li>
 							{{if eq .T.res.order_status "已支付"}}
+							<li class="row-list nofloat">支付方式:{{.T.res.pay_way}}</li>
+							<li class="row-list nofloat">下单时间:{{.T.res.create_time}}</li>
 							<li class="row-list nofloat">支付时间:{{.T.res.pay_time}}</li>
 							{{else}}
+							<li class="row-list nofloat">支付方式:-</li>
+							<li class="row-list nofloat">下单时间:{{.T.res.create_time}}</li>
 							<li class="row-list nofloat">支付时间:-</li>
 							{{end}}
 						</ul>
 						<div class="line"></div>
 						<ul class="row third"  style="margin-top:20px  !important;padding-right: 0px; margin-left:20px ">	
-							<li class="row-list nofloat">支付金额:{{.T.res.order_money}}元</li>
-							<li class="row-list nofloat">支付方式:{{.T.res.pay_way}}</li>
 							<li class="row-list nofloat">支付单号:{{.T.transaction_id}}</li>
+							<li class="row-list nofloat">产品类型:{{.T.res.product_type}}</li>
+							<li class="row-list nofloat">实付金额:{{.T.res.order_money}}元</li>
 						</ul>
 					</div>
 				</div>
-				<script>
-				console.log({{.T.res.applybill_type}})
-				</script>
-				<!-- 筛选条件 -->
-				<div class="payinfo order_info">
+				
+				<div class="invoice">
 					<div class="hd">发票信息</div>
-					<div class="bd clearfix" style="padding-right: 65px;">
-						<ul class="row first"  style="margin-top:20px  !important;">
-							<li class="row-list nofloat">发票状态:{{.T.res.applybill_status}}</li>
-							{{if eq .T.res.applybill_status "已申请"}}
-							<li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
-							{{else}}
-							<li class="row-list nofloat">发票类型:-</li>
-							{{end}}
-							{{if eq .T.res.order_status "未支付"}}
-							<li class="row-list nofloat">发票抬头:-</li>
-							{{else}}
-							{{if eq .T.res.applybill_status "未申请"}}
-							<li class="row-list nofloat">发票抬头:-</li>
-							{{else}}
-							<li class="row-list nofloat" >发票抬头:{{.T.res.applybill_type}}</li>
-							{{end}}
-							{{end}}
-							{{if .T.res.applybill_type}}
-							{{if eq .T.res.applybill_type "个人"}}
-							<li class="row-list nofloat" style="display:none">开票单位名称:{{.T.res.applybill_company}}</li>
-							{{else}}
-							{{if eq .T.res.order_status "已支付"}}<li class="row-list nofloat">开票单位名称:{{.T.res.applybill_company}}</li>{{end}}
-							{{end}}
-							{{end}}
+					<div class="bd clearfix" id="applyHtmls">
+						<ul class="row first" id="applyHtml">
+							
 						</ul>
-						<div class="line"></div>
-						<ul class="row third"  style="margin-top:20px  !important;padding-right: 0px; margin-left:20px ">	
-							{{if eq .T.res.applybill_status "已申请"}}
-							<li class="row-list nofloat">发票内容:明细</li>
-							{{else}}
-							<li class="row-list nofloat">发票内容:-</li>
-							{{end}}
-							<li class="row-list nofloat"> &nbsp</li>
-							{{if eq .T.res.applybill_type "个人"}}
-							<li class="row-list nofloat" style="display:none">纳税人识别号:{{.T.res.applybill_taxnum}}</li>
-							{{else}}
-							{{if eq .T.res.applybill_type "-"}}<li class="row-list nofloat" style="display:none">纳税人识别号:{{.T.res.applybill_taxnum}}</li>{{else}}<li class="row-list nofloat">纳税人识别号:{{.T.res.applybill_taxnum}}</li>{{end}}
-							{{end}}
+						<div class="line" style="margin-left: 20px;"></div>
+						<ul class="row second" id="lineHtml" style="margin-top:20px  !important;">
+							
 						</ul>
 					</div>
 				</div>
+				
+				<div class="right-two" style="display: none;" >
+					<div class="apply_refund">申请退款</div>
+					<div class="heng"></div>
+					<div class="apply_info">
+						<div class="apply apply_name">申请退款人员:</div>
+						<div class="apply apply_time">申请时间:</div>
+						<div class="apply apply_reason">申请原因:</div>
+					</div>
+					<div class="apply_infos">
+						<div class="applys apply_names" id="apply_name">{{session "loginName"}}</div>
+						<div class="applys apply_times" id="apply_refund_time"></div>
+						<textarea class="applys apply_reasons" placeholder="请输入申请原因" id="applyReason"></textarea>
+					</div>
+					<button type="button" class="select_refund">确定退款</button>
+					<button type="button" class="select_qx">取消</button>
+				</div>
+				<div class="right-three" style="display: none;" >
+					<div class="apply_refund">退款信息</div>
+					<div class="heng"></div>
+					<div class="apply_info">
+						<div class="apply apply_name">申请退款人员:</div>
+						<div class="apply apply_time">申请时间:</div>
+						<div class="apply apply_reason">申请原因:</div>
+					</div>
+					<div class="apply_infos">
+						<div class="applys apply_names" id="apply_names"></div>
+						<div class="applys apply_times" id="apply_refund_times"></div>
+						<div class="applys" style="margin-top: 23px;width: 680px;height: 269px;" id="applyReasons"></div>
+					</div>
+				</div>
 
 			</div>
 		</div>
+		<div class="isrefund" style="display: none;">
+			<div class="ts">提示</div>
+			<div class="isre">确定退款?</div>
+			<button type="button" id="select_quxiao">取消</button>
+			<button type="button" class="btn-save">确定退款</button>
+		</div>
+		
 		{{include "/common/bottom.html"}}
     <script>
       function view(obj){
@@ -235,6 +243,203 @@
   	    image.src = src;		
   	    return [image.width+10,image.height+10];
       }
+	  
+	  $(".refund").on("click", function(){
+	  	$(".right").children().hide();
+	  	$(".right-two").show();
+	  })
+	  
+	  $(".refund_info").on("click", function(){
+	  	$(".right").children().hide();
+	  	$(".right-three").show();
+	  })
+	  
+	  $("#apply_refund_time").text(formatDate(new Date().getTime(), true))
+	  var invoice = {{.T.res.invoice}};
+	  var applyStatus = {{.T.res.applybill_status}};
+	  var orderStatus = {{.T.res.order_status}};
+	  var applyHtml = "";
+	  var lineHtml = "";
+	  console.log({{.T.res}})
+	  var applyName = {{.T.res.apply_refund_name}}
+	  var applyTime = {{.T.res.apply_refund_time}}
+	  var applyReason = {{.T.res.apply_refund_reason}}
+	  var applybill_type = {{.T.res.applybill_type}};
+	  var applybill_company = {{.T.res.applybill_company}};
+	  var applybill_taxnum = {{.T.res.applybill_taxnum}};
+	  if(invoice !== null){
+	  		  var applyType = invoice[0].invoice_type;
+	  		  var taxpayer_identnum = invoice[0].taxpayer_identnum
+	  		  var create_time = invoice[0].create_time
+	  		  var create_times = formatDate(create_time *1000)
+	  		  var billing_time = invoice[0].billing_time
+	  		  var company_name = invoice[0].company_name
+	  		  
+	  		  if(orderStatus === "未支付"){
+	  		  	applyHtml  += `<li class="row-list nofloat">发票类型:-</li>
+	  		  	<li class="row-list nofloat">发票抬头:-</li>`
+	  		  	lineHtml += `<li class="row-list nofloat">开具时间:-</li>
+	  		  					<li class="row-list nofloat">发票:-</li>`
+	  		  }else{
+	  		  	if(applyStatus === "已申请"){
+	  		  		lineHtml += `<li class="row-list nofloat">开具时间:${formatDate(invoice[0].billing_time *1000)}</li>
+	  		  					<li class="row-list nofloat">发票:<a target="_blank" href="${invoice[0].url}">查看详情</a></li>`
+	  		  		if(applyType === "个人"){
+	  		  			
+	  		  			applyHtml  += `
+	  		  			<li class="row-list nofloat">申请时间:${create_times}</li>
+	  		  			<li class="row-list nofloat">申请状态:发票开具</li>
+	  		  			<li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+	  		  			<li class="row-list nofloat">发票抬头:个人</li>`
+	  		  		}else{
+	  		  			applyHtml  += `
+	  		  			<li class="row-list nofloat">申请时间:${create_times}</li>
+	  		  			<li class="row-list nofloat">申请状态:发票开具</li>
+	  		  			<li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+	  		  			<li class="row-list nofloat">发票抬头:单位</li>
+	  		  			<li class="row-list nofloat">单位名称:${company_name}</li>
+	  		  			<li class="row-list nofloat">纳税人识别号:${taxpayer_identnum}</li>
+	  		  			`
+	  		  		}
+	  		  	}else{
+	  		  		applyHtml  += `<li class="row-list nofloat">申请状态:${applyStatus}</li>
+	  		  		<li class="row-list nofloat">发票类型:-</li>
+	  		  		<li class="row-list nofloat">发票抬头:-</li>`
+	  		  		lineHtml += `<li class="row-list nofloat">开具时间:-</li>
+	  		  						<li class="row-list nofloat">发票:-</li>`
+	  		  	}
+	  		  }
+	  		  //
+	  		  $("#applyHtml").append(applyHtml);
+	  		  $("#lineHtml").append(lineHtml);
+	  		  if(invoice.length == 2){
+	  		  	var applyHtmls = "";
+	  		  	if(invoice[1].invoice_type === "个人"){
+	  		  		applyHtmls  += `
+	  		  		<div class="bd clearfix">
+	  		  			<ul class="row first">
+	  		  				<li class="row-list nofloat">申请时间:${formatDate(invoice[1].create_time *1000)}</li>
+	  		  				<li class="row-list nofloat">申请状态:发票开具</li>
+	  		  				<li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+	  		  				<li class="row-list nofloat">发票抬头:个人</li>
+	  		  			</ul>
+	  		  			<div class="line" style="margin-left: 20px;float: left;width: 1px;height: 155px;background: #ddd;margin-top: 20px;"></div>
+	  		  			<ul class="row second"  style="margin-top:20px  !important;">
+	  		  				<li class="row-list nofloat">开具时间:${formatDate(invoice[1].billing_time *1000)}</li>
+	  		  				<li class="row-list nofloat">发票:<a target="_blank" href="${invoice[1].url}">查看详情</a></li>
+	  		  			</ul>
+	  		  		</div>`
+	  		  	}else{
+	  		  		applyHtmls  += `
+	  		  		<div class="bd clearfix">
+	  		  			<ul class="row first">
+	  		  				<li class="row-list nofloat">申请时间:${formatDate(invoice[1].create_time *1000)}</li>
+	  		  				<li class="row-list nofloat">申请状态:发票开具</li>
+	  		  				<li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+	  		  				<li class="row-list nofloat">发票抬头:单位</li>
+	  		  				<li class="row-list nofloat">单位名称:${invoice[1].company_name}</li>
+	  		  				<li class="row-list nofloat">纳税人识别号:${invoice[1].taxpayer_identnum}</li>
+	  		  			</ul>
+	  		  			<div class="line" style="margin-left: 20px;float: left;width: 1px;height: 155px;background: #ddd;margin-top: 20px;"></div>
+	  		  			<ul class="row second"  style="margin-top:20px  !important;">
+	  		  				<li class="row-list nofloat">开具时间:${formatDate(invoice[1].billing_time *1000)}</li>
+	  		  				<li class="row-list nofloat">发票:<a target="_blank" href="${invoice[1].url}">查看详情</a></li>
+	  		  			</ul>
+	  		  		</div>`
+	  		  	}
+	  		  	$(".invoice").append(applyHtmls);
+	  		  }
+	  }else{
+	  		  
+	  		  if(applyStatus === "已申请"){
+	  		  			  if(applybill_type === "个人"){
+	  		  				  applyHtml  += `
+	  		  				  <li class="row-list nofloat">申请时间:-</li>
+	  		  				  <li class="row-list nofloat">申请状态:发票开具</li>
+	  		  				  <li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+	  		  				  <li class="row-list nofloat">发票抬头:个人</li>`
+	  		  			  }else{
+	  		  				  applyHtml  += `
+	  		  				  <li class="row-list nofloat">申请时间:-</li>
+	  		  				  <li class="row-list nofloat">申请状态:发票开具</li>
+	  		  				  <li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+	  		  				  <li class="row-list nofloat">发票抬头:单位</li>
+	  		  				  <li class="row-list nofloat">单位名称:${applybill_company}</li>
+	  		  				  <li class="row-list nofloat">纳税人识别号:${applybill_taxnum}</li>
+	  		  				  `
+	  		  			  }
+	  		  			  lineHtml += `<li class="row-list nofloat">开具时间:-</li>
+	  		  			  			<li class="row-list nofloat">发票:-</li>`
+	  		  }else{
+	  		  			  applyHtml  += `<li class="row-list nofloat">申请状态:${applyStatus}</li>
+	  		  			  <li class="row-list nofloat">发票类型:-</li>
+	  		  			  <li class="row-list nofloat">发票抬头:-</li>`
+	  		  			  lineHtml += `<li class="row-list nofloat">开具时间:-</li>
+	  		  			  				<li class="row-list nofloat">发票:-</li>`
+	  		  }
+	  		  	  		  $("#applyHtml").append(applyHtml);
+	  		  	  		  $("#lineHtml").append(lineHtml);
+	  }
+	  
+	  if(orderStatus === "已支付"){
+	  	$(".refund").show();
+	  }else{
+	  	if(applyName !== null && applyName !== "" && applyName !== undefined){
+	  		$("#apply_names").text(applyName);
+	  		$("#apply_refund_times").text(formatDate(applyTime*1000, true));
+	  		console.log(applyReason)
+	  		$("#applyReasons").text(applyReason);
+	  		$(".refund_success").show();
+	  		$(".refund_info").show();
+	  	}
+	  }
+	  $(".select_refund").on("click", function(){
+	  	if(applyReason === ""){
+	  		alert("申请原因不能为空!")
+	  		return
+	  	}
+	  	$(".isrefund").show();
+	  });
+	  
+	  $(".btn-save").on("click", function(){
+	  	var applyName = $("#apply_name").text();
+	  	var applyTime = new Date().getTime().toString().substr(0,10);
+	  	var applyReason = $("#applyReason").val();
+	  	var param = {
+	  		"applyName": applyName,
+	  		"applyTime": applyTime,
+	  		"applyReason": applyReason
+	  	}
+	  	console.log(param);
+	  	var url = "/manage/refund/"+ {{.T.res.order_code}};
+	  	$.post(url,param,function(r){
+	  		if(r.success){
+	  			location.reload();
+	  		}
+	  	})
+	  })
+	  
+	  $("#select_quxiao").on("click", function(){
+	  	$(".isrefund").hide();
+	  })
+	  
+	  function formatDate(date,hms) {
+	  	if(date ===null || date==="" || date === 0){
+	  		return "-"
+	  	}
+	      var date = new Date(date);
+	      var YY = date.getFullYear() + '-';
+	      var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
+	      var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
+	      var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
+	      var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
+	      var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
+	  	if(!hms){
+	  		return YY + MM + DD + " " + hh + mm + ss
+	  	}else{
+	  		return YY + MM + DD
+	  	}
+	  }
     </script>
 	</body>
 </html>

+ 322 - 61
core/src/web/templates/manage/vipOrderDetail.html

@@ -65,7 +65,7 @@
     width: calc(100% - 220px);
     border: 1px solid #ddd;
     min-height: 658px;
-    background-color: #fff;
+    /* background-color: #fff; */
 }
 	</style>
 	<body>
@@ -80,6 +80,78 @@
 					<a class="pbtn" href="/manage/dataExport/toOfflinePayPage/{{.T.res.orderCode}}">已线下支付</a>
           {{end}}
 				</div>
+				<div class="order_status">{{.T.res.order_status}}</div>
+				<button class="refund" style="display: none;">退款</button>
+				<button type="button" class="refund_success" style="display: none;">已退款</button>
+				<a class="refund_info" style="display: none;">退款信息</a>
+				<script>
+					var order_status={{.T.res.order_status}};
+					if (order_status=="已取消"){
+						$(".order_status").css("color","#686868")
+					}else if (order_status=="已支付"){
+						$(".order_status").css("color","green")
+					}else if (order_status=="未支付") {
+						$(".order_status").css("color","red")
+					}
+				</script>
+				
+				<!-- 筛选条件 -->
+				<div class="filter">
+					<div class="hd">订阅条件</div>
+					<div class="bd">
+						<div class="filter_cont">
+							
+							<div class="filter-list clearfix">
+								{{if .T.res.renew}}
+								<label>续费区域:</label>
+								<div>{{.T.filterData.subscription_area}}</div>
+								{{end}}
+								{{if .T.res.upgrade}}
+								<label>升级区域:</label>
+								<div>{{.T.filterData.subscription_area}}</div>
+								{{end}}
+								{{if .T.res.normal}}
+								<label>订购区域:</label>
+								<div>{{.T.filterData.subscription_area}}</div>
+								{{end}}
+							</div>
+							<div class="filter-list clearfix">
+								{{if .T.res.renew}}
+								<label>续费行业:</label>
+								<div>{{.T.filterData.industry_str}}</div>
+								{{end}}
+								{{if .T.res.upgrade}}
+								<label>升级行业:</label>
+								<div>{{.T.filterData.industry_str}}</div>
+								{{end}}
+								{{if .T.res.normal}}
+								<label>订购行业:</label>
+								<div>{{.T.filterData.industry_str}}</div>
+								{{end}}
+							</div>
+							<div class="filter-list clearfix">
+								{{if .T.res.renew}}
+								<label>续费周期:</label>
+								<div>{{.T.filterData.subscription_cycle}}</div>
+								{{end}}
+								{{if .T.res.upgrade}}
+								<label>升级周期:</label>
+								<div>{{.T.filterData.subscription_cycle}}</div>
+								{{end}}
+								{{if .T.res.normal}}
+								<label>订购周期:</label>
+								<div>{{.T.filterData.subscription_cycle}}</div>
+								{{end}}
+							</div>
+							
+							<div class="filter-list clearfix">
+								<label>有效日期:</label>
+							{{if .T.filterData.effective_date}}	<div>{{.T.filterData.effective_date}}</div>{{end}}
+							</div>
+							
+						</div>
+					</div>
+				</div>
 				
 				<!-- 订单信息 -->
 				<div class="order_info" >
@@ -87,13 +159,13 @@
 					<div class="bd clearfix" style="padding-right: 65px;">
 						<ul class="row first"  style="margin-top:20px  !important;">
 							<li class="row-list nofloat">订单编号:{{.T.res.order_code}}</li>
-							<li class="row-list nofloat">下单时间:{{.T.res.create_time}}</li>
-							<li class="row-list nofloat">支付状态:{{.T.res.order_status}}</li>
 							{{if .T.res.pay_way}}{{if eq .T.res.pay_way "trial"}}<li class="row-list nofloat">支付方式:-</li>{{else}}{{if eq .T.res.order_status "已支付"}}<li class="row-list nofloat">支付方式:{{.T.res.pay_way}}</li>{{else}}<li class="row-list nofloat">支付方式:-{{end}}{{end}}{{end}}
 							{{if .T.res.order_status}}
 							{{if eq .T.res.order_status "已支付"}}
+							<li class="row-list nofloat">下单时间:{{.T.res.create_time}}</li>
 							<li class="row-list nofloat">支付时间:{{.T.res.pay_time}}</li>
 							{{else}}
+							<li class="row-list nofloat">下单时间:{{.T.res.create_time}}</li>
 							<li class="row-list nofloat">支付时间:-</li>
 							{{end}}
 							{{end}}
@@ -106,21 +178,21 @@
 						{{if .T.res.order_status}}
 							{{if eq .T.res.order_status "已支付"}}
 						 {{if .T.transaction_id}}
-							 	<li class="row-list nofloat">{{.T.res.pay_way}}支付单号:{{.T.transaction_id}}</li>
+							 	<li class="row-list nofloat">支付单号:{{.T.transaction_id}}</li>
                 		 {{end}}
 						{{else}}
 						{{if .T.res.pay_way}}{{if eq .T.res.pay_way "trial"}}<li class="row-list nofloat">支付单号:-</li>{{else}}<li class="row-list nofloat">支付单号:-</li>{{end}}{{end}}
 						{{end}}
 						{{end}}
 							<li class="row-list nofloat">产品类型:{{.T.res.product_type}}</li>
-							<li class="row-list nofloat">产品价格:{{.T.res.order_money}}元</li>
+							<li class="row-list nofloat">实付金额:{{.T.res.order_money}}元</li>
 							{{if .T.res.user_mail}}
 							<li class="row-list nofloat">邮箱地址:{{.T.res.user_mail}}</li>
 							{{else}}
 							<li class="row-list nofloat">邮箱地址:-</li>
 							{{end}}
 						</ul>
-						<div class="line"></div>
+						<!-- <div class="line"></div>
 						<ul class="row third"  style="margin-top:20px  !important;padding-right: 0px;">	
 							{{if .T.res.order_status}}
 							{{if eq .T.res.order_status "未支付"}}
@@ -152,71 +224,63 @@
 							{{end}}
 							{{end}}
 							{{end}}
-						</ul>
+						</ul> -->
 					</div>
 				</div>
-
 				
-				<!-- 筛选条件 -->
-				<div class="filter">
-					<div class="hd">订阅条件</div>
-					<div class="bd">
-						<div class="filter_cont">
+				<div class="invoice">
+					<div class="hd">发票信息</div>
+					<div class="bd clearfix" id="applyHtmls">
+						<ul class="row first" id="applyHtml">
 							
-							<div class="filter-list clearfix">
-								{{if .T.res.renew}}
-								<label>续费区域:</label>
-								<div>{{.T.filterData.subscription_area}}</div>
-								{{end}}
-								{{if .T.res.upgrade}}
-								<label>升级区域:</label>
-								<div>{{.T.filterData.subscription_area}}</div>
-								{{end}}
-								{{if .T.res.normal}}
-								<label>订购区域:</label>
-								<div>{{.T.filterData.subscription_area}}</div>
-								{{end}}
-							</div>
-							<div class="filter-list clearfix">
-								{{if .T.res.renew}}
-								<label>续费行业:</label>
-								<div>{{.T.filterData.industry_str}}</div>
-								{{end}}
-								{{if .T.res.upgrade}}
-								<label>升级行业:</label>
-								<div>{{.T.filterData.industry_str}}</div>
-								{{end}}
-								{{if .T.res.normal}}
-								<label>订购行业:</label>
-								<div>{{.T.filterData.industry_str}}</div>
-								{{end}}
-							</div>
-							<div class="filter-list clearfix">
-								{{if .T.res.renew}}
-								<label>续费周期:</label>
-								<div>{{.T.filterData.subscription_cycle}}</div>
-								{{end}}
-								{{if .T.res.upgrade}}
-								<label>升级周期:</label>
-								<div>{{.T.filterData.subscription_cycle}}</div>
-								{{end}}
-								{{if .T.res.normal}}
-								<label>订购周期:</label>
-								<div>{{.T.filterData.subscription_cycle}}</div>
-								{{end}}
-							</div>
-							
-							<div class="filter-list clearfix">
-								<label>有效日期:</label>
-							{{if .T.filterData.effective_date}}	<div>{{.T.filterData.effective_date}}</div>{{end}}
-							</div>
+						</ul>
+						<div class="line" style="margin-left: 20px;"></div>
+						<ul class="row second" id="lineHtml" style="margin-top:20px  !important;">
 							
-						</div>
+						</ul>
+					</div>
+				</div>
+				
+				<div class="right-two" style="display: none;" >
+					<div class="apply_refund">申请退款</div>
+					<div class="heng"></div>
+					<div class="apply_info">
+						<div class="apply apply_name">申请退款人员:</div>
+						<div class="apply apply_time">申请时间:</div>
+						<div class="apply apply_reason">申请原因:</div>
+					</div>
+					<div class="apply_infos">
+						<div class="applys apply_names" id="apply_name">{{session "loginName"}}</div>
+						<div class="applys apply_times" id="apply_refund_time"></div>
+						<textarea class="applys apply_reasons" placeholder="请输入申请原因" id="applyReason"></textarea>
+					</div>
+					<button type="button" class="select_refund">确定退款</button>
+					<button type="button" class="select_qx">取消</button>
+				</div>
+				<div class="right-three" style="display: none;" >
+					<div class="apply_refund">退款信息</div>
+					<div class="heng"></div>
+					<div class="apply_info">
+						<div class="apply apply_name">申请退款人员:</div>
+						<div class="apply apply_time">申请时间:</div>
+						<div class="apply apply_reason">申请原因:</div>
+					</div>
+					<div class="apply_infos">
+						<div class="applys apply_names" id="apply_names"></div>
+						<div class="applys apply_times" id="apply_refund_times"></div>
+						<div class="applys" style="margin-top: 23px;width: 680px;height: 269px;" id="applyReasons"></div>
 					</div>
 				</div>
 
 			</div>
 		</div>
+		<div class="isrefund" style="display: none;">
+			<div class="ts">提示</div>
+			<div class="isre">确定退款?</div>
+			<button type="button" id="select_quxiao">取消</button>
+			<button type="button" class="btn-save">确定退款</button>
+		</div>
+		
 		{{include "/common/bottom.html"}}
     <script>
       function view(obj){
@@ -249,6 +313,203 @@
   	    image.src = src;		
   	    return [image.width+10,image.height+10];
       }
+	  
+	  $(".refund").on("click", function(){
+	  	$(".right").children().hide();
+	  	$(".right-two").show();
+	  })
+	  
+	  $(".refund_info").on("click", function(){
+	  	$(".right").children().hide();
+	  	$(".right-three").show();
+	  })
+	  
+	  $("#apply_refund_time").text(formatDate(new Date().getTime(), true))
+	  var invoice = {{.T.res.invoice}};
+	  var applyStatus = {{.T.res.applybill_status}};
+	  var orderStatus = {{.T.res.order_status}};
+	  var applyHtml = "";
+	  var lineHtml = "";
+	  console.log({{.T.res}})
+	  var applyName = {{.T.res.apply_refund_name}}
+	  var applyTime = {{.T.res.apply_refund_time}}
+	  var applyReason = {{.T.res.apply_refund_reason}}
+	  var applybill_type = {{.T.res.applybill_type}};
+	  var applybill_company = {{.T.res.applybill_company}};
+	  var applybill_taxnum = {{.T.res.applybill_taxnum}};
+	  if(invoice !== null){
+	  		  var applyType = invoice[0].invoice_type;
+	  		  var taxpayer_identnum = invoice[0].taxpayer_identnum
+	  		  var create_time = invoice[0].create_time
+	  		  var create_times = formatDate(create_time *1000)
+	  		  var billing_time = invoice[0].billing_time
+	  		  var company_name = invoice[0].company_name
+	  		  
+	  		  if(orderStatus === "未支付"){
+	  		  	applyHtml  += `<li class="row-list nofloat">发票类型:-</li>
+	  		  	<li class="row-list nofloat">发票抬头:-</li>`
+	  		  	lineHtml += `<li class="row-list nofloat">开具时间:-</li>
+	  		  					<li class="row-list nofloat">发票:-</li>`
+	  		  }else{
+	  		  	if(applyStatus === "已申请"){
+	  		  		lineHtml += `<li class="row-list nofloat">开具时间:${formatDate(invoice[0].billing_time *1000)}</li>
+	  		  					<li class="row-list nofloat">发票:<a target="_blank" href="${invoice[0].url}">查看详情</a></li>`
+	  		  		if(applyType === "个人"){
+	  		  			
+	  		  			applyHtml  += `
+	  		  			<li class="row-list nofloat">申请时间:${create_times}</li>
+	  		  			<li class="row-list nofloat">申请状态:发票开具</li>
+	  		  			<li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+	  		  			<li class="row-list nofloat">发票抬头:个人</li>`
+	  		  		}else{
+	  		  			applyHtml  += `
+	  		  			<li class="row-list nofloat">申请时间:${create_times}</li>
+	  		  			<li class="row-list nofloat">申请状态:发票开具</li>
+	  		  			<li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+	  		  			<li class="row-list nofloat">发票抬头:单位</li>
+	  		  			<li class="row-list nofloat">单位名称:${company_name}</li>
+	  		  			<li class="row-list nofloat">纳税人识别号:${taxpayer_identnum}</li>
+	  		  			`
+	  		  		}
+	  		  	}else{
+	  		  		applyHtml  += `<li class="row-list nofloat">申请状态:${applyStatus}</li>
+	  		  		<li class="row-list nofloat">发票类型:-</li>
+	  		  		<li class="row-list nofloat">发票抬头:-</li>`
+	  		  		lineHtml += `<li class="row-list nofloat">开具时间:-</li>
+	  		  						<li class="row-list nofloat">发票:-</li>`
+	  		  	}
+	  		  }
+	  		  //
+	  		  $("#applyHtml").append(applyHtml);
+	  		  $("#lineHtml").append(lineHtml);
+	  		  if(invoice.length == 2){
+	  		  	var applyHtmls = "";
+	  		  	if(invoice[1].invoice_type === "个人"){
+	  		  		applyHtmls  += `
+	  		  		<div class="bd clearfix">
+	  		  			<ul class="row first">
+	  		  				<li class="row-list nofloat">申请时间:${formatDate(invoice[1].create_time *1000)}</li>
+	  		  				<li class="row-list nofloat">申请状态:发票开具</li>
+	  		  				<li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+	  		  				<li class="row-list nofloat">发票抬头:个人</li>
+	  		  			</ul>
+	  		  			<div class="line" style="margin-left: 20px;float: left;width: 1px;height: 155px;background: #ddd;margin-top: 20px;"></div>
+	  		  			<ul class="row second"  style="margin-top:20px  !important;">
+	  		  				<li class="row-list nofloat">开具时间:${formatDate(invoice[1].billing_time *1000)}</li>
+	  		  				<li class="row-list nofloat">发票:<a target="_blank" href="${invoice[1].url}">查看详情</a></li>
+	  		  			</ul>
+	  		  		</div>`
+	  		  	}else{
+	  		  		applyHtmls  += `
+	  		  		<div class="bd clearfix">
+	  		  			<ul class="row first">
+	  		  				<li class="row-list nofloat">申请时间:${formatDate(invoice[1].create_time *1000)}</li>
+	  		  				<li class="row-list nofloat">申请状态:发票开具</li>
+	  		  				<li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+	  		  				<li class="row-list nofloat">发票抬头:单位</li>
+	  		  				<li class="row-list nofloat">单位名称:${invoice[1].company_name}</li>
+	  		  				<li class="row-list nofloat">纳税人识别号:${invoice[1].taxpayer_identnum}</li>
+	  		  			</ul>
+	  		  			<div class="line" style="margin-left: 20px;float: left;width: 1px;height: 155px;background: #ddd;margin-top: 20px;"></div>
+	  		  			<ul class="row second"  style="margin-top:20px  !important;">
+	  		  				<li class="row-list nofloat">开具时间:${formatDate(invoice[1].billing_time *1000)}</li>
+	  		  				<li class="row-list nofloat">发票:<a target="_blank" href="${invoice[1].url}">查看详情</a></li>
+	  		  			</ul>
+	  		  		</div>`
+	  		  	}
+	  		  	$(".invoice").append(applyHtmls);
+	  		  }
+	  }else{
+	  		  
+	  		  if(applyStatus === "已申请"){
+	  		  			  if(applybill_type === "个人"){
+	  		  				  applyHtml  += `
+	  		  				  <li class="row-list nofloat">申请时间:-</li>
+	  		  				  <li class="row-list nofloat">申请状态:发票开具</li>
+	  		  				  <li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+	  		  				  <li class="row-list nofloat">发票抬头:个人</li>`
+	  		  			  }else{
+	  		  				  applyHtml  += `
+	  		  				  <li class="row-list nofloat">申请时间:-</li>
+	  		  				  <li class="row-list nofloat">申请状态:发票开具</li>
+	  		  				  <li class="row-list nofloat">发票类型:普通发票(电子发票)</li>
+	  		  				  <li class="row-list nofloat">发票抬头:单位</li>
+	  		  				  <li class="row-list nofloat">单位名称:${applybill_company}</li>
+	  		  				  <li class="row-list nofloat">纳税人识别号:${applybill_taxnum}</li>
+	  		  				  `
+	  		  			  }
+	  		  			  lineHtml += `<li class="row-list nofloat">开具时间:-</li>
+	  		  			  			<li class="row-list nofloat">发票:-</li>`
+	  		  }else{
+	  		  			  applyHtml  += `<li class="row-list nofloat">申请状态:${applyStatus}</li>
+	  		  			  <li class="row-list nofloat">发票类型:-</li>
+	  		  			  <li class="row-list nofloat">发票抬头:-</li>`
+	  		  			  lineHtml += `<li class="row-list nofloat">开具时间:-</li>
+	  		  			  				<li class="row-list nofloat">发票:-</li>`
+	  		  }
+	  		  	  		  $("#applyHtml").append(applyHtml);
+	  		  	  		  $("#lineHtml").append(lineHtml);
+	  }
+	  
+	  if(orderStatus === "已支付"){
+	  	$(".refund").show();
+	  }else{
+	  	if(applyName !== null && applyName !== "" && applyName !== undefined){
+	  		$("#apply_names").text(applyName);
+	  		$("#apply_refund_times").text(formatDate(applyTime*1000, true));
+	  		console.log(applyReason)
+	  		$("#applyReasons").text(applyReason);
+	  		$(".refund_success").show();
+	  		$(".refund_info").show();
+	  	}
+	  }
+	  $(".select_refund").on("click", function(){
+	  	if(applyReason === ""){
+	  		alert("申请原因不能为空!")
+	  		return
+	  	}
+	  	$(".isrefund").show();
+	  });
+	  
+	  $(".btn-save").on("click", function(){
+	  	var applyName = $("#apply_name").text();
+	  	var applyTime = new Date().getTime().toString().substr(0,10);
+	  	var applyReason = $("#applyReason").val();
+	  	var param = {
+	  		"applyName": applyName,
+	  		"applyTime": applyTime,
+	  		"applyReason": applyReason
+	  	}
+	  	console.log(param);
+	  	var url = "/manage/refund/"+ {{.T.res.order_code}};
+	  	$.post(url,param,function(r){
+	  		if(r.success){
+	  			location.reload();
+	  		}
+	  	})
+	  })
+	  
+	  $("#select_quxiao").on("click", function(){
+	  	$(".isrefund").hide();
+	  })
+	  
+	  function formatDate(date,hms) {
+	  	if(date ===null || date==="" || date === 0){
+	  		return "-"
+	  	}
+	      var date = new Date(date);
+	      var YY = date.getFullYear() + '-';
+	      var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
+	      var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
+	      var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
+	      var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
+	      var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
+	  	if(!hms){
+	  		return YY + MM + DD + " " + hh + mm + ss
+	  	}else{
+	  		return YY + MM + DD
+	  	}
+	  }
     </script>
 	</body>
 </html>