diff --git a/backend/main.py b/backend/main.py
index 5550d25..159958d 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -143,6 +143,25 @@ def shop_products(address):
}
return jsonify(ans)
+@app.route('/shop/
/products', methods=['POST'])
+def add_products(address):
+ product = request.get_json()['product']
+ print(product['name'])
+ print(product['code'])
+ print(product['price'])
+
+ db = sqlite3.connect(DATABASE)
+ cursor = db.cursor()
+ cursor.execute("SELECT `id` FROM `shops` WHERE `address`=?", (address, ))
+ shop_id = cursor.fetchone()[0]
+
+ cursor.execute("INSERT INTO `products`(`id`,`shop_id`,`name`,`code`, `price`) VALUES (NULL,?,?,?,?);", \
+ (shop_id, product['name'], product['code'], product['price']))
+ db.commit()
+ db.close()
+ return jsonify({'status': 'OK'})
+
+
if __name__ == '__main__':
initDB()
app.run(host="0.0.0.0")
diff --git a/src/assets/ghost-blog.css b/src/assets/ghost-blog.css
index 772598c..e8ce731 100644
--- a/src/assets/ghost-blog.css
+++ b/src/assets/ghost-blog.css
@@ -41,6 +41,9 @@ p.block {
color: lightslategray;
}
+.message.is-info{
+ background-color: #191b1f;
+}
/*
.message-header {
background: white;
diff --git a/src/components/ShopNav.vue b/src/components/ShopNav.vue
index 2fb132e..c802e1c 100644
--- a/src/components/ShopNav.vue
+++ b/src/components/ShopNav.vue
@@ -47,7 +47,7 @@ export default {
店家收款紀錄
-
+
diff --git a/src/router/index.js b/src/router/index.js
index abb3a79..2e383a5 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -14,6 +14,7 @@ import ShopLogView from '../views/ShopLogView.vue'
import OrderView from '../views/OrderView.vue'
import ClientLogView from '../views/ClientLogView.vue'
import ClientRepayView from '../views/ClientRepayView.vue'
+import ShopManageView from '../views/ShopManageView.vue'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
@@ -93,6 +94,11 @@ const router = createRouter({
name: 'repay',
component: ClientRepayView
},
+ {
+ path: '/shop/manage',
+ name: 'shopmanage',
+ component: ShopManageView
+ },
]
})
diff --git a/src/views/ClientMainView.vue b/src/views/ClientMainView.vue
index 077cf3b..9e3506b 100644
--- a/src/views/ClientMainView.vue
+++ b/src/views/ClientMainView.vue
@@ -133,7 +133,7 @@ export default {
-
+
店家商品管理
diff --git a/src/views/ShopManageView.vue b/src/views/ShopManageView.vue
new file mode 100644
index 0000000..bc187ab
--- /dev/null
+++ b/src/views/ShopManageView.vue
@@ -0,0 +1,195 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | 商品清單 |
+
+
+ | 商品名稱 |
+ 價格 |
+ 條碼編號 |
+
+
+
+
+
+ | {{ product['name'] }} |
+ {{ this.web3.utils.fromWei(product['price']) }} ETH |
+ {{ index }} |
+
+
+
+
+
+
+
+
+
+
+
+
+
+