123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- <template>
- <!-- 拆单订单 -->
- <view class='splitOrder' v-if="splitGoods.length">
- <view class="all" v-if="select_all">
- <checkbox-group @change="checkboxAllChange">
- <checkbox value="all" :checked="isAllSelect" />
- <text class='checkAll'>全选</text>
- </checkbox-group>
- </view>
- <checkbox-group @change="checkboxChange">
- <block v-for="(item,index) in splitGoods" :key="index">
- <view class='items acea-row row-between-wrapper'>
- <!-- #ifndef MP -->
- <checkbox :value="(item.id).toString()" :checked="item.checked" />
- <!-- #endif -->
- <!-- #ifdef MP -->
- <checkbox :value="item.id" :checked="item.checked"/>
- <!-- #endif -->
- <view class='picTxt acea-row row-between-wrapper'>
- <view class='pictrue'>
- <image :src='item.cart_info.productInfo.image'></image>
- </view>
- <view class='text'>
- <view class="acea-row row-between-wrapper">
- <view class='name line1'>{{item.cart_info.productInfo.store_name}}</view>
- <view>×{{item.cart_num}}</view>
- </view>
- <view class='infor line1'>
- 属性:{{item.cart_info.productInfo.attrInfo.suk || '默认'}}</view>
- <view class='money'>¥{{item.cart_info.truePrice}}</view>
- </view>
- <view class='carnum acea-row row-center-wrapper'>
- <view class="reduce" :class="item.surplus_num == 1 ? 'on' : ''"
- @click.stop='subCart(item)'>-</view>
- <view class='num'>{{item.surplus_num}}</view>
- <view class="plus" :class="item.surplus_num == item.numShow ? 'on' : ''"
- @click.stop='addCart(item)'>+</view>
- </view>
- </view>
- </view>
- </block>
- </checkbox-group>
- </view>
- </template>
- <script>
- export default {
- props:{
- splitGoods: {
- type: Array,
- default: () => []
- },
- select_all: {
- type: Boolean,
- default: true
- }
- },
- data() {
- return {
- isAllSelect:false
- };
- },
- mounted(){
-
- },
- methods: {
- subCart(item){
- item.surplus_num = Number(item.surplus_num) - 1;
- if(item.surplus_num<=1){
- item.surplus_num = 1
- }
- this.$emit('getList',this.splitGoods);
- },
- addCart(item){
- item.surplus_num = Number(item.surplus_num) + 1;
- if(item.surplus_num>=item.numShow){
- item.surplus_num = item.numShow
- }
- this.$emit('getList',this.splitGoods);
- },
- inArray: function(search, array) {
- for (let i in array) {
- if (array[i] == search) {
- return true;
- }
- }
- return false;
- },
- checkboxChange(event){
- let idList = event.detail.value;
- this.splitGoods.forEach((item)=>{
- if(this.inArray(item.id, idList)){
- item.checked = true;
- }else{
- item.checked = false;
- }
- })
- this.$emit('getList',this.splitGoods);
- if(idList.length == this.splitGoods.length){
- this.isAllSelect = true;
- }else{
- this.isAllSelect = false;
- }
- },
- forGoods(val){
- let that = this;
- if(!that.splitGoods.length) return
- that.splitGoods.forEach((item)=>{
- if(val){
- item.checked = true;
- }else{
- item.checked = false;
- }
- })
- that.$emit('getList',that.splitGoods);
- },
- checkboxAllChange(event){
- let value = event.detail.value;
- if(value.length){
- this.forGoods(1)
- }else{
- this.forGoods(0)
- }
- }
- }
- }
- </script>
- <style lang="scss">
-
- .splitOrder {
- border-bottom: 1px solid #f0f0f0;
- }
-
- .splitOrder .all{
- padding: 20rpx 30rpx;
- }
-
- .splitOrder .all .checkAll{
- margin-left: 20rpx;
- }
-
- .splitOrder .items {
- padding: 25rpx 30rpx;
- background-color: #fff;
- margin-bottom: 15rpx;
- }
-
- .splitOrder .items .picTxt {
- width: 627rpx;
- position: relative;
- }
-
- .splitOrder .items .picTxt .name{
- width: 360rpx;
- }
-
- .splitOrder .items .picTxt .pictrue {
- width: 160rpx;
- height: 160rpx;
- }
-
- .splitOrder .items .picTxt .pictrue image {
- width: 100%;
- height: 100%;
- border-radius: 6rpx;
- }
-
- .splitOrder .items .picTxt .text {
- width: 444rpx;
- font-size: 28rpx;
- color: #282828;
- }
-
- .splitOrder .items .picTxt .text .reColor {
- color: #999;
- }
-
- .splitOrder .items .picTxt .text .reElection {
- margin-top: 20rpx;
- }
-
- .splitOrder .items .picTxt .text .reElection .title {
- font-size: 24rpx;
- }
-
- .splitOrder .items .picTxt .text .reElection .reBnt {
- width: 120rpx;
- height: 46rpx;
- border-radius: 23rpx;
- font-size: 26rpx;
- }
-
- .splitOrder .items .picTxt .text .infor {
- font-size: 24rpx;
- color: #868686;
- margin-top: 16rpx;
- }
-
- .splitOrder .items .picTxt .text .money {
- font-size: 32rpx;
- color: #282828;
- margin-top: 28rpx;
- }
-
- .splitOrder .items .picTxt .carnum {
- height: 47rpx;
- position: absolute;
- bottom: 7rpx;
- right: 0;
- }
-
- .splitOrder .items .picTxt .carnum view {
- border: 1rpx solid #a4a4a4;
- width: 66rpx;
- text-align: center;
- height: 100%;
- line-height: 40rpx;
- font-size: 28rpx;
- color: #a4a4a4;
- }
-
- .splitOrder .items .picTxt .carnum .reduce {
- border-right: 0;
- border-radius: 3rpx 0 0 3rpx;
- }
-
- .splitOrder .items .picTxt .carnum .reduce.on {
- border-color: #e3e3e3;
- color: #dedede;
- }
-
- .splitOrder .items .picTxt .carnum .plus {
- border-left: 0;
- border-radius: 0 3rpx 3rpx 0;
- }
-
- .splitOrder .items .picTxt .carnum .plus.on {
- border-color: #e3e3e3;
- color: #dedede;
- }
-
- .splitOrder .items .picTxt .carnum .num {
- color: #282828;
- }
- </style>
|