|
@@ -4,7 +4,7 @@
|
|
<cu-custom custom bgColor="bg-gradual-blue"><view slot="content">购物车</view></cu-custom>
|
|
<cu-custom custom bgColor="bg-gradual-blue"><view slot="content">购物车</view></cu-custom>
|
|
<view class="setting">
|
|
<view class="setting">
|
|
<view class="setting-content flex align-center justify-center padding-sm bg-white">
|
|
<view class="setting-content flex align-center justify-center padding-sm bg-white">
|
|
- <view class="left text-cut text-grey">配送至河南省郑州市高新区大学科技园配送至河南省郑州市高新区大学科技园</view>
|
|
|
|
|
|
+ <view @click="addressListFunc" class="left text-cut text-grey"><text class="cuIcon-locationfill text-green"></text>配送至河南省郑州市高新区大学科技园配送至河南省郑州市高新区大学科技园</view>
|
|
<view @click="status = !status" class="right margin-left">{{ status ? '完成' : '管理' }}</view>
|
|
<view @click="status = !status" class="right margin-left">{{ status ? '完成' : '管理' }}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -13,15 +13,22 @@
|
|
<view class="section">
|
|
<view class="section">
|
|
<checkbox-group :value="group" @change="chooseShop">
|
|
<checkbox-group :value="group" @change="chooseShop">
|
|
<view v-for="(item, index) in ListValue" :key="index" class="item flex align-center bg-white radius padding">
|
|
<view v-for="(item, index) in ListValue" :key="index" class="item flex align-center bg-white radius padding">
|
|
- <checkbox :value="item" style="transform: scale(0.6);" />
|
|
|
|
|
|
+ <checkbox :value="item.id" :checked="group.some(it=>it==item.id)" style="transform: scale(0.6);" />
|
|
<view class="right flex margin-left">
|
|
<view class="right flex margin-left">
|
|
<view
|
|
<view
|
|
- :style="{ backgroundImage: 'url(' + 'https://gd-hbimg.huaban.com/d478a9c4bd0167adae79806c6ccaa2d7f59ded5dd101-WmmTdI_fw658/format/webp' + ')' }"
|
|
|
|
|
|
+ @click="detailFunc(item.commodity_details)"
|
|
|
|
+ :style="{ backgroundImage: 'url(' + item.image + ')' }"
|
|
class="image radius margin-right-sm"
|
|
class="image radius margin-right-sm"
|
|
></view>
|
|
></view>
|
|
<view class="right-right">
|
|
<view class="right-right">
|
|
- <view class="text-xl">{{ item }}</view>
|
|
|
|
- <view style="float: right;"><cu-stepper :value.sync="item" /></view>
|
|
|
|
|
|
+ <view class="text-black">{{ item.name }}</view>
|
|
|
|
+ <view class="flex justify-between margin-top-xs margin-bottom-sm">
|
|
|
|
+ <view class="text-red text-price">
|
|
|
|
+ <cu-price :value="item.price"/>
|
|
|
|
+ </view>
|
|
|
|
+ <view>{{item.point_price}}积分</view>
|
|
|
|
+ </view>
|
|
|
|
+ <view style="float: right;"><cu-stepper @change="val=>changeNum(index,val)" :value="item.quantity" /></view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -34,51 +41,55 @@
|
|
<view class="tool">
|
|
<view class="tool">
|
|
<!-- 结算 -->
|
|
<!-- 结算 -->
|
|
<view v-if="!status" class="bg-white tool-contentA flex align-center justify-center padding-lr padding-tb-sm">
|
|
<view v-if="!status" class="bg-white tool-contentA flex align-center justify-center padding-lr padding-tb-sm">
|
|
- <view class="left flex ">
|
|
|
|
- <checkbox-group @change="e => (total_lockA = !total_lockA)" class="margin-right flex align-center">
|
|
|
|
- <checkbox style="transform: scale(0.6);" />
|
|
|
|
|
|
+ <view class="left flex align-center">
|
|
|
|
+ <checkbox-group @change="totalFunc('total_lockA')" class="margin-right flex align-center">
|
|
|
|
+ <checkbox :checked="total_lockA" style="transform: scale(0.6);" />
|
|
<text class="text-lg margin-left-sm">全选</text>
|
|
<text class="text-lg margin-left-sm">全选</text>
|
|
</checkbox-group>
|
|
</checkbox-group>
|
|
<view class="text-red margin-left">
|
|
<view class="text-red margin-left">
|
|
合计:
|
|
合计:
|
|
<cu-price :value="price" size="52" />
|
|
<cu-price :value="price" size="52" />
|
|
元
|
|
元
|
|
|
|
+ <text class="margin-left-sm text-grey left">{{point_price}}积分</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
- <view class="right"><button @click="payFunc" class="cu-btn bg-red round shadow-blur">结算</button></view>
|
|
|
|
|
|
+ <view class="right"><button :disabled="bind!=1" @click="payFunc" class="cu-btn bg-red round shadow-blur">结算</button></view>
|
|
</view>
|
|
</view>
|
|
<!-- 管理 -->
|
|
<!-- 管理 -->
|
|
<view v-else class="bg-white tool-contentA flex align-center justify-center padding-lr padding-tb-sm">
|
|
<view v-else class="bg-white tool-contentA flex align-center justify-center padding-lr padding-tb-sm">
|
|
<view class="left flex ">
|
|
<view class="left flex ">
|
|
- <checkbox-group @change="e => (total_lockB = !total_lockB)" class="margin-right flex align-center">
|
|
|
|
- <checkbox style="transform: scale(0.6);" />
|
|
|
|
|
|
+ <checkbox-group @change="totalFunc('total_lockB')" class="margin-right flex align-center">
|
|
|
|
+ <checkbox :checked="total_lockB" style="transform: scale(0.6);" />
|
|
<text class="text-lg margin-left-sm">全选</text>
|
|
<text class="text-lg margin-left-sm">全选</text>
|
|
</checkbox-group>
|
|
</checkbox-group>
|
|
</view>
|
|
</view>
|
|
<view class="right">
|
|
<view class="right">
|
|
- <button class="cu-btn bg-red round shadow-blur margin-right">删除</button>
|
|
|
|
- <button class="cu-btn bg-green round shadow-blur">移入收藏</button>
|
|
|
|
|
|
+ <button :disabled="bind!=1" class="cu-btn bg-red round shadow-blur margin-right">删除</button>
|
|
|
|
+ <button :disabled="bind!=1" class="cu-btn bg-green round shadow-blur">移入收藏</button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
- <cu-bar active="2" />
|
|
|
|
|
|
+ <cu-bar active="3" />
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { CustomBarHeight } from '@/common/device/index.js';
|
|
import { CustomBarHeight } from '@/common/device/index.js';
|
|
-import { mapState, mapActions } from 'vuex';
|
|
|
|
|
|
+import { mapState, mapActions ,mapMutations} from 'vuex';
|
|
|
|
+import api from "./api.js";
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- status: false, // false 管理 true 结算
|
|
|
|
|
|
+ status: false, // false 结算 true 管理
|
|
total_lockA: false, //购买 全选
|
|
total_lockA: false, //购买 全选
|
|
- total_lcokB: false, //管理 全选
|
|
|
|
|
|
+ total_lockB: false, //管理 全选
|
|
price: 0, //合计
|
|
price: 0, //合计
|
|
|
|
+ point_price:0,//积分
|
|
group: []
|
|
group: []
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
|
|
+ ...mapState(['bind']),
|
|
...mapState('requestList', ['ListValue', 'currentPage', 'totalPage']),
|
|
...mapState('requestList', ['ListValue', 'currentPage', 'totalPage']),
|
|
height() {
|
|
height() {
|
|
return `calc(100vh - 280rpx - ${CustomBarHeight}px)`;
|
|
return `calc(100vh - 280rpx - ${CustomBarHeight}px)`;
|
|
@@ -90,18 +101,73 @@ export default {
|
|
await this.requestFunc({ method: 'get', url: `/customer/order/cart/`, data: { limit: 10 } });
|
|
await this.requestFunc({ method: 'get', url: `/customer/order/cart/`, data: { limit: 10 } });
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ ...mapMutations('requestList',['changeValue']),
|
|
...mapActions('requestList', ['reset','requestFunc']),
|
|
...mapActions('requestList', ['reset','requestFunc']),
|
|
|
|
+ totalFunc(type){
|
|
|
|
+ let totalStutas=!this[type];
|
|
|
|
+ let group=[];
|
|
|
|
+ if(totalStutas) this.ListValue.forEach(item=>group.push(item.id));
|
|
|
|
+ this.group=group;
|
|
|
|
+ this[type]=totalStutas;
|
|
|
|
+ },
|
|
|
|
+ addressListFunc(){
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url:"/loginPages/addressList/index"
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ //合计
|
|
|
|
+ computer(){
|
|
|
|
+ let point_price=0,price=0;
|
|
|
|
+ if(!this.status && this.group.length>0) this.ListValue.forEach(item=>{
|
|
|
|
+ if(this.group.findIndex(it=>it==item.id)!=-1){
|
|
|
|
+ point_price+=item.point_price*1*item.quantity;
|
|
|
|
+ price+=item.price*1*item.quantity;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ this.point_price=point_price;
|
|
|
|
+ this.price=price;
|
|
|
|
+ },
|
|
|
|
+ detailFunc(id){
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url:`/pages/detail/index?id=${id}`
|
|
|
|
+ })
|
|
|
|
+ },
|
|
chooseShop(e) {
|
|
chooseShop(e) {
|
|
- console.log(e);
|
|
|
|
|
|
+ let {value}=e.detail;
|
|
|
|
+ if(value.length==this.ListValue.length) {
|
|
|
|
+ if(this.status){
|
|
|
|
+ this.total_lockB=true;
|
|
|
|
+ }else{
|
|
|
|
+ this.total_lockA=true;
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ if(this.status){
|
|
|
|
+ this.total_lockB=false;
|
|
|
|
+ }else{
|
|
|
|
+ this.total_lockA=false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.group=value;
|
|
|
|
+ },
|
|
|
|
+ // 更改商品数量
|
|
|
|
+ async changeNum(index,val){
|
|
|
|
+ let ListValue=JSON.parse(JSON.stringify(this.ListValue));
|
|
|
|
+ let {id}=ListValue[index];
|
|
|
|
+ var result =await api.quantity({id,quantity:val});
|
|
|
|
+ if(result.code===0){
|
|
|
|
+ ListValue[index]['quantity']=val;
|
|
|
|
+ this.changeValue(ListValue);
|
|
|
|
+ this.computer();
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// 下拉刷新
|
|
// 下拉刷新
|
|
async refresherpulling() {
|
|
async refresherpulling() {
|
|
await this.reset();
|
|
await this.reset();
|
|
- await this.requestFunc({ method: 'get', url: `/customer/order/cart/ `, data: { limit: 10 } });
|
|
|
|
|
|
+ await this.requestFunc({ method: 'get', url: `/customer/order/cart/`, data: { limit: 10 } });
|
|
},
|
|
},
|
|
// 上拉加载
|
|
// 上拉加载
|
|
async scroll() {
|
|
async scroll() {
|
|
- await this.requestFunc({ method: 'get', url: `/customer/order/cart/ `, data: { limit: 10 } });
|
|
|
|
|
|
+ await this.requestFunc({ method: 'get', url: `/customer/order/cart/`, data: { limit: 10 } });
|
|
},
|
|
},
|
|
payFunc() {
|
|
payFunc() {
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
@@ -110,12 +176,17 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
|
|
+ group:{
|
|
|
|
+ handler(newVal,oldVal){
|
|
|
|
+ this.computer();
|
|
|
|
+ },
|
|
|
|
+ deep:true
|
|
|
|
+ },
|
|
status: {
|
|
status: {
|
|
handler(newVal, oldVal) {
|
|
handler(newVal, oldVal) {
|
|
- // console.log(this.$store.state.requestList.value)
|
|
|
|
- // if(newVal){
|
|
|
|
- // this.group= this.total_lockA ? this.
|
|
|
|
- // }
|
|
|
|
|
|
+ this.group=[];
|
|
|
|
+ this.total_lockA=false;
|
|
|
|
+ this.total_lockB=false;
|
|
},
|
|
},
|
|
deep: true
|
|
deep: true
|
|
}
|
|
}
|