This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-08-18 11:39:56 +08:00
parent 05f8c3e6a9
commit 20c58fd1d0
9 changed files with 97 additions and 32 deletions

10
src/gongyinglian/brand.go Normal file
View File

@ -0,0 +1,10 @@
package gongyinglian
import "shylinux.com/x/ice"
type brand struct{ Tables }
func (s brand) List(m *ice.Message, arg ...string) {
}
func init() { ice.TeamCtxCmd(brand{}) }

View File

@ -64,6 +64,15 @@ func (s Table) checkRole(m *ice.Message, arg ...UserStoreRole) bool {
}
return !m.WarnNotRight(true)
}
func (s Table) userStoreRole(m *ice.Message, arg ...string) UserStoreRole {
msg := m.Cmd(userStore{}, s.Select, model.STORE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID))
if msg.Length() > 0 {
return UserStoreRole(kit.Int(msg.Append(model.ROLE)))
} else {
return -1
}
}
func (s Table) recordEvent(m *ice.Message, info string, arg ...string) *ice.Message {
s.Table.RecordEvent(m, m.Option(model.STORE_UID), info, kit.Select(m.Option(model.UID), arg, 0))
return m

View File

@ -17,14 +17,14 @@ const (
STORE_UID = "store_uid"
STORE_NAME = "store_name"
STORE_TYPE = "store_type"
FROM_STORE_UID = "from_store_uid"
FROM_USER_UID = "from_user_uid"
TO_STORE_UID = "to_store_uid"
TO_USER_UID = "to_user_uid"
ORDER_UID = "order_uid"
ORDER_TYPE = "order_type"
ORDER_STATUS = "order_status"
ORDER_DETAIL_UID = "order_detail_uid"
FROM_STORE_UID = "from_store_uid"
FROM_USER_UID = "from_user_uid"
TO_STORE_UID = "to_store_uid"
TO_USER_UID = "to_user_uid"
PAYMENT_STATUS = "payment_status"
EXPRESS_STATUS = "express_status"
RETURN_STATUS = "return_status"
@ -37,6 +37,7 @@ const (
COMPANY_UID = "company_uid"
CITY_UID = "city_uid"
PRICE = "price"
STOCK = "stock"
COUNT = "count"
UNIT = "unit"
)

View File

@ -7,7 +7,7 @@ import (
type Portal struct {
gonganxitong.Portal
placeCreate string `name:"placeCreate city_name* company_name* store_name*" role:"void"`
placeCreate string `name:"placeCreate city_name* company_name* store_type*:select store_name*" role:"void"`
}
func init() {

View File

@ -1,36 +1,32 @@
{
"portal": "供应链", "placeCreate": "创建生意", "placeRemove": "删除生意",
"product": "产品列表", "order": "订单列表", "member": "生意伙伴",
"goods": "商品", "expense": "开支",
"material": "材料", "process": "加工",
"quality": "质检", "brand": "贴牌",
"shop": "店铺", "garage": "仓库", "express": "物流", "payment": "账本",
"product": "货物列表", "order": "订单列表", "member": "生意伙伴", "loan": "借贷外债",
"sell": "出货", "confirmSell": "确认出货",
"purchase": "进货", "confirmPurchase": "确认进货",
"payment": "付款", "confirmPayment": "确认收款",
"express": "寄件", "confirmExpress": "确认收件",
"return": "发起退货", "confirmReturn": "确认收到退货",
"refund": "发起退款", "confirmRefund": "确认收到退款",
"material": "材料", "process": "加工", "goods": "商品",
"garage": "仓库",
"loan": "借贷", "expense": "开支",
"express": "物流",
"payment": "账本",
"shop": "店铺",
"style": {
"purchase": "danger"
},
"icons": {
"loan": "https://img.icons8.com/officel/80/bank-building.png",
"expense": "https://img.icons8.com/officel/80/cash-in-hand.png",
"goods": "https://img.icons8.com/officel/80/product.png",
"sell": "https://img.icons8.com/officel/80/handle-with-care.png",
"purchase": "https://img.icons8.com/officel/80/paid.png",
"expense": "https://img.icons8.com/officel/80/cash-in-hand.png",
"material": "https://img.icons8.com/officel/80/wood.png",
"process": "https://img.icons8.com/officel/80/cnc-machine.png",
"goods": "https://img.icons8.com/officel/80/product.png",
"quality": "https://img.icons8.com/officel/80/test-partial-passed.png",
"brand": "https://img.icons8.com/officel/80/add-tag.png",
"shop": "https://img.icons8.com/officel/80/shop.png",
"sell": "https://img.icons8.com/officel/80/handle-with-care.png",
"garage": "https://img.icons8.com/officel/80/garage-closed.png",
"express": "https://img.icons8.com/officel/80/in-transit.png",
"payment": "https://img.icons8.com/officel/80/spiral-bound-booklet.png",
"product": "https://img.icons8.com/officel/80/warehouse.png",
"garage": "https://img.icons8.com/officel/80/garage-closed.png",
"order": "https://img.icons8.com/officel/80/receipt.png"
"order": "https://img.icons8.com/officel/80/receipt.png",
"loan": "https://img.icons8.com/officel/80/bank-building.png"
},
"input": {
"My Store": "我的生意",
@ -58,7 +54,12 @@
}
},
"store_type": {
"normal": "普通"
"shop": "商铺",
"factory": "工厂",
"icons": {
"shop": "https://img.icons8.com/officel/80/shop.png",
"factory": "https://img.icons8.com/officel/80/cnc-machine.png"
}
},
"order_type": {
"sell": "出货单",

View File

@ -0,0 +1,32 @@
order `
userStore.go
store.go
product.go
product.js
order.go
order.js
orderDetail.go
orderDetail.js
payment.go
express.go
return.go
refund.go
sell.go
purchase.go
process.go
quality.go
expense.go
material.go
goods.go
warehouse.go
garage.go
shop.go
loan.go
model
common.go
portal.go
portal.json
portal.shy
`

View File

@ -17,14 +17,14 @@ type product struct {
func (s product) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, kit.Simple(arg, model.PRICE, kit.Int(kit.Float(m.Option(model.PRICE))*100), m.OptionSimple(model.STORE_UID))...)
s.recordEvent(m, m.Trans("create product ", "创建商品 ")+m.Option(model.NAME), m.Result())
s.recordEvent(m, m.Trans("create product ", "创建商品 ")+kit.Cut(m.Result(), 6)+" "+m.Option(model.NAME), m.Result())
}
func (s product) Modify(m *ice.Message, arg ...string) {
s.Table.Update(m, kit.Dict(arg, model.PRICE, kit.Int(kit.Float(m.Option(model.PRICE))*100)), m.OptionSimple(model.STORE_UID, model.UID)...)
s.Table.Update(m, kit.Dict(arg, model.PRICE, kit.Int(kit.Float(m.Option(model.PRICE))*100)), m.OptionSimple(model.UID, model.STORE_UID)...)
}
func (s product) Delete(m *ice.Message, arg ...string) {
s.Table.Delete(m, m.OptionSimple(model.STORE_UID, model.UID)...)
s.recordEvent(m, m.Trans("delete product ", "删除商品 ")+m.Option(model.NAME), m.Option(model.UID))
s.recordEvent(m, m.Trans("delete product ", "删除商品 ")+kit.Cut(m.Option(model.UID), 6)+" "+m.Option(model.NAME), m.Option(model.UID))
}
func (s product) List(m *ice.Message, arg ...string) {
if len(arg) == 0 {
@ -39,10 +39,10 @@ func (s product) List(m *ice.Message, arg ...string) {
} else {
return
}
msg := m.Cmd(s.userStore, s.Select, model.STORE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID))
role := UserStoreRole(kit.Int(msg.Append(model.ROLE)))
if msg.Length() > 0 && (role == UserStoreCreator || role == UserStoreBoss) {
m.PushAction(s.Modify, s.Delete)
if role := s.userStoreRole(m, arg[0]); role == UserStoreCreator || role == UserStoreBoss {
m.PushAction(s.Modify, s.Delete).Action(s.Create)
} else {
m.Action()
}
}

View File

@ -0,0 +1,10 @@
package gongyinglian
import "shylinux.com/x/ice"
type quality struct{ Tables }
func (s quality) List(m *ice.Message, arg ...string) {
}
func init() { ice.TeamCtxCmd(quality{}) }

View File

@ -9,11 +9,13 @@ func init() { ice.TeamCtxCmd(store{}) }
type StoreType int
const (
StoreNormal StoreType = iota
StoreShop StoreType = iota
StoreFactory
)
var StoreTypeList = map[StoreType]string{
StoreNormal: "normal",
StoreShop: "shop",
StoreFactory: "factory",
}
func (s StoreType) String() string { return StoreTypeList[s] }