order.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. package leader
  2. import (
  3. "strings"
  4. "time"
  5. "zhiyuan/pkg/app"
  6. orderParam "zhiyuan/pkg/param/order"
  7. "zhiyuan/pkg/utils"
  8. "zhiyuan/services/admin"
  9. "zhiyuan/services/aftersale"
  10. "zhiyuan/services/aftersale/order"
  11. "zhiyuan/services/form"
  12. "zhiyuan/services/region"
  13. "zhiyuan/services/user"
  14. "github.com/gin-gonic/gin"
  15. )
  16. func OrderList(c *gin.Context) {
  17. page := app.HandlePageNum(c)
  18. where := map[string]string{
  19. "where": " o.deleted_at=0 AND o.leader={{admin_id}}",
  20. "_group_by": "o.id",
  21. "_order_by": "o.id desc",
  22. }
  23. param := make(map[string]interface{})
  24. param["admin_id"] = c.GetInt("adminID")
  25. //where := map[string]interface{}{"leader": c.GetInt("adminID"), "deleted_at": 0, "_orderby": "id desc"}
  26. states := make([]int, 0)
  27. tabIndex := utils.ToInt(c.Query("tab_index"))
  28. switch tabIndex {
  29. case -1:
  30. states = append(states,
  31. orderParam.State.Allotted.ID,
  32. orderParam.State.SupConfirmed.ID,
  33. orderParam.State.Repairing.ID,
  34. )
  35. case 0:
  36. states = append(states, orderParam.State.Allotted.ID)
  37. case 1:
  38. states = append(states,
  39. orderParam.State.Suspending.ID,
  40. orderParam.State.SupConfirmed.ID,
  41. orderParam.State.Repairing.ID,
  42. orderParam.State.Confirmed.ID,
  43. )
  44. case 2:
  45. states = append(states,
  46. orderParam.State.Repaired.ID,
  47. orderParam.State.Completed.ID,
  48. orderParam.State.ForceCompleted.ID,
  49. )
  50. }
  51. if tabIndex >= -1 {
  52. where["where"] = where["where"] + " AND if(o.state=90,90,if(o.is_force=0,o.state,100)) in {{states}}"
  53. param["states"] = states
  54. //where["if(state=90,90,if(is_force=0,state,100)) in"] = states
  55. }
  56. dayDate := utils.GetZeroTime(time.Now()).Unix()
  57. listType := utils.ToInt(c.Query("list_type"))
  58. if listType == 1 {
  59. where["where"] = where["where"] + " AND (o.created_at between {{mindate}} and {{maxdate}})"
  60. param["mindate"] = dayDate
  61. param["maxdate"] = dayDate + 86399
  62. //where["created_at between"] = []interface{}{dayDate, dayDate + 86399}
  63. } else if listType == 2 {
  64. where["where"] = where["where"] + " AND (v.visit_time between {{mindate}} and {{maxdate}}) AND v.state=1"
  65. param["mindate"] = dayDate
  66. param["maxdate"] = dayDate + 86399
  67. //where["recent_visit_time between"] = []interface{}{dayDate, dayDate + 86399}
  68. }
  69. keyword := c.Query("keyword")
  70. if keyword != "" {
  71. where["where"] = where["where"] + " AND (o.link_name like {{keyword}} or o.link_phone like {{keyword}})"
  72. param["keyword"] = "%" + keyword + "%"
  73. /*where["_or"] = []map[string]interface{}{
  74. {"link_name like": "%" + keyword + "%"},
  75. {"link_phone like": "%" + keyword + "%"},
  76. }*/
  77. }
  78. type Auth struct {
  79. SupConfirm bool `json:"sup_confirm"`
  80. Repairing bool `json:"repairing"`
  81. Repaired bool `json:"repaired"`
  82. Feedback bool `json:"feedback"`
  83. Confirm bool `json:"confirm"`
  84. }
  85. type OrderList struct {
  86. ID int `json:"id"`
  87. OrderNo string `json:"order_no"`
  88. MainType int `json:"main_type"`
  89. SubType int `json:"sub_type"`
  90. Type string `json:"type"`
  91. LinkName string `json:"link_name"`
  92. LinkPhone string `json:"link_phone"`
  93. Address string `json:"address"`
  94. Content string `json:"content"`
  95. Pics []string `json:"pics"`
  96. RepairID int `json:"repair_id"`
  97. State int `json:"state"`
  98. StateName string `json:"state_name"`
  99. StateColor string `json:"state_color"`
  100. Auth Auth `json:"auth"`
  101. HouseID int `json:"house_id"`
  102. Supervisor string `json:"supervisor"`
  103. CreatedAt string `json:"created_at"`
  104. WarrantyStart string `json:"warranty_start"`
  105. WarrantyEnd string `json:"warranty_end"`
  106. WarrantyPeriod string `json:"warranty_period"`
  107. IsForce int `json:"is_force"`
  108. }
  109. orderList := make([]OrderList, 0)
  110. //_, err := order.GetList(where, nil, page, &orderList)
  111. err := order.GetListWidthVisit(where, param, page, &orderList)
  112. if err != nil {
  113. app.Error(c, err.Error())
  114. return
  115. }
  116. orderIds := make([]int, 0)
  117. houseIds := make([]int, 0)
  118. for _, v := range orderList {
  119. orderIds = append(orderIds, v.ID)
  120. houseIds = append(houseIds, v.HouseID)
  121. }
  122. adminIds := make([]int, 0)
  123. houseSupervisorMap := make(map[int]int, 0)
  124. if len(houseIds) > 0 {
  125. houseList, _ := user.GetHouseList(map[string]interface{}{"id in": houseIds}, []string{"id", "supervisor"}, app.Page{}, nil)
  126. for _, v := range houseList {
  127. if v.Supervisor > 0 {
  128. adminIds = append(adminIds, v.Supervisor)
  129. }
  130. houseSupervisorMap[v.ID] = v.Supervisor
  131. }
  132. }
  133. adminMap := make(map[int]string, 0)
  134. if len(adminIds) > 0 {
  135. if adminList, err := admin.GetAdmins(map[string]interface{}{"id in": adminIds}, []string{"id, username, phone"}, app.Page{}, nil); err == nil {
  136. for _, v := range adminList {
  137. adminMap[v.ID] = v.Username
  138. }
  139. }
  140. }
  141. // 订单详细信息
  142. type OrderDetailList struct {
  143. OrderID int `json:"order_id"`
  144. Province int `json:"province"`
  145. City int `json:"city"`
  146. Region int `json:"region"`
  147. Address string `json:"address"`
  148. Content string `json:"content"`
  149. Pics string `json:"pics"`
  150. }
  151. orderDetailList := make([]OrderDetailList, 0)
  152. detailMap := make(map[int]OrderDetailList, 0)
  153. regionCodes := make([]int, 0)
  154. if len(orderIds) > 0 {
  155. _, err = order.GetDetailList(map[string]interface{}{"order_id in ": orderIds}, nil, app.Page{}, &orderDetailList)
  156. for _, v := range orderDetailList {
  157. detailMap[v.OrderID] = v
  158. regionCodes = append(regionCodes, v.Region, v.City, v.Province)
  159. }
  160. }
  161. regionMap, err := region.GetNameByCodes(regionCodes)
  162. if err != nil {
  163. app.Error(c, err.Error())
  164. return
  165. }
  166. orderTypeMap := aftersale.GetTypeMapByCache()
  167. orderStatusList := utils.ParseSliceMap(orderParam.Params.State, "id")
  168. for k, v := range orderList {
  169. if detail, ok := detailMap[v.ID]; ok {
  170. v.Content = detail.Content
  171. v.Pics = utils.ParseImgStr(detail.Pics)
  172. v.Address = region.GetFullAddressByCodes(detail.Province, detail.City, detail.Region, detail.Address, "", regionMap)
  173. }
  174. if v.State != orderParam.State.Completed.ID && v.IsForce != 0 {
  175. v.State = orderParam.State.ForceCompleted.ID
  176. }
  177. v.StateName = utils.ToStr(orderStatusList[utils.ToStr(v.State)]["name"])
  178. v.StateColor = utils.ToStr(orderStatusList[utils.ToStr(v.State)]["color"])
  179. v.CreatedAt = utils.DateS(v.CreatedAt, "YYYY-MM-DD")
  180. v.Type = orderTypeMap[v.MainType] + "/" + orderTypeMap[v.SubType]
  181. v.Auth = Auth{
  182. SupConfirm: utils.IsContain(orderParam.Allow.SupConfirm, v.State),
  183. Repairing: utils.IsContain(orderParam.Allow.Repairing, v.State),
  184. Feedback: utils.IsContain(orderParam.Allow.Feedback, v.State),
  185. Repaired: utils.IsContain(orderParam.Allow.Repaired, v.State) && v.RepairID > 0,
  186. }
  187. if supervisor, ok := adminMap[houseSupervisorMap[v.HouseID]]; ok {
  188. v.Supervisor = supervisor
  189. }
  190. if v.WarrantyStart != "0" {
  191. v.WarrantyPeriod = utils.DateS(v.WarrantyStart, "YYYY-MM-DD") + " 至 " + utils.DateS(v.WarrantyEnd, "YYYY-MM-DD")
  192. } else {
  193. v.WarrantyPeriod = "保修期外"
  194. }
  195. orderList[k] = v
  196. }
  197. app.Success(c, orderList)
  198. }
  199. func OrderConfirm(c *gin.Context) {
  200. id := utils.StrTo(c.Param("id")).MustInt()
  201. if id <= 0 {
  202. app.Error(c, "工单 id 有误")
  203. return
  204. }
  205. err := order.SupConfirm(id, c.GetInt("adminID"))
  206. if err != nil {
  207. app.Error(c, err.Error())
  208. return
  209. }
  210. app.Success(c, nil)
  211. }
  212. func OrderFinish(c *gin.Context) {
  213. id := utils.StrTo(c.Param("id")).MustInt()
  214. if id <= 0 {
  215. app.Error(c, "工单 id 有误")
  216. return
  217. }
  218. err := order.Repaired(id, c.GetInt("adminID"))
  219. if err != nil {
  220. app.Error(c, err.Error())
  221. return
  222. }
  223. app.Success(c, nil)
  224. }
  225. func OrderSchedule(c *gin.Context) {
  226. id := utils.StrTo(c.Param("id")).MustInt()
  227. if id <= 0 {
  228. app.Error(c, "工单 id 有误")
  229. return
  230. }
  231. var form form.OrderSchedule
  232. if app.Bind(c, &form) != nil {
  233. return
  234. }
  235. form.Leader = c.GetInt("adminID")
  236. err := order.Schedule(form, id)
  237. if err != nil {
  238. app.Error(c, err.Error())
  239. return
  240. }
  241. app.Success(c, nil)
  242. }
  243. func OrderRepair(c *gin.Context) {
  244. id := utils.StrTo(c.Param("id")).MustInt()
  245. if id <= 0 {
  246. app.Error(c, "工单 id 有误")
  247. return
  248. }
  249. var form form.OrderRepair
  250. if app.Bind(c, &form) != nil {
  251. return
  252. }
  253. form.Leader = c.GetInt("adminID")
  254. err := order.Repair(form, id)
  255. if err != nil {
  256. app.Error(c, err.Error())
  257. return
  258. }
  259. app.Success(c, nil)
  260. }
  261. func OrderRepairInfo(c *gin.Context) {
  262. id := utils.StrTo(c.Param("id")).MustInt()
  263. if id <= 0 {
  264. app.Error(c, "工单 id 有误")
  265. return
  266. }
  267. orderInfo, err := order.GetInfoByID(id, []string{"id", "repair_id"}, nil)
  268. if err != nil {
  269. app.Error(c, err.Error())
  270. return
  271. }
  272. if orderInfo.RepairID == 0 {
  273. app.Success(c, gin.H{"repair_id": 0})
  274. return
  275. }
  276. type RepairInfo struct {
  277. State string `json:"state"`
  278. Duration float64 `json:"duration"`
  279. WorkerName string `json:"worker_name"`
  280. WorkerPhone string `json:"worker_phone"`
  281. Content string `json:"content"`
  282. Pics string `json:"pics"`
  283. PicList []string `json:"pic_list"`
  284. FinishedAt string `json:"finished_at"`
  285. }
  286. var repairInfo *RepairInfo
  287. _, err = order.GetRepairInfoByID(orderInfo.RepairID, nil, &repairInfo)
  288. if err != nil || repairInfo == nil {
  289. app.Error(c, "获取反馈信息失败")
  290. return
  291. }
  292. repairInfo.PicList = strings.Split(repairInfo.Pics, ",")
  293. repairInfo.FinishedAt = utils.DateS(repairInfo.FinishedAt, "YYYY-MM-DD HH:mm")
  294. app.Success(c, gin.H{"repair_id": orderInfo.RepairID, "repair_info": repairInfo})
  295. return
  296. }
  297. func OrderInfo(c *gin.Context) {
  298. id := utils.StrTo(c.Param("id")).MustInt()
  299. if id <= 0 {
  300. app.Error(c, "工单 id 有误")
  301. return
  302. }
  303. type OrderInfo struct {
  304. ID int `json:"id"`
  305. OrderNo string `json:"order_no"`
  306. MainType int `json:"main_type"`
  307. SubType int `json:"sub_type"`
  308. Type string `json:"type"`
  309. LinkName string `json:"link_name"`
  310. LinkPhone string `json:"link_phone"`
  311. Province int `json:"province"`
  312. City int `json:"city"`
  313. Region int `json:"region"`
  314. Address string `json:"address"`
  315. Content string `json:"content"`
  316. Pics string `json:"pics"`
  317. PicList []string `json:"pic_list"`
  318. State int `json:"state"`
  319. HouseID int `json:"house_id"`
  320. Supervisor string `json:"supervisor"`
  321. StateName string `json:"state_name"`
  322. StateColor string `json:"state_color"`
  323. CreatedAt string `json:"created_at"`
  324. WarrantyStart string `json:"warranty_start"`
  325. WarrantyEnd string `json:"warranty_end"`
  326. WarrantyPeriod string `json:"warranty_period"`
  327. MaintenanceRemark string `json:"maintenance_remark"`
  328. StartTime string `json:"start_time"`
  329. EndTime string `json:"end_time"`
  330. FinishTime string `json:"finish_time"`
  331. }
  332. var orderInfo OrderInfo
  333. err := order.GetOneWithDetail("o.id={{id}}", map[string]interface{}{"id": id}, &orderInfo)
  334. if err != nil {
  335. app.Error(c, err.Error())
  336. return
  337. }
  338. if houseInfo, _ := user.GetHouseInfoByID(orderInfo.HouseID, []string{"supervisor"}, nil); houseInfo != nil && houseInfo.Supervisor > 0 {
  339. if adminInfo, _ := admin.GetInfoByID(houseInfo.Supervisor, []string{"username"}, nil); adminInfo != nil {
  340. orderInfo.Supervisor = adminInfo.Username
  341. }
  342. }
  343. orderTypeMap := aftersale.GetTypeMapByCache()
  344. orderStatusList := utils.ParseSliceMap(orderParam.Params.State, "id")
  345. orderInfo.PicList = utils.ParseImgStr(orderInfo.Pics)
  346. orderInfo.Address = region.GetFullAddressByCodes(orderInfo.Province, orderInfo.City, orderInfo.Region, orderInfo.Address, "", nil)
  347. orderInfo.StateName = utils.ToStr(orderStatusList[utils.ToStr(orderInfo.State)]["name"])
  348. orderInfo.StateColor = utils.ToStr(orderStatusList[utils.ToStr(orderInfo.State)]["color"])
  349. orderInfo.CreatedAt = utils.DateS(orderInfo.CreatedAt, "YYYY-MM-DD")
  350. orderInfo.Type = orderTypeMap[orderInfo.MainType] + "/" + orderTypeMap[orderInfo.SubType]
  351. orderInfo.StartTime = utils.DateS(orderInfo.StartTime, "YYYY-MM-DD HH:mm")
  352. orderInfo.EndTime = utils.DateS(orderInfo.EndTime, "YYYY-MM-DD HH:mm")
  353. orderInfo.FinishTime = utils.DateS(orderInfo.FinishTime, "YYYY-MM-DD HH:mm")
  354. if orderInfo.WarrantyStart != "0" {
  355. orderInfo.WarrantyPeriod = utils.DateS(orderInfo.WarrantyStart, "YYYY-MM-DD") + " 至 " + utils.DateS(orderInfo.WarrantyEnd, "YYYY-MM-DD")
  356. } else {
  357. orderInfo.WarrantyPeriod = "保修期外"
  358. }
  359. type OrderEvent struct {
  360. Title string `json:"title"`
  361. Content string `json:"content"`
  362. Pics string `json:"pics"`
  363. PicList []string `json:"pic_list"`
  364. CreatedAt string `json:"created_at"`
  365. }
  366. eventList := make([]*OrderEvent, 0)
  367. _, err = order.GetEventList(map[string]interface{}{"order_id": id, "_orderby": "created_at desc", "event_type": 1}, nil, &eventList)
  368. if err != nil {
  369. app.Error(c, err.Error())
  370. return
  371. }
  372. for k, v := range eventList {
  373. v.CreatedAt = utils.DateS(v.CreatedAt, "YYYY-MM-DD hh:mm")
  374. v.PicList = utils.ParseImgStr(v.Pics)
  375. eventList[k] = v
  376. }
  377. type Repair struct {
  378. ID int `json:"id"`
  379. WorkerName string `json:"worker_name"`
  380. WorkerPhone string `json:"worker_phone"`
  381. ScheduleTime string `json:"schedule_time"`
  382. FinishedAt string `json:"finished_at"`
  383. Content string `json:"content"`
  384. Duration float64 `json:"duration"`
  385. Pics string `json:"pics"`
  386. PicList []string `json:"pic_list"`
  387. State int `json:"state"`
  388. StateName string `json:"state_name"`
  389. CreatedAt string `json:"created_at"`
  390. AuditType int `json:"audit_type"`
  391. AuditState int `json:"audit_state"`
  392. AuditAt string `json:"audit_at"`
  393. AuditRemark string `json:"audit_remark"`
  394. }
  395. repairList := make([]*Repair, 0)
  396. if _, err = order.GetRepairList(map[string]interface{}{"order_id": id, "_orderby": "created_at desc"}, nil, &repairList); err != nil {
  397. app.Error(c, err.Error())
  398. return
  399. }
  400. repairStatusList := utils.ParseSliceMap(orderParam.Params.RepairState, "id")
  401. for _, v := range repairList {
  402. v.CreatedAt = utils.DateS(v.CreatedAt, "YYYY-MM-DD hh:mm")
  403. v.ScheduleTime = utils.DateS(v.ScheduleTime, "YYYY-MM-DD hh:mm")
  404. v.FinishedAt = utils.DateS(v.FinishedAt, "YYYY-MM-DD hh:mm")
  405. v.PicList = utils.ParseImgStr(v.Pics)
  406. v.StateName = utils.ToStr(repairStatusList[utils.ToStr(v.State)]["name"])
  407. v.AuditAt = utils.DateS(v.AuditAt, "YYYY-MM-DD HH:mm")
  408. }
  409. res := gin.H{
  410. "repair": repairList,
  411. "info": orderInfo,
  412. "event": eventList,
  413. }
  414. app.Success(c, res)
  415. }
  416. func RepairCheckList(c *gin.Context) {
  417. page := app.HandlePageNum(c)
  418. where := map[string]string{
  419. "where": " o.deleted_at=0 and r.audit_type != 0 AND o.leader={{admin_id}}",
  420. "_group_by": "r.id",
  421. "_order_by": "r.id desc",
  422. }
  423. param := make(map[string]interface{})
  424. param["admin_id"] = c.GetInt("adminID")
  425. auditState := utils.ToInt(c.Query("audit_state"))
  426. if auditState > 0 {
  427. where["where"] = where["where"] + " AND r.audit_state = {{auditState}}"
  428. param["auditState"] = auditState - 1
  429. }
  430. keyword := c.Query("keyword")
  431. if keyword != "" {
  432. where["where"] = where["where"] + " AND (o.link_name like {{keyword}} or o.link_phone like {{keyword}})"
  433. param["keyword"] = "%" + keyword + "%"
  434. }
  435. type Admin struct {
  436. ID int `json:"id"`
  437. UserName string `json:"username"`
  438. Phone string `json:"phone"`
  439. }
  440. type RepairList struct {
  441. ID int `json:"id"`
  442. OrderId int `json:"order_id"`
  443. WorkerName string `json:"worker_name"`
  444. WorkerPhone string `json:"worker_phone"`
  445. ScheduleTime string `json:"schedule_time"`
  446. FinishedAt string `json:"finished_at"`
  447. Content string `json:"content"`
  448. Duration float64 `json:"duration"`
  449. Pics string `json:"pics"`
  450. PicList []string `json:"pic_list"`
  451. State int `json:"state"`
  452. StateName string `json:"state_name"`
  453. CreatedAt string `json:"created_at"`
  454. AuditType int `json:"audit_type"`
  455. AuditState int `json:"audit_state"`
  456. AuditAt string `json:"audit_at"`
  457. OrderNo string `json:"order_no"`
  458. MainType int `json:"main_type"`
  459. SubType int `json:"sub_type"`
  460. Type string `json:"type"`
  461. LinkName string `json:"link_name"`
  462. LinkPhone string `json:"link_phone"`
  463. Address string `json:"address"`
  464. DetailContent string `json:"detail_content"`
  465. DetailPics string `json:"detail_pics"`
  466. OrderCreatedAt string `json:"order_created_at"`
  467. Leader int `json:"leader"`
  468. LeaderInfo *Admin `json:"leader_info"`
  469. WarrantyStart string `json:"warranty_start"`
  470. WarrantyEnd string `json:"warranty_end"`
  471. WarrantyPeriod string `json:"warranty_period"`
  472. IsForce int `json:"is_force"`
  473. EndTime string `json:"end_time"`
  474. }
  475. repairList := make([]RepairList, 0)
  476. err := order.GetListWidthOrder(where, param, page, &repairList)
  477. if err != nil {
  478. app.Error(c, err.Error())
  479. return
  480. }
  481. adminIds := make([]int, 0)
  482. for _, v := range repairList {
  483. if v.Leader > 0 {
  484. adminIds = append(adminIds, v.Leader)
  485. }
  486. }
  487. orderTypeMap := aftersale.GetTypeMapByCache()
  488. adminMap := make(map[int]*Admin, 0)
  489. if len(adminIds) > 0 {
  490. adminList := make([]*Admin, 0)
  491. if _, err := admin.GetAdmins(map[string]interface{}{"id in": adminIds}, []string{"id, username, phone"}, app.Page{}, &adminList); err == nil {
  492. for _, v := range adminList {
  493. adminMap[v.ID] = v
  494. }
  495. }
  496. }
  497. repairStatusList := utils.ParseSliceMap(orderParam.Params.RepairState, "id")
  498. for k, v := range repairList {
  499. v.PicList = utils.ParseImgStr(v.Pics)
  500. v.CreatedAt = utils.DateS(v.CreatedAt, "YYYY-MM-DD")
  501. v.Type = orderTypeMap[v.MainType] + "/" + orderTypeMap[v.SubType]
  502. if v.Leader > 0 && adminMap[v.Leader] != nil {
  503. v.LeaderInfo = adminMap[v.Leader]
  504. } else {
  505. v.LeaderInfo = &Admin{}
  506. }
  507. if v.WarrantyStart != "0" {
  508. v.WarrantyPeriod = utils.DateS(v.WarrantyStart, "YYYY-MM-DD") + " 至 " + utils.DateS(v.WarrantyEnd, "YYYY-MM-DD")
  509. } else {
  510. v.WarrantyPeriod = "保修期外"
  511. }
  512. v.ScheduleTime = utils.DateS(v.ScheduleTime, "YYYY-MM-DD")
  513. v.CreatedAt = utils.DateS(v.CreatedAt, "YYYY-MM-DD")
  514. v.OrderCreatedAt = utils.DateS(v.OrderCreatedAt, "YYYY-MM-DD")
  515. v.EndTime = utils.DateS(v.EndTime, "YYYY-MM-DD HH:mm")
  516. v.FinishedAt = utils.DateS(v.FinishedAt, "YYYY-MM-DD HH:mm")
  517. v.AuditAt = utils.DateS(v.AuditAt, "YYYY-MM-DD HH:mm")
  518. v.StateName = utils.ToStr(repairStatusList[utils.ToStr(v.State)]["name"])
  519. repairList[k] = v
  520. }
  521. app.Success(c, repairList)
  522. }