功能完善
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
<image src="/static/emptyCart.jpg" mode="aspectFit"></image>
|
||||
<view v-if="hasLogin" class="empty-tips">
|
||||
空空如也
|
||||
<navigator class="navigator" v-if="hasLogin" url="../index/index" open-type="switchTab">随便逛逛></navigator>
|
||||
<navigator class="navigator" v-if="hasLogin" url="../index/index" open-type="switchTab">随便逛逛>
|
||||
</navigator>
|
||||
</view>
|
||||
<view v-else class="empty-tips">
|
||||
空空如也
|
||||
@@ -21,21 +22,18 @@
|
||||
<block v-for="(item, index) in cartList" :key="item.id">
|
||||
<view class="cart-item" :class="{ 'b-b': index !== cartList.length - 1 }">
|
||||
<view class="image-wrapper">
|
||||
<image
|
||||
:src="item.productPic"
|
||||
class="loaded"
|
||||
mode="aspectFill"
|
||||
lazy-load
|
||||
@load="onImageLoad('cartList', index)"
|
||||
@error="onImageError('cartList', index)"
|
||||
></image>
|
||||
<view class="yticon icon-xuanzhong2 checkbox" :class="{ checked: item.checked === '1' || item.checked }" @click="check('item', index)"></view>
|
||||
<image :src="item.productPic" class="loaded" mode="aspectFill" lazy-load
|
||||
@load="onImageLoad('cartList', index)" @error="onImageError('cartList', index)"></image>
|
||||
<view class="yticon icon-xuanzhong2 checkbox"
|
||||
:class="{ checked: item.checked === '1' || item.checked }"
|
||||
@click="check('item', index)"></view>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="clamp title">{{ item.productName }}</text>
|
||||
<text class="attr">{{ item.productAttr }}</text>
|
||||
<text class="price">¥{{ item.price }}</text>
|
||||
<uni-number-box class="step" :min="1" :value="item.quantity" :isMin="item.quantity === 1" :index="index" @eventChange="numberChange"></uni-number-box>
|
||||
<uni-number-box class="step" :min="1" :value="item.quantity" :isMin="item.quantity === 1"
|
||||
:index="index" @eventChange="numberChange"></uni-number-box>
|
||||
</view>
|
||||
<text class="del-btn yticon icon-fork" @click="deleteCartItem(index)"></text>
|
||||
</view>
|
||||
@@ -45,7 +43,8 @@
|
||||
<!-- 底部菜单栏 -->
|
||||
<view class="action-section">
|
||||
<view class="checkbox">
|
||||
<image :src="allChecked ? '/static/selected.png' : '/static/select.png'" mode="aspectFit" @click="check('all')"></image>
|
||||
<image :src="allChecked ? '/static/selected.png' : '/static/select.png'" mode="aspectFit"
|
||||
@click="check('all')"></image>
|
||||
<view class="clear-btn" :class="{ show: allChecked }" @click="clearCart">清空</view>
|
||||
</view>
|
||||
<view class="total-box">
|
||||
@@ -60,360 +59,391 @@
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<mallplusCopyright></mallplusCopyright>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
|
||||
import Api from '@/common/api';
|
||||
import { mapState } from 'vuex';
|
||||
import uniNumberBox from '@/components/uni-number-box.vue';
|
||||
import navBar from '@/components/zhouWei-navBar';
|
||||
export default {
|
||||
components: {
|
||||
uniNumberBox,
|
||||
navBar,
|
||||
mallplusCopyright
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
total: 0, //总价格
|
||||
allChecked: false, //全选状态 true|false
|
||||
empty: false, //空白页现实 true|false
|
||||
promoteAmount: 0,
|
||||
cartList: [],
|
||||
import mallplusCopyright from '@/components/mall-copyright/mallplusCopyright.vue';
|
||||
import Api from '@/common/api';
|
||||
import {
|
||||
mapState
|
||||
} from 'vuex';
|
||||
import uniNumberBox from '@/components/uni-number-box.vue';
|
||||
import navBar from '@/components/zhouWei-navBar';
|
||||
export default {
|
||||
components: {
|
||||
uniNumberBox,
|
||||
navBar,
|
||||
mallplusCopyright
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
total: 0, //总价格
|
||||
allChecked: false, //全选状态 true|false
|
||||
empty: false, //空白页现实 true|false
|
||||
promoteAmount: 0,
|
||||
cartList: [],
|
||||
|
||||
statusBarHeight: ''
|
||||
};
|
||||
},
|
||||
statusBarHeight: ''
|
||||
};
|
||||
},
|
||||
|
||||
async onShow() {
|
||||
if (this.hasLogin) {
|
||||
this.loadData();
|
||||
}
|
||||
},
|
||||
async onLoad() {
|
||||
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
|
||||
},
|
||||
watch: {
|
||||
//显示空白页
|
||||
cartList(e) {
|
||||
let empty = e.length === 0 ? true : false;
|
||||
if (this.empty !== empty) {
|
||||
this.empty = empty;
|
||||
async onShow() {
|
||||
if (this.hasLogin) {
|
||||
this.loadData();
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['hasLogin', 'userInfo'])
|
||||
},
|
||||
methods: {
|
||||
//请求数据
|
||||
async loadData() {
|
||||
let params = {};
|
||||
let list = await Api.apiCall('get', Api.order.cartList, params);
|
||||
// let list = await this.$api.json('cartList');
|
||||
let cartList = list.cartItemList.map(item => {
|
||||
item.checked = '1';
|
||||
return item;
|
||||
});
|
||||
this.cartList = cartList;
|
||||
this.promoteAmount = list.promoteAmount;
|
||||
this.calcTotal(); //计算总价
|
||||
},
|
||||
//监听image加载完成
|
||||
onImageLoad(key, index) {
|
||||
this.$set(this[key][index], 'loaded', 'loaded');
|
||||
async onLoad() {
|
||||
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
|
||||
},
|
||||
//监听image加载失败
|
||||
onImageError(key, index) {
|
||||
this[key][index].image = '/static/errorImage.jpg';
|
||||
watch: {
|
||||
//显示空白页
|
||||
cartList(e) {
|
||||
let empty = e.length === 0 ? true : false;
|
||||
if (this.empty !== empty) {
|
||||
this.empty = empty;
|
||||
}
|
||||
}
|
||||
},
|
||||
navToLogin() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/public/login'
|
||||
});
|
||||
computed: {
|
||||
...mapState(['hasLogin', 'userInfo'])
|
||||
},
|
||||
//选中状态处理
|
||||
check(type, index) {
|
||||
if (type === 'item') {
|
||||
this.cartList[index].checked = !this.cartList[index].checked;
|
||||
} else {
|
||||
const checked = !this.allChecked;
|
||||
const list = this.cartList;
|
||||
list.forEach(item => {
|
||||
item.checked = checked;
|
||||
methods: {
|
||||
//请求数据
|
||||
async loadData() {
|
||||
let params = {};
|
||||
let list = await Api.apiCall('get', Api.order.cartList, params);
|
||||
// let list = await this.$api.json('cartList');
|
||||
let cartList = list.cartItemList.map(item => {
|
||||
item.checked = '1';
|
||||
return item;
|
||||
});
|
||||
this.cartList = cartList;
|
||||
this.promoteAmount = list.promoteAmount;
|
||||
this.calcTotal(); //计算总价
|
||||
},
|
||||
//监听image加载完成
|
||||
onImageLoad(key, index) {
|
||||
this.$set(this[key][index], 'loaded', 'loaded');
|
||||
},
|
||||
//监听image加载失败
|
||||
onImageError(key, index) {
|
||||
this[key][index].image = '/static/errorImage.jpg';
|
||||
},
|
||||
navToLogin() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/public/login'
|
||||
});
|
||||
},
|
||||
//选中状态处理
|
||||
check(type, index) {
|
||||
if (type === 'item') {
|
||||
this.cartList[index].checked = !this.cartList[index].checked;
|
||||
} else {
|
||||
const checked = !this.allChecked;
|
||||
const list = this.cartList;
|
||||
list.forEach(item => {
|
||||
item.checked = checked;
|
||||
});
|
||||
this.allChecked = checked;
|
||||
}
|
||||
this.calcTotal(type);
|
||||
},
|
||||
//数量
|
||||
numberChange(data) {
|
||||
this.cartList[data.index].quantity = data.number;
|
||||
let params = {
|
||||
id: this.cartList[data.index].id,
|
||||
quantity: data.number
|
||||
};
|
||||
data = Api.apiCall('get', Api.order.updateQuantity, params);
|
||||
this.calcTotal();
|
||||
},
|
||||
//删除
|
||||
deleteCartItem(index) {
|
||||
var that = this;
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定将此商品移出购物车吗',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
let list = that.cartList;
|
||||
let row = list[index];
|
||||
let id = row.id;
|
||||
let params = {
|
||||
cart_id_list: id
|
||||
};
|
||||
Api.apiCall('post', Api.order.deleteCart, params);
|
||||
that.cartList.splice(index, 1);
|
||||
that.calcTotal();
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
//清空
|
||||
clearCart() {
|
||||
var that = this;
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定将购物车清空吗',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
let params = {};
|
||||
Api.apiCall('post', Api.order.clearCart, params);
|
||||
this.cartList = [];
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//计算总价
|
||||
calcTotal() {
|
||||
let list = this.cartList;
|
||||
if (list.length === 0) {
|
||||
this.empty = true;
|
||||
return;
|
||||
}
|
||||
let total = 0;
|
||||
let checked = true;
|
||||
list.forEach(item => {
|
||||
if (item.checked === true || item.checked === '1') {
|
||||
total += item.price * item.quantity;
|
||||
} else if (checked === true) {
|
||||
checked = false;
|
||||
}
|
||||
});
|
||||
total = total - this.promoteAmount;
|
||||
this.allChecked = checked;
|
||||
}
|
||||
this.calcTotal(type);
|
||||
},
|
||||
//数量
|
||||
numberChange(data) {
|
||||
this.cartList[data.index].quantity = data.number;
|
||||
let params = { id: this.cartList[data.index].id, quantity: data.number };
|
||||
data = Api.apiCall('get', Api.order.updateQuantity, params);
|
||||
this.calcTotal();
|
||||
},
|
||||
//删除
|
||||
deleteCartItem(index) {
|
||||
var that = this;
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定将此商品移出购物车吗',
|
||||
success: res => {
|
||||
if(res.confirm){
|
||||
let list = that.cartList;
|
||||
let row = list[index];
|
||||
let id = row.id;
|
||||
let params = { cart_id_list: id };
|
||||
Api.apiCall('post', Api.order.deleteCart, params);
|
||||
that.cartList.splice(index, 1);
|
||||
that.calcTotal();
|
||||
uni.hideLoading();
|
||||
this.total = Number(total.toFixed(2));
|
||||
},
|
||||
//创建订单
|
||||
createOrder() {
|
||||
let list = this.cartList;
|
||||
var ids = '';
|
||||
list.forEach(item => {
|
||||
if (item.checked === true || item.checked === '1') {
|
||||
ids = item.id + ',' + ids;
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
//清空
|
||||
clearCart() {
|
||||
var that = this;
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定将购物车清空吗',
|
||||
success: res => {
|
||||
if(res.confirm){
|
||||
let params = {};
|
||||
Api.apiCall('post', Api.order.clearCart, params);
|
||||
this.cartList = [];
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//计算总价
|
||||
calcTotal() {
|
||||
let list = this.cartList;
|
||||
if (list.length === 0) {
|
||||
this.empty = true;
|
||||
return;
|
||||
});
|
||||
let cartIds = ids.substr(0, ids.length - 1);
|
||||
let dataJson = {};
|
||||
|
||||
dataJson.type = 2;
|
||||
dataJson.cartIds = cartIds;
|
||||
let url = '/pages/order/createStoreOrder?dataJson=' + JSON.stringify(dataJson)
|
||||
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
let total = 0;
|
||||
let checked = true;
|
||||
list.forEach(item => {
|
||||
if (item.checked === true || item.checked === '1') {
|
||||
total += item.price * item.quantity;
|
||||
} else if (checked === true) {
|
||||
checked = false;
|
||||
}
|
||||
});
|
||||
total = total - this.promoteAmount;
|
||||
this.allChecked = checked;
|
||||
this.total = Number(total.toFixed(2));
|
||||
},
|
||||
//创建订单
|
||||
createOrder() {
|
||||
let list = this.cartList;
|
||||
var ids = '';
|
||||
list.forEach(item => {
|
||||
if (item.checked === true || item.checked === '1') {
|
||||
ids = item.id + ',' + ids;
|
||||
}
|
||||
});
|
||||
let cartIds = ids.substr(0, ids.length - 1);
|
||||
let dataJson ={};
|
||||
|
||||
dataJson.type=2;
|
||||
dataJson.cartIds=cartIds;
|
||||
let url='/pages/order/createStoreOrder?dataJson=' + JSON.stringify(dataJson)
|
||||
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
padding-bottom: 134upx;
|
||||
/* 空白页 */
|
||||
.empty {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
padding-bottom: 100upx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
image {
|
||||
width: 240upx;
|
||||
height: 160upx;
|
||||
margin-bottom: 30upx;
|
||||
}
|
||||
.empty-tips {
|
||||
.container {
|
||||
padding-bottom: 134upx;
|
||||
|
||||
/* 空白页 */
|
||||
.empty {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
padding-bottom: 100upx;
|
||||
display: flex;
|
||||
font-size: $font-sm + 2upx;
|
||||
color: $font-color-disabled;
|
||||
.navigator {
|
||||
color: $uni-color-primary;
|
||||
margin-left: 16upx;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
|
||||
image {
|
||||
width: 240upx;
|
||||
height: 160upx;
|
||||
margin-bottom: 30upx;
|
||||
}
|
||||
|
||||
.empty-tips {
|
||||
display: flex;
|
||||
font-size: $font-sm + 2upx;
|
||||
color: $font-color-disabled;
|
||||
|
||||
.navigator {
|
||||
color: $uni-color-primary;
|
||||
margin-left: 16upx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* 购物车列表项 */
|
||||
.cart-item {
|
||||
display: flex;
|
||||
position: relative;
|
||||
padding: 30upx 40upx;
|
||||
.image-wrapper {
|
||||
width: 230upx;
|
||||
height: 230upx;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
image {
|
||||
border-radius: 8upx;
|
||||
}
|
||||
}
|
||||
.checkbox {
|
||||
position: absolute;
|
||||
left: -16upx;
|
||||
top: -16upx;
|
||||
z-index: 8;
|
||||
font-size: 44upx;
|
||||
line-height: 1;
|
||||
padding: 4upx;
|
||||
color: $font-color-disabled;
|
||||
background: #fff;
|
||||
border-radius: 50px;
|
||||
}
|
||||
.item-right {
|
||||
|
||||
/* 购物车列表项 */
|
||||
.cart-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
padding-left: 30upx;
|
||||
.title,
|
||||
.price {
|
||||
font-size: $font-base + 2upx;
|
||||
color: $font-color-dark;
|
||||
height: 40upx;
|
||||
line-height: 40upx;
|
||||
}
|
||||
.attr {
|
||||
font-size: $font-sm + 2upx;
|
||||
color: $font-color-light;
|
||||
height: 50upx;
|
||||
line-height: 50upx;
|
||||
}
|
||||
.price {
|
||||
height: 50upx;
|
||||
line-height: 50upx;
|
||||
}
|
||||
}
|
||||
.del-btn {
|
||||
padding: 4upx 10upx;
|
||||
font-size: 34upx;
|
||||
height: 50upx;
|
||||
color: $font-color-light;
|
||||
}
|
||||
}
|
||||
/* 底部栏 */
|
||||
.action-section {
|
||||
/* #ifdef H5 */
|
||||
margin-bottom: 100upx;
|
||||
/* #endif */
|
||||
position: fixed;
|
||||
left: 30upx;
|
||||
bottom: 30upx;
|
||||
z-index: 95;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 690upx;
|
||||
height: 100upx;
|
||||
padding: 0 30upx;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
box-shadow: 0 0 20upx 0 rgba(0, 0, 0, 0.5);
|
||||
border-radius: 16upx;
|
||||
.checkbox {
|
||||
height: 52upx;
|
||||
position: relative;
|
||||
image {
|
||||
width: 52upx;
|
||||
height: 100%;
|
||||
padding: 30upx 40upx;
|
||||
|
||||
.image-wrapper {
|
||||
width: 230upx;
|
||||
height: 230upx;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
z-index: 5;
|
||||
|
||||
image {
|
||||
border-radius: 8upx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.clear-btn {
|
||||
position: absolute;
|
||||
left: 26upx;
|
||||
top: 0;
|
||||
z-index: 4;
|
||||
width: 0;
|
||||
height: 52upx;
|
||||
line-height: 52upx;
|
||||
padding-left: 38upx;
|
||||
font-size: $font-base;
|
||||
color: #fff;
|
||||
background: $font-color-disabled;
|
||||
border-radius: 0 50px 50px 0;
|
||||
opacity: 0;
|
||||
transition: 0.2s;
|
||||
&.show {
|
||||
opacity: 1;
|
||||
width: 120upx;
|
||||
|
||||
.checkbox {
|
||||
position: absolute;
|
||||
left: -16upx;
|
||||
top: -16upx;
|
||||
z-index: 8;
|
||||
font-size: 44upx;
|
||||
line-height: 1;
|
||||
padding: 4upx;
|
||||
color: $font-color-disabled;
|
||||
background: #fff;
|
||||
border-radius: 50px;
|
||||
}
|
||||
}
|
||||
.total-box {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
text-align: right;
|
||||
padding-right: 40upx;
|
||||
.price {
|
||||
font-size: $font-lg;
|
||||
color: $font-color-dark;
|
||||
|
||||
.item-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
padding-left: 30upx;
|
||||
|
||||
.title,
|
||||
.price {
|
||||
font-size: $font-base + 2upx;
|
||||
color: $font-color-dark;
|
||||
height: 40upx;
|
||||
line-height: 40upx;
|
||||
}
|
||||
|
||||
.attr {
|
||||
font-size: $font-sm + 2upx;
|
||||
color: $font-color-light;
|
||||
height: 50upx;
|
||||
line-height: 50upx;
|
||||
}
|
||||
|
||||
.price {
|
||||
height: 50upx;
|
||||
line-height: 50upx;
|
||||
}
|
||||
}
|
||||
.coupon {
|
||||
font-size: $font-sm;
|
||||
|
||||
.del-btn {
|
||||
padding: 4upx 10upx;
|
||||
font-size: 34upx;
|
||||
height: 50upx;
|
||||
color: $font-color-light;
|
||||
text {
|
||||
}
|
||||
}
|
||||
|
||||
/* 底部栏 */
|
||||
.action-section {
|
||||
/* #ifdef H5 */
|
||||
margin-bottom: 100upx;
|
||||
/* #endif */
|
||||
position: fixed;
|
||||
left: 30upx;
|
||||
bottom: 30upx;
|
||||
z-index: 95;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 690upx;
|
||||
height: 100upx;
|
||||
padding: 0 30upx;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
box-shadow: 0 0 20upx 0 rgba(0, 0, 0, 0.5);
|
||||
border-radius: 16upx;
|
||||
|
||||
.checkbox {
|
||||
height: 52upx;
|
||||
position: relative;
|
||||
|
||||
image {
|
||||
width: 52upx;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
z-index: 5;
|
||||
}
|
||||
}
|
||||
|
||||
.clear-btn {
|
||||
position: absolute;
|
||||
left: 26upx;
|
||||
top: 0;
|
||||
z-index: 4;
|
||||
width: 0;
|
||||
height: 52upx;
|
||||
line-height: 52upx;
|
||||
padding-left: 38upx;
|
||||
font-size: $font-base;
|
||||
color: #fff;
|
||||
background: $font-color-disabled;
|
||||
border-radius: 0 50px 50px 0;
|
||||
opacity: 0;
|
||||
transition: 0.2s;
|
||||
|
||||
&.show {
|
||||
opacity: 1;
|
||||
width: 120upx;
|
||||
}
|
||||
}
|
||||
|
||||
.total-box {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
text-align: right;
|
||||
padding-right: 40upx;
|
||||
|
||||
.price {
|
||||
font-size: $font-lg;
|
||||
color: $font-color-dark;
|
||||
}
|
||||
|
||||
.coupon {
|
||||
font-size: $font-sm;
|
||||
color: $font-color-light;
|
||||
|
||||
text {
|
||||
color: $font-color-dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
padding: 0 38upx;
|
||||
margin: 0;
|
||||
border-radius: 100px;
|
||||
height: 76upx;
|
||||
line-height: 76upx;
|
||||
font-size: $font-base + 2upx;
|
||||
background: $uni-color-primary;
|
||||
box-shadow: 1px 2px 5px rgba(217, 60, 93, 0.72);
|
||||
}
|
||||
}
|
||||
.confirm-btn {
|
||||
padding: 0 38upx;
|
||||
margin: 0;
|
||||
border-radius: 100px;
|
||||
height: 76upx;
|
||||
line-height: 76upx;
|
||||
font-size: $font-base + 2upx;
|
||||
background: $uni-color-primary;
|
||||
box-shadow: 1px 2px 5px rgba(217, 60, 93, 0.72);
|
||||
|
||||
/* 复选框选中状态 */
|
||||
.action-section .checkbox.checked,
|
||||
.cart-item .checkbox.checked {
|
||||
color: $uni-color-primary;
|
||||
}
|
||||
|
||||
.getPosition {
|
||||
height: 100upx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 32upx;
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
/* 复选框选中状态 */
|
||||
.action-section .checkbox.checked,
|
||||
.cart-item .checkbox.checked {
|
||||
color: $uni-color-primary;
|
||||
}
|
||||
.getPosition {
|
||||
height: 100upx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 32upx;
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
269
mallplusui-uniapp-app/pages/index/lease.vue
Normal file
269
mallplusui-uniapp-app/pages/index/lease.vue
Normal file
@@ -0,0 +1,269 @@
|
||||
<template>
|
||||
<view class="home">
|
||||
<view class="home-list">
|
||||
|
||||
<view v-for="(item,index) in tableList" :key="item._id" :item="item">
|
||||
<view @click="open">
|
||||
<!-- 基础卡片 -->
|
||||
<view v-if="item.mode==='base'" class="listcard">
|
||||
<view class="listcard-image">
|
||||
<image :src="item.cover[0]" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="listcard-content">
|
||||
<view class="listcard-content_title">
|
||||
<text>{{item.title}}</text>
|
||||
<likes :types="types" :item="item"></likes>
|
||||
</view>
|
||||
<view class="listcard-content_des">
|
||||
<view class="listcard-content_des-label">
|
||||
<view class="listcard-content_des-label-item">{{item.classify}}</view>
|
||||
</view>
|
||||
<view class="listcard-content_des-browe">{{item.browse_count}}浏览</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 多图模式 -->
|
||||
<view v-if="item.mode==='column'" class="listcard mode-column">
|
||||
<view class="listcard-content">
|
||||
<view class="listcard-content_title">
|
||||
<text>{{item.title}}</text>
|
||||
<likes :types="types" :item="item"></likes>
|
||||
</view>
|
||||
<view class="listcard-image">
|
||||
<view v-if="index<3" v-for="(item,index) in item.cover" :key="index"
|
||||
class="listcard-image_item">
|
||||
<image :src="item" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="listcard-content_des">
|
||||
<view class="listcard-content_des-label">
|
||||
<view class="listcard-content_des-label-item">{{item.classify}}</view>
|
||||
</view>
|
||||
<view class="listcard-content_des-browe">{{item.browse_count}}浏览</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 大图模式 -->
|
||||
<view v-if="item.mode==='image'" class="listcard mode-image">
|
||||
<view class="listcard-image">
|
||||
<image :src="item.cover[0]" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="listcard-content">
|
||||
<view class="listcard-content_title">
|
||||
<text>{{item.title}}</text>
|
||||
<likes :types="types" :item="item"></likes>
|
||||
</view>
|
||||
|
||||
<view class="listcard-content_des">
|
||||
<view class="listcard-content_des-label">
|
||||
<view class="listcard-content_des-label-item">{{item.classify}}</view>
|
||||
</view>
|
||||
<view class="listcard-content_des-browe">{{item.browse_count}}浏览</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
types:"",
|
||||
tableList: [{
|
||||
_id: 1,
|
||||
title: "到速度奥昂是大宋到速度奥昂是大宋到速度奥昂是大宋",
|
||||
mode: 'base',
|
||||
cover: [
|
||||
"https://ts1.cn.mm.bing.net/th/id/R-C.df4462fabf18edd07195679a5f8a37e5?rik=FnNvr9jWWjHCVQ&riu=http%3a%2f%2fseopic.699pic.com%2fphoto%2f50059%2f8720.jpg_wh1200.jpg&ehk=ofb4q76uCls2S07aIlc8%2bab3H5zwrmj%2bhqiZ%2fyw3Ghw%3d&risl=&pid=ImgRaw&r=0"
|
||||
],
|
||||
classify: 111,
|
||||
browse_count: 111
|
||||
},
|
||||
{
|
||||
_id: 2,
|
||||
title: "啊实打实大苏打实打实打算大苏打",
|
||||
mode: 'column',
|
||||
cover: [
|
||||
"https://pic3.zhimg.com/v2-58d652598269710fa67ec8d1c88d8f03_r.jpg?source=1940ef5c",
|
||||
"https://pic3.zhimg.com/v2-58d652598269710fa67ec8d1c88d8f03_r.jpg?source=1940ef5c",
|
||||
"https://pic3.zhimg.com/v2-c6ae9c3aff36b9b221258f6a90577902_r.jpg",
|
||||
"https://pic3.zhimg.com/v2-c6ae9c3aff36b9b221258f6a90577902_r.jpg"
|
||||
],
|
||||
classify: 222,
|
||||
browse_count: 222
|
||||
},
|
||||
{
|
||||
_id: 3,
|
||||
title: "都是否定的撒撒大撒反对的飒飒的撒范德萨",
|
||||
mode: 'image',
|
||||
cover: [
|
||||
"https://ts1.cn.mm.bing.net/th?id=OIP-C.kJE5c2uL7he1BwdQb3-APAHaNK&w=187&h=333&c=8&rs=1&qlt=90&o=6&pid=3.1&rm=2"
|
||||
],
|
||||
classify: 333,
|
||||
browse_count: 333
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.home {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
|
||||
.home-list {
|
||||
flex: 1;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
.listcard {
|
||||
display: flex;
|
||||
padding: 15px;
|
||||
margin: 20px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 0 5px 1px rgba($color:#000000, $alpha:0.1);
|
||||
box-sizing: border-box;
|
||||
|
||||
.listcard-image {
|
||||
flex-shrink: 0;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.listcard-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 10px;
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
|
||||
.listcard-content_title {
|
||||
padding-right: 30px;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
font-weight: 400;
|
||||
line-height: 1.2;
|
||||
position: relative;
|
||||
|
||||
text {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
.listcard-content_des {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 12px;
|
||||
|
||||
.listcard-content_des-label {
|
||||
display: flex;
|
||||
|
||||
.listcard-content_des-label-item {
|
||||
padding: 0 5px;
|
||||
margin-right: 5px;
|
||||
border-radius: 15px;
|
||||
color: #f00;
|
||||
border: 1px #f00 solid;
|
||||
}
|
||||
}
|
||||
|
||||
.listcard-content_des-browe {
|
||||
color: #999;
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.mode-column {
|
||||
.list-content {
|
||||
width: 100%;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.listcard-image {
|
||||
display: flex;
|
||||
margin-top: 10px;
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
|
||||
.listcard-image_item {
|
||||
margin-left: 10px;
|
||||
width: 100%;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
|
||||
&:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.listcard-content_des {
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
&.mode-image {
|
||||
flex-direction: column;
|
||||
|
||||
.listcard-image {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.listcard-content {
|
||||
padding-left: 0;
|
||||
margin-top: 10px;
|
||||
|
||||
.listcard-content_des {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -32,7 +32,7 @@
|
||||
<text class="yticon icon-iLinkapp-"></text>
|
||||
{{ userDetailInfo.memberLevelName || '开通会员' }}
|
||||
</view>
|
||||
<text class="e-m">Mallplus</text>
|
||||
<text class="e-m">汇融云链</text>
|
||||
<text class="e-b">升级会员享受更多折扣 一测就上线</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -144,7 +144,6 @@
|
||||
<neil-modal :show="inputShow" @close="cancel" title="编辑" @cancel="cancel" @confirm="confirm">
|
||||
<input v-model="inputContent" style="margin:20upx" placeholder="请输入..." />
|
||||
</neil-modal>
|
||||
<mallplusCopyright></mallplusCopyright>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
<view class="coupon-item" v-if="couponList.length > 0" v-for="(item, index) in couponList" :key="index">
|
||||
<view class="con" @click="selectCoupon(item)">
|
||||
<view class="left">
|
||||
<text class="title">{{ item.name }}</text>
|
||||
<text class="title">{{ item.coupon.name }}</text>
|
||||
<text class="time">有效期至{{item.coupon.endTime | formatCreateTime}}</text>
|
||||
</view>
|
||||
<view class="right">
|
||||
@@ -270,7 +270,7 @@ import Api from '@/common/api';
|
||||
if (this.addressData) {
|
||||
this.addressId = this.addressData.id;
|
||||
}
|
||||
|
||||
console.log("优惠券",data.couponHistoryDetailList);
|
||||
this.couponList = data.couponHistoryDetailList;
|
||||
this.memberReceiveAddressList = data.memberReceiveAddressListaddress;
|
||||
|
||||
@@ -696,8 +696,6 @@ import Api from '@/common/api';
|
||||
|
||||
.mask-content {
|
||||
width: 100%;
|
||||
min-height: 30vh;
|
||||
max-height: 70vh;
|
||||
background: #f3f3f3;
|
||||
transform: translateY(100%);
|
||||
transition: 0.3s;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<!-- #endif -->
|
||||
|
||||
</view>
|
||||
<mallplusCopyright></mallplusCopyright>
|
||||
<!-- <mallplusCopyright></mallplusCopyright> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,7 @@
|
||||
还没有账号?
|
||||
<text @click="toRegist">马上注册</text>
|
||||
</view>
|
||||
<mallplusCopyright></mallplusCopyright>
|
||||
<!-- <mallplusCopyright></mallplusCopyright> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
已经有账号?
|
||||
<text @click="toRegist">马上登录</text>
|
||||
</view>
|
||||
<mallplusCopyright></mallplusCopyright>
|
||||
<!-- <mallplusCopyright></mallplusCopyright> -->
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<text class="cell-more yticon icon-you"></text>
|
||||
</view>
|
||||
<view class="list-cell log-out-btn" @click="toLogout"><text class="cell-tit">退出登录</text></view>
|
||||
<mallplusCopyright></mallplusCopyright>
|
||||
<!-- <mallplusCopyright></mallplusCopyright> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user