|
@@ -1,291 +1,55 @@
|
|
|
<template>
|
|
|
<view class="shopping-cart">
|
|
|
- <view class="shopping-cart-item">
|
|
|
+ <view class="shopping-cart-item" v-for="seller in cart">
|
|
|
<view class="shopping-cart-item-head">
|
|
|
- <view class="select"><checkbox class="checkbox" value="cb" checked="true" /></view>
|
|
|
- <view class="factory-name">省心一号工厂</view>
|
|
|
- </view>
|
|
|
- <view class="shopping-cart-info">
|
|
|
- <view class="product-item">
|
|
|
- <view class="select"><checkbox class="checkbox" value="cb" checked="true" /></view>
|
|
|
-
|
|
|
- <view class="product-image">
|
|
|
- <image class="image" src="https://img.alicdn.com/imgextra/i1/392147177/O1CN01Bh2NP022t7Dv5zazW_!!392147177.jpg"
|
|
|
- mode="scaleToFill"></image>
|
|
|
- </view>
|
|
|
- <view class="product-info">
|
|
|
- <view class="row row-1">
|
|
|
- <text class="title"><text class="sxzg-icon">省心直供</text>白金打开链接分厘卡圣诞节防空雷达数据</text>
|
|
|
- </view>
|
|
|
- <view class="row">
|
|
|
- <view class="spec">白色</view>
|
|
|
- </view>
|
|
|
- <view class="row row-2">
|
|
|
- <text class="org-price">¥2.9</text>
|
|
|
- </view>
|
|
|
- <view class="row">
|
|
|
- <text class="sxj-icon">省心价</text>
|
|
|
- <text class="price">¥1.99</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="counter">
|
|
|
- <view class="sub">-</view>
|
|
|
- <input class="num" type="text" value="0" />
|
|
|
- <view class="plus">+</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="product-item">
|
|
|
- <view class="select"><checkbox class="checkbox" value="cb" checked="true" /></view>
|
|
|
-
|
|
|
- <view class="product-image">
|
|
|
- <image class="image" src="https://img.alicdn.com/imgextra/i1/392147177/O1CN01Bh2NP022t7Dv5zazW_!!392147177.jpg"
|
|
|
- mode="scaleToFill"></image>
|
|
|
- </view>
|
|
|
- <view class="product-info">
|
|
|
- <view class="row row-1">
|
|
|
- <text class="title"><text class="sxzg-icon">省心直供</text>白金打开链接分厘卡圣诞节防空雷达数据</text>
|
|
|
- </view>
|
|
|
- <view class="row">
|
|
|
- <view class="spec">白色</view>
|
|
|
- </view>
|
|
|
- <view class="row row-2">
|
|
|
- <text class="org-price">¥2.9</text>
|
|
|
- </view>
|
|
|
- <view class="row">
|
|
|
- <text class="sxj-icon">省心价</text>
|
|
|
- <text class="price">¥1.99</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="counter">
|
|
|
- <view class="sub">-</view>
|
|
|
- <input class="num" type="text" value="0" />
|
|
|
- <view class="plus">+</view>
|
|
|
- </view>
|
|
|
+ <view class="select">
|
|
|
+ <checkbox class="checkbox" :checked="seller.checked" @tap="selectSeller(seller.seller_id)" />
|
|
|
</view>
|
|
|
- <view class="product-item">
|
|
|
- <view class="select"><checkbox class="checkbox" value="cb" checked="true" /></view>
|
|
|
-
|
|
|
- <view class="product-image">
|
|
|
- <image class="image" src="https://img.alicdn.com/imgextra/i1/392147177/O1CN01Bh2NP022t7Dv5zazW_!!392147177.jpg"
|
|
|
- mode="scaleToFill"></image>
|
|
|
- </view>
|
|
|
- <view class="product-info">
|
|
|
- <view class="row row-1">
|
|
|
- <text class="title"><text class="sxzg-icon">省心直供</text>白金打开链接分厘卡圣诞节防空雷达数据</text>
|
|
|
- </view>
|
|
|
- <view class="row">
|
|
|
- <view class="spec">白色</view>
|
|
|
- </view>
|
|
|
- <view class="row row-2">
|
|
|
- <text class="org-price">¥2.9</text>
|
|
|
- </view>
|
|
|
- <view class="row">
|
|
|
- <text class="sxj-icon">省心价</text>
|
|
|
- <text class="price">¥1.99</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="counter">
|
|
|
- <view class="sub">-</view>
|
|
|
- <input class="num" type="text" value="0" />
|
|
|
- <view class="plus">+</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
-
|
|
|
- <view class="shopping-cart-item">
|
|
|
- <view class="shopping-cart-item-head">
|
|
|
- <view class="checkbox"></view>
|
|
|
- <view class="factory-name">省心一号工厂</view>
|
|
|
+ <view class="factory-name">{{seller.seller_nickname?seller.seller_nickname:'省心直供(该厂家暂未设置昵称)'}}</view>
|
|
|
</view>
|
|
|
<view class="shopping-cart-info">
|
|
|
- <view class="product-item">
|
|
|
- <view class="select"><checkbox class="checkbox" value="cb" checked="true" /></view>
|
|
|
-
|
|
|
- <view class="product-image">
|
|
|
- <image class="image" src="https://img.alicdn.com/imgextra/i1/392147177/O1CN01Bh2NP022t7Dv5zazW_!!392147177.jpg"
|
|
|
- mode="scaleToFill"></image>
|
|
|
- </view>
|
|
|
- <view class="product-info">
|
|
|
- <view class="row row-1">
|
|
|
- <text class="title"><text class="sxzg-icon">省心直供</text>白金打开链接分厘卡圣诞节防空雷达数据</text>
|
|
|
- </view>
|
|
|
- <view class="row">
|
|
|
- <view class="spec">白色</view>
|
|
|
- </view>
|
|
|
- <view class="row row-2">
|
|
|
- <text class="org-price">¥2.9</text>
|
|
|
- </view>
|
|
|
- <view class="row">
|
|
|
- <text class="sxj-icon">省心价</text>
|
|
|
- <text class="price">¥1.99</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="counter">
|
|
|
- <view class="sub">-</view>
|
|
|
- <input class="num" type="text" value="0" />
|
|
|
- <view class="plus">+</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="product-item">
|
|
|
- <view class="select"><checkbox class="checkbox" value="cb" checked="true" /></view>
|
|
|
-
|
|
|
- <view class="product-image">
|
|
|
- <image class="image" src="https://img.alicdn.com/imgextra/i1/392147177/O1CN01Bh2NP022t7Dv5zazW_!!392147177.jpg"
|
|
|
- mode="scaleToFill"></image>
|
|
|
- </view>
|
|
|
- <view class="product-info">
|
|
|
- <view class="row row-1">
|
|
|
- <text class="title"><text class="sxzg-icon">省心直供</text>白金打开链接分厘卡圣诞节防空雷达数据</text>
|
|
|
- </view>
|
|
|
- <view class="row">
|
|
|
- <view class="spec">白色</view>
|
|
|
- </view>
|
|
|
- <view class="row row-2">
|
|
|
- <text class="org-price">¥2.9</text>
|
|
|
- </view>
|
|
|
- <view class="row">
|
|
|
- <text class="sxj-icon">省心价</text>
|
|
|
- <text class="price">¥1.99</text>
|
|
|
- </view>
|
|
|
+ <view class="product-item" v-for="product in seller.products">
|
|
|
+ <view class="select">
|
|
|
+ <checkbox class="checkbox" :checked="product.checked"
|
|
|
+ @tap="select(product.id,product.spec_index)" />
|
|
|
</view>
|
|
|
- <view class="counter">
|
|
|
- <view class="sub">-</view>
|
|
|
- <input class="num" type="text" value="0" />
|
|
|
- <view class="plus">+</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="product-item">
|
|
|
- <view class="select"><checkbox class="checkbox" value="cb" checked="true" /></view>
|
|
|
|
|
|
<view class="product-image">
|
|
|
- <image class="image" src="https://img.alicdn.com/imgextra/i1/392147177/O1CN01Bh2NP022t7Dv5zazW_!!392147177.jpg"
|
|
|
- mode="scaleToFill"></image>
|
|
|
+ <image class="image" :src="product.spec_image|imagesFilter" mode="scaleToFill"></image>
|
|
|
</view>
|
|
|
<view class="product-info">
|
|
|
<view class="row row-1">
|
|
|
- <text class="title"><text class="sxzg-icon">省心直供</text>白金打开链接分厘卡圣诞节防空雷达数据</text>
|
|
|
+ <text class="title"><text class="sxzg-icon">省心直供</text>{{product.name}}</text>
|
|
|
</view>
|
|
|
<view class="row">
|
|
|
- <view class="spec">白色</view>
|
|
|
+ <view class="spec">{{product.spec_name}}</view>
|
|
|
</view>
|
|
|
<view class="row row-2">
|
|
|
- <text class="org-price">¥2.9</text>
|
|
|
+ <text class="org-price">¥{{product.spec_org_price}}</text>
|
|
|
</view>
|
|
|
<view class="row">
|
|
|
<text class="sxj-icon">省心价</text>
|
|
|
- <text class="price">¥1.99</text>
|
|
|
+ <text class="price">¥{{product.spec_price}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="counter">
|
|
|
- <view class="sub">-</view>
|
|
|
- <input class="num" type="text" value="0" />
|
|
|
- <view class="plus">+</view>
|
|
|
+ <view class="sub" @tap="subnum(product.id,product.num,product.spec_index)">-</view>
|
|
|
+ <input class="num" type="text" v-model="product.num" />
|
|
|
+ <view class="plus" @tap="plusnum(product.id,product.num,product.spec_index)">+</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
- <view class="shopping-cart-item">
|
|
|
- <view class="shopping-cart-item-head">
|
|
|
- <view class="checkbox"></view>
|
|
|
- <view class="factory-name">省心一号工厂</view>
|
|
|
- </view>
|
|
|
- <view class="shopping-cart-info">
|
|
|
- <view class="product-item">
|
|
|
- <view class="select"><checkbox class="checkbox" value="cb" checked="true" /></view>
|
|
|
|
|
|
- <view class="product-image">
|
|
|
- <image class="image" src="https://img.alicdn.com/imgextra/i1/392147177/O1CN01Bh2NP022t7Dv5zazW_!!392147177.jpg"
|
|
|
- mode="scaleToFill"></image>
|
|
|
- </view>
|
|
|
- <view class="product-info">
|
|
|
- <view class="row row-1">
|
|
|
- <text class="title"><text class="sxzg-icon">省心直供</text>白金打开链接分厘卡圣诞节防空雷达数据</text>
|
|
|
- </view>
|
|
|
- <view class="row">
|
|
|
- <view class="spec">白色</view>
|
|
|
- </view>
|
|
|
- <view class="row row-2">
|
|
|
- <text class="org-price">¥2.9</text>
|
|
|
- </view>
|
|
|
- <view class="row">
|
|
|
- <text class="sxj-icon">省心价</text>
|
|
|
- <text class="price">¥1.99</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="counter">
|
|
|
- <view class="sub">-</view>
|
|
|
- <input class="num" type="text" value="0" />
|
|
|
- <view class="plus">+</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="product-item">
|
|
|
- <view class="select"><checkbox class="checkbox" value="cb" checked="true" /></view>
|
|
|
-
|
|
|
- <view class="product-image">
|
|
|
- <image class="image" src="https://img.alicdn.com/imgextra/i1/392147177/O1CN01Bh2NP022t7Dv5zazW_!!392147177.jpg"
|
|
|
- mode="scaleToFill"></image>
|
|
|
- </view>
|
|
|
- <view class="product-info">
|
|
|
- <view class="row row-1">
|
|
|
- <text class="title"><text class="sxzg-icon">省心直供</text>白金打开链接分厘卡圣诞节防空雷达数据</text>
|
|
|
- </view>
|
|
|
- <view class="row">
|
|
|
- <view class="spec">白色</view>
|
|
|
- </view>
|
|
|
- <view class="row row-2">
|
|
|
- <text class="org-price">¥2.9</text>
|
|
|
- </view>
|
|
|
- <view class="row">
|
|
|
- <text class="sxj-icon">省心价</text>
|
|
|
- <text class="price">¥1.99</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="counter">
|
|
|
- <view class="sub">-</view>
|
|
|
- <input class="num" type="text" value="0" />
|
|
|
- <view class="plus">+</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="product-item">
|
|
|
- <view class="select"><checkbox class="checkbox" value="cb" checked="true" /></view>
|
|
|
-
|
|
|
- <view class="product-image">
|
|
|
- <image class="image" src="https://img.alicdn.com/imgextra/i1/392147177/O1CN01Bh2NP022t7Dv5zazW_!!392147177.jpg"
|
|
|
- mode="scaleToFill"></image>
|
|
|
- </view>
|
|
|
- <view class="product-info">
|
|
|
- <view class="row row-1">
|
|
|
- <text class="title"><text class="sxzg-icon">省心直供</text>白金打开链接分厘卡圣诞节防空雷达数据</text>
|
|
|
- </view>
|
|
|
- <view class="row">
|
|
|
- <view class="spec">白色</view>
|
|
|
- </view>
|
|
|
- <view class="row row-2">
|
|
|
- <text class="org-price">¥2.9</text>
|
|
|
- </view>
|
|
|
- <view class="row">
|
|
|
- <text class="sxj-icon">省心价</text>
|
|
|
- <text class="price">¥1.99</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="counter">
|
|
|
- <view class="sub">-</view>
|
|
|
- <input class="num" type="text" value="0" />
|
|
|
- <view class="plus">+</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
|
|
|
<view class="footer">
|
|
|
<view class="select-all">
|
|
|
- <label>
|
|
|
- <checkbox color="#ff5d5b" class="checkbox" value="cb" checked="true" />全选
|
|
|
+ <label @tap="selectAll()">
|
|
|
+ <checkbox color="#ff5d5b" class="checkbox" :checked="checkall" />全选
|
|
|
</label>
|
|
|
</view>
|
|
|
- <view class="total">合计 <text>¥26.26</text></view>
|
|
|
+ <view class="total">合计 <text>¥{{total}}</text></view>
|
|
|
<view class="settlement"><button class="settlement-btn" type="default">结算</button></view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -293,14 +57,76 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import {
|
|
|
+ mapState
|
|
|
+ } from 'vuex'
|
|
|
+
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
-
|
|
|
+ checkall: false
|
|
|
}
|
|
|
},
|
|
|
+ computed: mapState({
|
|
|
+ cart: state => state.cart,
|
|
|
+ total() {
|
|
|
+ return this.$store.getters['cart/total']
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ onLoad() {
|
|
|
+ // uni.removeStorageSync("cart")
|
|
|
+ },
|
|
|
methods: {
|
|
|
-
|
|
|
+ selectSeller(seller_id) {
|
|
|
+ this.$store.commit("cart/selectSeller", {
|
|
|
+ seller_id: seller_id
|
|
|
+ })
|
|
|
+ },
|
|
|
+ select(id, spec_index) {
|
|
|
+ this.$store.commit("cart/select", {
|
|
|
+ id: id,
|
|
|
+ spec_index: spec_index
|
|
|
+ })
|
|
|
+ },
|
|
|
+ selectAll() {
|
|
|
+ this.checkall = !this.checkall;
|
|
|
+ this.$store.commit("cart/selectAll", {
|
|
|
+ checked: this.checkall
|
|
|
+ })
|
|
|
+ },
|
|
|
+ subnum(id, num, spec_index) {
|
|
|
+ if (num === 0) {
|
|
|
+ uni.showModal({
|
|
|
+ title: "移除商品",
|
|
|
+ content: "确认移除该商品?",
|
|
|
+ success: (res) => {
|
|
|
+ if (res.confirm) {
|
|
|
+ this.$store.commit("cart/remove", {
|
|
|
+ id: id,
|
|
|
+ num: num,
|
|
|
+ spec_index: spec_index
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ num--
|
|
|
+ }
|
|
|
+ this.$store.commit("cart/numchange", {
|
|
|
+ id: id,
|
|
|
+ num: num,
|
|
|
+ spec_index: spec_index
|
|
|
+ })
|
|
|
+ },
|
|
|
+ plusnum(id, num, spec_index) {
|
|
|
+ num++
|
|
|
+ this.$store.commit("cart/numchange", {
|
|
|
+ id: id,
|
|
|
+ num: num,
|
|
|
+ spec_index: spec_index
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -325,25 +151,29 @@
|
|
|
font-weight: bold;
|
|
|
position: relative;
|
|
|
display: flex;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|
|
|
- .select{
|
|
|
+
|
|
|
+ .select {
|
|
|
align-self: center;
|
|
|
position: relative;
|
|
|
margin-top: -4upx;
|
|
|
margin-right: 20upx;
|
|
|
}
|
|
|
+
|
|
|
.checkbox {
|
|
|
transform: scale(0.7);
|
|
|
- /deep/ .uni-checkbox-input{
|
|
|
+
|
|
|
+ /deep/ .uni-checkbox-input {
|
|
|
border: 2upx solid #CCCCCC;
|
|
|
- &.uni-checkbox-input-checked{
|
|
|
- color: $primary-color!important;
|
|
|
+
|
|
|
+ &.uni-checkbox-input-checked {
|
|
|
+ color: $primary-color !important;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /deep/ .uni-checkbox-input:hover{
|
|
|
+ /deep/ .uni-checkbox-input:hover {
|
|
|
border: 2upx solid #CCCCCC;
|
|
|
}
|
|
|
}
|
|
@@ -376,7 +206,7 @@
|
|
|
-webkit-box-orient: vertical;
|
|
|
-webkit-line-clamp: 2;
|
|
|
overflow: hidden;
|
|
|
- height: 80upx;
|
|
|
+ height: 68upx;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -490,12 +320,14 @@
|
|
|
.checkbox {
|
|
|
transform: scale(0.7);
|
|
|
position: relative;
|
|
|
- top:-4upx
|
|
|
+ top: -4upx
|
|
|
}
|
|
|
- /deep/ .uni-checkbox-input{
|
|
|
+
|
|
|
+ /deep/ .uni-checkbox-input {
|
|
|
border: none;
|
|
|
}
|
|
|
- /deep/ .uni-checkbox-input:hover{
|
|
|
+
|
|
|
+ /deep/ .uni-checkbox-input:hover {
|
|
|
border: none;
|
|
|
}
|
|
|
}
|