1
0
mirror of https://shylinux.com/x/icebergs synced 2025-05-03 20:07:01 +08:00
icebergs/core/mall/goods.go
2023-10-27 13:39:01 +08:00

35 lines
1.4 KiB
Go

package mall
import (
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/web"
"shylinux.com/x/icebergs/base/web/html"
kit "shylinux.com/x/toolkits"
)
const (
PRICE = "price"
)
const GOODS = "goods"
func init() {
Index.MergeCommands(ice.Commands{
GOODS: {Help: "商品", Icon: "mall.png", Meta: kit.Dict(
ctx.TRANS, kit.Dict(html.INPUT, kit.Dict(mdb.TYPE, "单位", PRICE, "价格", AMOUNT, "总价")),
), Actions: ice.MergeActions(ice.Actions{
mdb.CREATE: {Name: "create zone* name* text price* count*=1 type*=件,个,份,斤 image*=4@img"},
mdb.MODIFY: {Name: "modify zone* name* text price* count*=1 type*=件,个,份,斤 image*=4@img"},
ORDER: {Name: "order count*=1", Help: "选购", Hand: func(m *ice.Message, arg ...string) {}},
}, web.ExportCacheAction(nfs.IMAGE), mdb.ExportHashAction(ctx.TOOLS, Prefix(ORDER), mdb.FIELD, "time,hash,zone,name,text,price,count,type,image")), Hand: func(m *ice.Message, arg ...string) {
kit.If(len(arg) == 0 && m.IsMobileUA(), func() { m.OptionDefault(ice.MSG_FIELDS, "zone,name,price,count,type,text,hash,time,image") })
mdb.HashSelect(m, arg...).PushAction(ORDER).Action("filter:text")
web.PushPodCmd(m, "", arg...).Sort("zone,name")
ctx.DisplayLocal(m, "")
_status_amount(m)
}},
})
}