diff --git a/src/gongyinglian/goods.go b/src/gongyinglian/goods.go index b0d2404..8c186f9 100644 --- a/src/gongyinglian/goods.go +++ b/src/gongyinglian/goods.go @@ -10,14 +10,18 @@ import ( type goods struct { Product create string `name:"create shop_uid*:select name* info price stock unit" role:"boss"` + market string `name:"market domain_uid* title* content" role:"boss"` } func (s goods) Create(m *ice.Message, arg ...string) { s.Product.Create(m, kit.Simple(model.PRODUCT_TYPE, ProductGoods, arg)...) } +func (s goods) Market(m *ice.Message, arg ...string) { + s.MarketInsert(m, arg...) +} func (s goods) List(m *ice.Message, arg ...string) { s.Product.List(m.Options(model.PRODUCT_TYPE, kit.Format(ProductGoods)), arg...) - kit.If(s.checkListRole(m, arg...), func() { m.PushAction(s.SetShop, s.SetBrand, s.SetQuality, s.Modify, s.Remove) }) + kit.If(s.checkListRole(m, arg...), func() { m.PushAction(s.Market, s.SetShop, s.SetBrand, s.SetQuality, s.Modify, s.Remove) }) } func init() { ice.TeamCtxCmd(goods{}) } diff --git a/src/gongyinglian/model/model.go b/src/gongyinglian/model/model.go index 9375319..9f6590e 100644 --- a/src/gongyinglian/model/model.go +++ b/src/gongyinglian/model/model.go @@ -11,6 +11,7 @@ const ( STATUS = "status" TITLE = "title" CONTENT = "content" + AUTH_UID = "auth_uid" USER_UID = "user_uid" USER_STORE_ROLE = "user_store_role" STORE_UID = "store_uid" diff --git a/src/gongyinglian/order.go b/src/gongyinglian/order.go index 439d100..2aa32aa 100644 --- a/src/gongyinglian/order.go +++ b/src/gongyinglian/order.go @@ -59,6 +59,7 @@ func (s Order) Purchase(m *ice.Message, arg ...string) { m.ProcessRewrite(model.UID, m.Result()) } func (s Order) List(m *ice.Message, arg ...string) { + m.Display("") if len(arg) == 1 { if !s.checkListRole(m, arg...) { return @@ -190,15 +191,22 @@ func (s Order) List(m *ice.Message, arg ...string) { } } } +func (s Order) Amount(m *ice.Message, arg ...string) { + msg := m.Cmd(s.orderDetail, s.orderDetail.Amount, m.Option(model.UID)) + s.Table.Update(m, kit.Dict(msg.AppendSimple(model.AMOUNT, model.TOTAL)), m.OptionSimple(model.UID)...) +} func (s Order) Insert(m *ice.Message, arg ...string) { msg := m.Cmd(s.product, m.Option(model.STORE_UID), m.Option(model.PRODUCT_UID)) m.Cmd(s.orderDetail, s.Create, arg, msg.AppendSimple(model.PRICE), model.ORDER_UID, m.Option(model.UID)) + s.Amount(m) } func (s Order) Delete(m *ice.Message, arg ...string) { m.Cmd(s.orderDetail, s.Delete, model.UID, m.Option(model.ORDER_DETAIL_UID), model.ORDER_UID, m.Option(model.UID)) + s.Amount(m) } func (s Order) Update(m *ice.Message, arg ...string) { m.Cmdy(s.orderDetail, s.Update, model.UID, m.Option(model.ORDER_DETAIL_UID), model.ORDER_UID, m.Option(model.UID)) + s.Amount(m) } func (s Order) Cancel(m *ice.Message, arg ...string) { s.Table.Update(m, kit.Dict(model.STATUS, OrderCancel), m.OptionSimple(model.UID)...) @@ -280,6 +288,7 @@ func (s Order) Payment(m *ice.Message, arg ...string) { m.Cmdy(payment{}, s.Create, model.ORDER_UID, m.Option(model.UID), m.OptionSimple(model.COMPANY_UID, model.OPEN_ID), model.STATUS, PaymentSuccess) s.Table.Update(m, kit.Dict(model.PAYMENT_STATUS, PaymentSuccess, model.PAYMENT_SUCCESS_TIME, m.Time()), m.OptionSimple(model.UID)...) m.Option(model.FROM_USER_UID, msg.Option(model.FROM_USER_UID)) + Portal{}.DashboardUpdate(m) }) s.sendTemplate(m, model.FROM_USER_UID, m.Trans("order payment", "订单已付款")) } @@ -315,6 +324,7 @@ func (s Order) ConfirmExpress(m *ice.Message, arg ...string) { } s.Table.Update(m, kit.Dict(model.STATUS, OrderDeal, model.EXPRESS_STATUS, ExpressConfirm, model.EXPRESS_RECV_TIME, m.Time()), m.OptionSimple(model.UID)...) m.Option(model.FROM_USER_UID, msg.Option(model.FROM_USER_UID)) + Portal{}.DashboardUpdate(m) }) s.sendTemplate(m, model.FROM_USER_UID, m.Trans("order confirm express", "订单已确认收货")) } diff --git a/src/gongyinglian/order.js b/src/gongyinglian/order.js index c5da236..9c05217 100644 --- a/src/gongyinglian/order.js +++ b/src/gongyinglian/order.js @@ -3,6 +3,7 @@ Volcanos(chat.ONIMPORT, { can.onimport.itemcards(can, msg, function(value) { return [ {view: html.TITLE, list: [value.name||value.user_name||"待确认", can.onimport.textView(can, value, "order_type", mdb.TYPE)]}, {view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), can.onimport.textView(can, value, "order_status", mdb.STATUS)]}, + {view: html.STATUS, list: ["数量:", value.total, "件", "总额:", value.amount, "元"]}, value.payment_success_time && {view: html.STATUS, list: ["收款时间:", can.base.TimeTrim(value.payment_success_time)]}, value.express_recv_time && {view: html.STATUS, list: ["收货时间:", can.base.TimeTrim(value.express_recv_time)]}, value.return_recv_time && {view: html.STATUS, list: ["退货时间:", can.base.TimeTrim(value.return_recv_time)]}, diff --git a/src/gongyinglian/orderDetail.go b/src/gongyinglian/orderDetail.go index ebe2528..8a27332 100644 --- a/src/gongyinglian/orderDetail.go +++ b/src/gongyinglian/orderDetail.go @@ -16,10 +16,15 @@ func (s orderDetail) Update(m *ice.Message, arg ...string) { m.Option(model.PRICE, kit.Int(kit.Float(m.Option(model.PRICE))*100)) s.Table.Update(m, kit.Dict(m.OptionSimple(model.PRICE), model.COUNT, kit.Int(m.Option(model.COUNT))), arg...) } +func (s orderDetail) Amount(m *ice.Message, arg ...string) { + s.Fields(m, "SUM(price * count) AS amount", "SUM(count) AS total") + s.Select(m, model.ORDER_UID, arg[0]) +} func (s orderDetail) List(m *ice.Message, arg ...string) { if !s.checkOrderRole(m.Spawn(), arg...) { return } + m.Display("") s.Tables(m, s.product).FieldsWithCreatedAT(m, s, model.NAME, model.INFO, s.Key(s, model.PRICE), s.Key(s, model.COUNT), model.UNIT, model.PRODUCT_TYPE, model.PRODUCT_UID, diff --git a/src/gongyinglian/portal.go b/src/gongyinglian/portal.go index 5819224..86fdece 100644 --- a/src/gongyinglian/portal.go +++ b/src/gongyinglian/portal.go @@ -1,13 +1,27 @@ package gongyinglian import ( + "shylinux.com/x/ice" + kit "shylinux.com/x/toolkits" + "shylinux.com/x/community/src/gonganxitong" + "shylinux.com/x/enterprise/src/gongyinglian/model" "shylinux.com/x/enterprise/src/guanlixitong" ) type Portal struct { guanlixitong.Portal + product Product + order Order placeCreate string `name:"placeCreate city_name* company_name* store_type*:select store_name*" role:"void"` } +func (s Portal) AfterPlaceAuth(m *ice.Message, arg ...string) { + s.DashboardCreate(m, "") + s.DashboardInsert(m, "1", "订单总额", s.order, "SUM(amount) / 100.0", model.FROM_STORE_UID, m.Option(model.STORE_UID), model.STATUS, kit.Format(OrderDeal)) + s.DashboardInsert(m, "2", "订单数量", s.order, "", model.FROM_STORE_UID, m.Option(model.STORE_UID), model.STATUS, kit.Format(OrderDeal)) + s.DashboardInsert(m, "3", "库存数量", s.product, "SUM(stock)") + s.DashboardInsert(m, "4", "库存总额", s.product, "SUM(stock * price) / 100.0") +} + func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userStore{}, store{})}) } diff --git a/src/gongyinglian/product.go b/src/gongyinglian/product.go index 2e634c8..bb6a12d 100644 --- a/src/gongyinglian/product.go +++ b/src/gongyinglian/product.go @@ -45,7 +45,7 @@ func (s Product) List(m *ice.Message, arg ...string) { kit.If(m.Option(model.PRODUCT_TYPE), func(p string) { args = append(args, s.Key(s, model.TYPE), p) }) if len(arg) == 1 { s.Select(m, args...) - kit.If(!m.IsErr() && m.Length() == 0, func() { m.EchoInfoButton("", s.Create) }) + s.Button(m, "") } else if len(arg) == 2 { s.SelectDetail(m, append(args, s.Key(s, model.UID), arg[1])...) } else { diff --git a/src/gongyinglian/shop.go b/src/gongyinglian/shop.go index d06a97a..4aeb364 100644 --- a/src/gongyinglian/shop.go +++ b/src/gongyinglian/shop.go @@ -1,9 +1,6 @@ package gongyinglian -import ( - "shylinux.com/x/ice" - kit "shylinux.com/x/toolkits" -) +import "shylinux.com/x/ice" type Shop struct { Value @@ -12,9 +9,6 @@ type Shop struct { modify string `name:"modify name* address" role:"boss"` } -func (s Shop) List(m *ice.Message, arg ...string) { - s.Table.ValueList(m, arg) - kit.If(m.Length() == 0, func() { m.EchoInfoButton("") }) -} +func (s Shop) List(m *ice.Message, arg ...string) { s.ValueList(m, arg) } func init() { ice.TeamCtxCmd(Shop{}) } diff --git a/usr/local/export/web.team.gonganxitong.portal/hash.json b/usr/local/export/web.team.gonganxitong.portal/hash.json index 3afd8c5..e48aa94 100644 --- a/usr/local/export/web.team.gonganxitong.portal/hash.json +++ b/usr/local/export/web.team.gonganxitong.portal/hash.json @@ -21,6 +21,13 @@ "time": "2024-08-05 00:34:49.421" } }, + "3971882ea4f32c86386ad04b39d3e3d4": { + "meta": { + "index": "web.team.gonganxitong.market", + "order": "100", + "time": "2024-09-07 08:52:22.362" + } + }, "58724bdcc3cae3e26700cb3199e0602c": { "meta": { "index": "web.team.gonganxitong.placeUser", @@ -79,12 +86,25 @@ "time": "2024-08-20 21:48:51.239" } }, + "c1526ecd405021d6d47798c066bf70c0": { + "meta": { + "index": "web.team.gonganxitong.notice", + "order": "70", + "time": "2024-09-07 08:52:22.352" + } + }, "c36d47e2611b0d1e7a14088bc3293d04": { "meta": { "index": "web.team.guanlixitong.apply", "time": "2024-08-04 09:53:53.616" } }, + "d86e4e63183c8fae4ceb50498b0bcfde": { + "meta": { + "index": "web.team.gonganxitong.domain", + "time": "2024-09-07 08:52:22.358" + } + }, "e2117b53c036a72fe7e4885449488a6f": { "meta": { "index": "web.team.gonganxitong.qrcode", diff --git a/usr/local/export/web.team.gongyinglian.portal/hash.json b/usr/local/export/web.team.gongyinglian.portal/hash.json index d96b331..56f72b6 100644 --- a/usr/local/export/web.team.gongyinglian.portal/hash.json +++ b/usr/local/export/web.team.gongyinglian.portal/hash.json @@ -80,6 +80,12 @@ "time": "2024-08-20 21:24:23.289" } }, + "603552f8c3e96c6693d840810254f410": { + "meta": { + "index": "web.team.gongyinglian.domain", + "time": "2024-09-07 08:52:22.315" + } + }, "611c0a0505eb9d843ed02968e884bbf9": { "meta": { "index": "web.team.gongyinglian.goods", @@ -111,6 +117,20 @@ "time": "2024-08-20 21:24:23.298" } }, + "749051bc7a30b3e6a57563ce3f1565d9": { + "meta": { + "index": "web.team.gongyinglian.notice", + "order": "94", + "time": "2024-09-07 08:52:22.319" + } + }, + "7c9a204279f1cddfcecd1c7be74897aa": { + "meta": { + "index": "web.team.gongyinglian.market", + "order": "100", + "time": "2024-09-07 08:52:22.333" + } + }, "8152d5a4a224ae3403fba2e01ea9ffef": { "meta": { "index": "web.team.gongyinglian.shop", diff --git a/usr/local/export/web.team.guanlixitong.portal/hash.json b/usr/local/export/web.team.guanlixitong.portal/hash.json index f777b14..cafdb87 100644 --- a/usr/local/export/web.team.guanlixitong.portal/hash.json +++ b/usr/local/export/web.team.guanlixitong.portal/hash.json @@ -7,6 +7,12 @@ "time": "2024-08-03 16:09:06.053" } }, + "04c6ed833d5cf77fef12937a0e58f2ba": { + "meta": { + "index": "web.team.guanlixitong.domain", + "time": "2024-09-07 08:52:22.301" + } + }, "057616b7366e1930ef4e4a921fe45f1f": { "meta": { "index": "web.team.guanlixitong.service", @@ -29,6 +35,20 @@ "time": "2024-08-12 08:57:09.639" } }, + "78d29149539be88d7561b8e17bd65882": { + "meta": { + "index": "web.team.guanlixitong.market", + "order": "100", + "time": "2024-09-07 08:52:22.294" + } + }, + "809b63c1819fc3ac1452e3b71889aec5": { + "meta": { + "index": "web.team.guanlixitong.notice", + "order": "70", + "time": "2024-09-07 08:52:22.295" + } + }, "9c18032c5bc252f2986e1b20e7e77db7": { "meta": { "index": "web.team.guanlixitong.event", diff --git a/usr/local/export/web.team.shichangyingxiao.portal/hash.json b/usr/local/export/web.team.shichangyingxiao.portal/hash.json index 1439f7c..f8e8f32 100644 --- a/usr/local/export/web.team.shichangyingxiao.portal/hash.json +++ b/usr/local/export/web.team.shichangyingxiao.portal/hash.json @@ -1,4 +1,17 @@ { + "095922877a62ea8c8191c4848f88e9e2": { + "meta": { + "index": "web.team.shichangyingxiao.domain", + "time": "2024-09-07 08:52:22.280" + } + }, + "2c9df1f570f596584de4fa13c5b93e3c": { + "meta": { + "index": "web.team.shichangyingxiao.notice", + "order": "70", + "time": "2024-09-07 08:52:22.281" + } + }, "46e6332c4605f69a33b1e77afa8946b1": { "meta": { "index": "web.team.shichangyingxiao.recent", @@ -14,6 +27,13 @@ "time": "2024-08-28 10:26:10.872" } }, + "87d12132d2a5af1a5f02d559b05f0079": { + "meta": { + "index": "web.team.shichangyingxiao.market", + "order": "100", + "time": "2024-09-07 08:52:22.289" + } + }, "9411a77c619ee04f05c6786ee9012691": { "meta": { "index": "web.team.shichangyingxiao.promotion", diff --git a/usr/local/export/web.team.zijinlian.portal/hash.json b/usr/local/export/web.team.zijinlian.portal/hash.json index 223befc..6a5eaae 100644 --- a/usr/local/export/web.team.zijinlian.portal/hash.json +++ b/usr/local/export/web.team.zijinlian.portal/hash.json @@ -14,6 +14,13 @@ "time": "2024-08-28 10:26:10.916" } }, + "1193f64afd8038b7424ca3ff61a20414": { + "meta": { + "index": "web.team.zijinlian.market", + "order": "100", + "time": "2024-09-07 08:52:22.273" + } + }, "500957356f664f8f498fec0463c0059c": { "meta": { "index": "web.team.zijinlian.service", @@ -21,6 +28,12 @@ "time": "2024-08-28 10:26:10.913" } }, + "5a0fb6073ce525674d981e94da73be01": { + "meta": { + "index": "web.team.zijinlian.domain", + "time": "2024-09-07 08:52:22.265" + } + }, "76268373c0e2d37f0ecef7cda4e753bf": { "meta": { "index": "web.team.zijinlian.member", @@ -51,6 +64,13 @@ "time": "2024-08-28 10:26:10.911" } }, + "c1ce9668d8ab941e983d33c41b984e05": { + "meta": { + "index": "web.team.zijinlian.notice", + "order": "70", + "time": "2024-09-07 08:52:22.274" + } + }, "ef38e71eba9d4bf20b1bad56fa2a0b18": { "meta": { "index": "web.team.zijinlian.qrcode",