diff --git a/b/product/publish_product_add.dspy b/b/product/publish_product_add.dspy index 60a53d2..a9f7f56 100644 --- a/b/product/publish_product_add.dspy +++ b/b/product/publish_product_add.dspy @@ -88,7 +88,7 @@ async def publish_product_add(ns={}): ns_dic['discount_price'] = ns['price'] user_role = await get_user_role({'userid': userid, 'sor': sor}) # 非客户角色不需要审批 - if user_role != '客户': + if user_role != '客户' and user_role != '管理员': ns['status'] = '1' ns_dic['audit_status'] = 'approved' ns_dic['listing_status'] = 'listing' diff --git a/b/product/publish_product_search.dspy b/b/product/publish_product_search.dspy index 2deb96d..858df0f 100644 --- a/b/product/publish_product_search.dspy +++ b/b/product/publish_product_search.dspy @@ -197,7 +197,7 @@ async def publish_product_search(ns={}): user_role = await get_user_role({'userid': userid, 'sor': sor}) try: # 非客户角色 - if user_role != '客户': + if user_role != '客户' and user_role != '管理员': ns['del_flg'] = '0' # 业主机构角色并且是只查看业主机构自己 manager_self==single @@ -227,7 +227,7 @@ async def publish_product_search(ns={}): WHERE org.parentid = '%s' AND upr.del_flg = '0' AND upr.publish_type = '%s' ORDER BY upr.create_at DESC;""" % (orgid, publish_type) find_sql = """SELECT upr.* FROM user_publish_product AS upr LEFT JOIN organization AS org ON upr.orgid = org.id - WHERE org.parentid = '%s' AND upr.del_flg = '0' AND upr.publish_type = '%s' ORDER BY upr.create_at DESC LIMIT %s OFFSET %s;""" % (orgid, publish_type, page_size, current_page) + WHERE (org.parentid = '%s' OR org.id = '%s') AND upr.del_flg = '0' AND upr.publish_type = '%s' ORDER BY upr.create_at DESC LIMIT %s OFFSET %s;""" % (orgid, orgid, publish_type, page_size, current_page) # 客户角色 else: ns['del_flg'] = '0' @@ -240,6 +240,10 @@ async def publish_product_search(ns={}): if ns.get('audit_status') == 'pending,approved': count_sql = count_sql.split('WHERE')[0] + ' WHERE ' + "(upr.audit_status = 'pending' OR upr.audit_status = 'approved') AND " + count_sql.split('WHERE')[1] find_sql = find_sql.split('WHERE')[0] + ' WHERE ' + "(upr.audit_status = 'pending' OR upr.audit_status = 'approved') AND " + find_sql.split('WHERE')[1] + elif ns.get('audit_status') == 'approved,rejected': + count_sql = count_sql.split('WHERE')[0] + ' WHERE ' + "(upr.audit_status = 'rejected' OR upr.audit_status = 'approved') AND " + count_sql.split('WHERE')[1] + find_sql = find_sql.split('WHERE')[0] + ' WHERE ' + "(upr.audit_status = 'rejected' OR upr.audit_status = 'approved') AND " + find_sql.split('WHERE')[1] + elif ns.get('audit_status'): count_sql = count_sql.split('WHERE')[0] + ' WHERE ' + "upr.audit_status = '%s' AND " % ns.get('audit_status') + count_sql.split('WHERE')[1] find_sql = find_sql.split('WHERE')[0] + ' WHERE ' + "upr.audit_status = '%s' AND " % ns.get('audit_status') + find_sql.split('WHERE')[1] diff --git a/b/product/publish_product_search_first_page.dspy b/b/product/publish_product_search_first_page.dspy index cee413d..e905e59 100644 --- a/b/product/publish_product_search_first_page.dspy +++ b/b/product/publish_product_search_first_page.dspy @@ -28,8 +28,8 @@ async def publish_product_search_first_page(ns={}): count_sql = """SELECT COUNT(*) AS total_count FROM user_publish_product WHERE domain_name = '%s' AND first_page = '1' AND audit_status = 'approved' AND listing_status = 'listing' AND del_flg = '0' AND publish_type = '%s' ORDER BY create_at DESC;""" % (domain_name, publish_type) find_sql = """SELECT upp.* FROM user_publish_product AS upp INNER JOIN user_publish_product_category AS uppc ON upp.product_category LIKE uppc.id WHERE upp.domain_name = '%s' AND upp.first_page = '1' AND upp.audit_status = 'approved' AND upp.del_flg = '0' AND upp.publish_type = '%s' ORDER BY uppc.priority ASC, upp.create_at DESC LIMIT %s OFFSET %s;""" % (domain_name, publish_type, page_size, current_page) elif to_page == 'square' and product_category: - count_sql = """SELECT COUNT(*) AS total_count FROM user_publish_product WHERE domain_name = '%s' AND product_category LIKE """ % domain_name + """'%%""" + product_category + """%%'""" + """ AND audit_status = 'approved' AND del_flg = '0' AND publish_type = '%s' ORDER BY create_at DESC;""" % publish_type - find_sql = """SELECT * FROM user_publish_product WHERE domain_name = '%s' AND product_category LIKE """ % domain_name + """'%%""" + product_category + """%%'""" + """ AND audit_status = 'approved' AND del_flg = '0' AND publish_type = '%s' ORDER BY create_at DESC LIMIT %s OFFSET %s;""" % (publish_type, page_size, current_page) + count_sql = """SELECT COUNT(*) AS total_count FROM user_publish_product WHERE domain_name = '%s' AND product_category LIKE """ % domain_name + """'%%""" + product_category + """%%'""" + """ AND audit_status = 'approved' AND listing_status = 'listing' AND del_flg = '0' AND publish_type = '%s' ORDER BY create_at DESC;""" % publish_type + find_sql = """SELECT * FROM user_publish_product WHERE domain_name = '%s' AND product_category LIKE """ % domain_name + """'%%""" + product_category + """%%'""" + """ AND audit_status = 'approved' AND listing_status = 'listing' AND del_flg = '0' AND publish_type = '%s' ORDER BY create_at DESC LIMIT %s OFFSET %s;""" % (publish_type, page_size, current_page) elif to_page == 'square': count_sql = """SELECT COUNT(*) AS total_count FROM user_publish_product WHERE domain_name = '%s' AND audit_status = 'approved' AND del_flg = '0' AND publish_type = '%s' ORDER BY create_at DESC;""" % (domain_name, publish_type) find_sql = """SELECT * FROM user_publish_product WHERE domain_name = '%s' AND audit_status = 'approved' AND del_flg = '0' AND publish_type = '%s' ORDER BY create_at DESC LIMIT %s OFFSET %s;""" % (domain_name, publish_type, page_size, current_page) diff --git a/b/product/publish_product_update.dspy b/b/product/publish_product_update.dspy index e824e5a..b03eb88 100644 --- a/b/product/publish_product_update.dspy +++ b/b/product/publish_product_update.dspy @@ -66,7 +66,7 @@ async def publish_product_update(ns={}): user_role = await get_user_role({'userid': userid, 'sor': sor}) # 编辑状态 # 非客户角色编辑客户的产品 - if user_role != '客户' and ns.get('orgid') != orgid: + if user_role != '客户' and user_role != '管理员' and ns.get('orgid') != orgid: # 非客户角色审核客户的产品 # 如果是待审状态 更新审核状态为通过 上架状态为上架 清空驳回原因 if ns.get('audit_status') == 'approved': @@ -86,7 +86,7 @@ async def publish_product_update(ns={}): ns_dic['publish_time'] = None # 非客户角色编辑自己的产品 默认审批通过和发布成功 - elif user_role != '客户': + elif user_role != '客户' and user_role != '管理员': # 运营删除自己的产品 if ns.get('del_flg') == '1': pass @@ -100,9 +100,28 @@ async def publish_product_update(ns={}): # 客户编辑以后 审核状态是: 待审 上架状态是:空 else: # 客户要下架自己的产品 - if ns.get('listing_status') == 'delisting': - ns_dic['audit_status'] = None - ns_dic['listing_status'] = 'delisting' + if ns.get('listing_status') == 'delisting' or ns.get('listing_status') == 'listing': + # 如果状态是审批中和未上架 + exists_status = await sor.R('user_publish_product', {'id': ns.get('id')}) + if exists_status[0]['audit_status'] == 'pending' and (not exists_status[0]['listing_status']): + return { + 'status': False, + 'msg': '审批中的产品操作' + } + if ns.get('listing_status') == 'delisting': + ns_dic['listing_status'] = 'delisting' + ns_dic['publish_time'] = None + + if ns.get('listing_status') == 'listing': + if exists_status[0]['audit_status'] == 'approved': + ns_dic['listing_status'] = 'listing' + ns_dic['publish_time'] = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + else: + return { + 'status': False, + 'msg': '审批未通过,不能上架' + } + # 客户仅编辑不是下架产品 else: ns_dic['audit_status'] = 'pending' diff --git a/f/web-kboss/src/views/customer/approveMangement/approvedPro.vue b/f/web-kboss/src/views/customer/approveMangement/approvedPro.vue index 2e2c80c..3f20d91 100644 --- a/f/web-kboss/src/views/customer/approveMangement/approvedPro.vue +++ b/f/web-kboss/src/views/customer/approveMangement/approvedPro.vue @@ -14,7 +14,8 @@ export default { return { role:{ role_type:'customer', - audit_status:'approved' + audit_status:'approved,rejected', + type:'user' } } }, diff --git a/f/web-kboss/src/views/customer/productMangement/commonBox/index.vue b/f/web-kboss/src/views/customer/productMangement/commonBox/index.vue index 492c4c2..014a61c 100644 --- a/f/web-kboss/src/views/customer/productMangement/commonBox/index.vue +++ b/f/web-kboss/src/views/customer/productMangement/commonBox/index.vue @@ -22,9 +22,15 @@