From 7fa5db70ca49598f74d0eec98a8d9f3cf135f420 Mon Sep 17 00:00:00 2001 From: liudianxin Date: Fri, 15 May 2020 12:13:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=E4=B8=AD=E9=80=BB=E8=BE=91=E6=B7=B7=E4=B9=B1=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=AF=BC=E8=88=AA=E6=A0=8F=E4=B8=AD?= =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/shopping_cart_list.json | 41 ++ src/components/commodity-cell.vue | 2 +- src/components/menu.vue | 411 ++++++++++++------ .../shopping-cart/shopping-cart-cell.vue | 84 +++- .../shopping-cart/shopping-cart-com.vue | 45 +- .../shopping-cart/shopping-cart-list.vue | 8 + 6 files changed, 440 insertions(+), 151 deletions(-) create mode 100644 docs/shopping_cart_list.json diff --git a/docs/shopping_cart_list.json b/docs/shopping_cart_list.json new file mode 100644 index 0000000..47fcbc1 --- /dev/null +++ b/docs/shopping_cart_list.json @@ -0,0 +1,41 @@ +{ + "data": { + "list": [ + { + "id": 0, + "name": "水路货物周转量情况", + "type": "基础数据服务", + "creator": "贵州省交通运输厅0", + "state": 1, + "mapService": 1, + "num": 2, + "checkedSubscription": false, + "specification": 1, + "specificationApplication": 2 + }, + { + "id": 1, + "name": "水路货物周转量情况水路货物周水路货物周转量情况水路货物周", + "type": "基础数据服务", + "creator": "贵州省交通运输厅1", + "state": 1, + "num": 2, + "checkedSubscription": false, + "specification": 1, + "specificationApplication": 2 + }, + { + "id": 2, + "name": "水路货物周转量情况水路货物周转量情况", + "type": "基础数据服务", + "creator": "贵州省交通运输厅2", + "state": 1, + "mapService": 1, + "num": 2, + "checkedSubscription": true, + "specification": 1, + "specificationApplication": 2 + } + ] + } +} \ No newline at end of file diff --git a/src/components/commodity-cell.vue b/src/components/commodity-cell.vue index 5258723..d7b5605 100644 --- a/src/components/commodity-cell.vue +++ b/src/components/commodity-cell.vue @@ -150,7 +150,7 @@ export default { font-size: 12px; font-weight: 500; line-height: 12px; - border-radius: 15px; + border-radius: 4px; position: relative; top: -2px; } diff --git a/src/components/menu.vue b/src/components/menu.vue index 0c7d2f4..75d8877 100644 --- a/src/components/menu.vue +++ b/src/components/menu.vue @@ -1,140 +1,307 @@ \ No newline at end of file diff --git a/src/components/shopping-cart/shopping-cart-cell.vue b/src/components/shopping-cart/shopping-cart-cell.vue index 3a0eaa6..703d5a9 100644 --- a/src/components/shopping-cart/shopping-cart-cell.vue +++ b/src/components/shopping-cart/shopping-cart-cell.vue @@ -15,18 +15,18 @@ />
- {{ cellItem.name }} + {{ cellItems.name }} mapService - 共享 - 受限 + 共享 + 受限 敏感
-
{{ cellItem.type }}
-
{{ cellItem.creator }}
+
{{ cellItems.type }}
+
{{ cellItems.creator }}
@@ -34,10 +34,19 @@
-
规格:{{ specificationBtns[specification] }}
-
申请方式:{{ specificationApplicationBtns[specificationApplication] }}
+
规格:{{ specificationBtns[cellItems.specification] }}
+
申请方式:{{ specificationApplicationBtns[cellItems.specificationApplication] }}
- +
规格:
@@ -56,7 +65,7 @@ :key="'specification' + index" :class="specificationApplicationPop == index ? 'shopping_cell_specification_btn active' : 'shopping_cell_specification_btn'" size="mini" - @click="changeSpecificationApplication(index)" + @click="changeSpecificationApplication(index)" >{{ item }}购买
@@ -82,12 +91,22 @@
- + - 订阅该服务 + 订阅该服务
- 删除 + 删除
@@ -112,16 +131,20 @@ export default { watch: { cellCheck: function(val) { this.checkedItem = val; + }, + cellItem: { + immediate: true, // 这句重要 + handler(val) { + this.cellItems = val; + } } }, data: () => ({ + cellItems: {}, checkedItem: false, - numItem: 1, specificationEdit: require("../../assets/imgs/ic_edit.png"), checkedSubscription: false, visible: false, - specification: 1, - specificationApplication: 0, specificationPop: 1, specificationApplicationPop: 0, specificationBtns: [ @@ -143,13 +166,32 @@ export default { this.specificationApplicationPop = val; }, submitPop() { - this.specification = this.specificationPop; - this.specificationApplication = this.specificationApplicationPop; + this.cellItems.specification = this.specificationPop; + this.cellItems.specificationApplication = this.specificationApplicationPop; this.visible = false; + this.changeCellItem(); }, setSpecificationPop() { - this.specificationPop = this.specification; - this.specificationApplicationPop = this.specificationApplication; + this.specificationPop = this.cellItems.specification; + this.specificationApplicationPop = this.cellItems.specificationApplication; + }, + changeSubscription(val) { + this.changeCellItem(); + }, + changeNum(val) { + this.changeCellItem(); + }, + changeCellItem() { + this.$emit("changeCellMsg", { + index: this.cellIndex, + data: this.cellItems + }); + }, + delCellItem() { + this.$emit("deleteItem", { + index: this.cellIndex, + data: this.cellItems + }); } }, mounted() {} @@ -229,7 +271,7 @@ export default { font-size: 12px; font-weight: 500; line-height: 12px; - border-radius: 15px; + border-radius: 4px; position: relative; top: -2px; } diff --git a/src/components/shopping-cart/shopping-cart-com.vue b/src/components/shopping-cart/shopping-cart-com.vue index f931e9e..de27abb 100644 --- a/src/components/shopping-cart/shopping-cart-com.vue +++ b/src/components/shopping-cart/shopping-cart-com.vue @@ -8,7 +8,7 @@ 服务信息 规格 - 数量 + 购买时长 操作
@@ -19,6 +19,8 @@ :checkList="checkList" :readOnly="false" @changeState="changeState" + @changeCellMsg="changeCellMsg" + @deleteItem="deleteItem" class="shopping_all_list" />
@@ -45,8 +47,12 @@ {{ getNum }}
- 一键申请 - 一键申请 + 一键申请 + 一键申请 @@ -71,14 +77,22 @@ export default { type: "基础数据服务", creator: "贵州省交通运输厅0", state: 1, - mapService: 1 + mapService: 1, + num: 2, + checkedSubscription: false, + specification: 1, + specificationApplication: 2 }, { id: 1, name: "水路货物周转量情况水路货物周水路货物周转量情况水路货物周", type: "基础数据服务", creator: "贵州省交通运输厅1", - state: 1 + state: 1, + num: 2, + checkedSubscription: false, + specification: 1, + specificationApplication: 2 }, { id: 2, @@ -86,7 +100,11 @@ export default { type: "基础数据服务", creator: "贵州省交通运输厅2", state: 1, - mapService: 1 + mapService: 1, + num: 2, + checkedSubscription: true, + specification: 1, + specificationApplication: 2 } ] }), @@ -119,6 +137,19 @@ export default { console.log(this.list[index]); } }); + }, + changeCellMsg(val) { + console.log(val); + }, + deleteItem(val) { + console.log(val); + }, + oneClickApplication() { + this.checkList.forEach((item, index) => { + if (item === true) { + console.log(this.list[index]); + } + }); } } }; @@ -194,7 +225,7 @@ export default { .shopping_all_head { background-color: #e5f0ff; height: 48px; - padding: 0 20px; + padding: 0; font-weight: 700; line-height: 48px; } diff --git a/src/components/shopping-cart/shopping-cart-list.vue b/src/components/shopping-cart/shopping-cart-list.vue index c99d996..9485f9e 100644 --- a/src/components/shopping-cart/shopping-cart-list.vue +++ b/src/components/shopping-cart/shopping-cart-list.vue @@ -9,6 +9,8 @@ :key="item.id" :readOnly="readOnly" @changeState="changeState" + @changeCellMsg="changeCellMsg" + @deleteItem="deleteItem" /> @@ -58,6 +60,12 @@ export default { for (let i = 0; i < this.checkLists.length; i++) { this.$set(this.checkLists, i, val) } + }, + changeCellMsg(val) { + this.$emit("changeCellMsg", val) + }, + deleteItem(val) { + this.$emit("deleteItem", val) } } }; -- 2.26.0