Feat:寻看点和抽奖

This commit is contained in:
lifizer
2024-02-06 12:42:46 +08:00
parent c88b6aa8a8
commit f3115fe7c8
73 changed files with 5324 additions and 6887 deletions
+309
View File
@@ -0,0 +1,309 @@
<template>
<view class="pages-cart" v-if="ready">
<u-navbar leftIcon="trash" title="购物车" fixed @leftClick="remove"/>
<view class="tc" style="margin-top: 300rpx" v-if="list.length===0">
<image style="width: 420rpx;height: 418rpx" :src="webUrl+'/20240106211138206789.png'" mode="scaleToFill"/>
</view>
<view class="group-item" v-for="(item,index) in list" :key="index">
<view class="flex jc-between">
<view class="flex ai-center">
<CheckboxIcon style="margin-right: 24rpx;" :default-state="item['state']" @change="value => onChange(value, index, '')"/>
<image class="store-cover" :src="item['merAvatar']"
mode="scaleToFill"/>
<view style="color:#333333;font-size: 30rpx">{{ item['merName'] }}</view>
</view>
<view class="flex ai-center" style="color:#E92727;font-size: 24rpx" @click="navToStore(item['merId'])">
进店逛逛
<image style="width: 24rpx;height: 24rpx" :src="webUrl+'/20240109234706982937.png'" mode="scaleToFill"/>
</view>
</view>
<view class="goods-box">
<view class="goods flex ai-center" v-for="(goods,gIndex) in item['carts']" :key="gIndex">
<CheckboxIcon style="margin-right: 24rpx;" :default-state="goods['state']" :mark="[index,gIndex]"
@change="value => onChange(value, index, gIndex)"/>
<image class="goods-cover flex-0" :src="goods['productInfo']['attrInfo']['image']" mode="scaleToFill"
v-if="goods['productInfo']['attrInfo']['image']"/>
<image class="goods-cover flex-0" :src="goods['productInfo']['image']" mode="scaleToFill" v-else/>
<view style="width: 100%">
<view class="one-t">{{ goods['productInfo']['storeName'] }}</view>
<view class="sku ai-center">规格{{ goods['productInfo']['attrInfo']['sku'] }}</view>
<view class="flex jc-between ai-center" style="width: 100%;margin-top: 26rpx;">
<view style="color:#E92727;font-size: 32rpx;">
<text class="bold" style="font-size: 24rpx"></text>
{{ goods['truePrice'] }}
</view>
<u-number-box class="num-step" v-model="goods['cartNum']" :name="goods['id']"
:max="goods['productInfo']['attrInfo']['stock']" integer disabledInput
iconStyle="color: #fff" @change="changeNum">
<template v-slot:minus>
<view class="num-btn flex jc-center ai-center">
<u-icon name="minus" size="12" color="#FFFFFF"/>
</view>
</template>
<template v-slot:input>
<view class="num-input tc">{{ goods['cartNum'] }}</view>
</template>
<template v-slot:plus>
<view class="num-btn flex jc-center ai-center">
<u-icon name="plus" size="12" color="#FFFFFF"/>
</view>
</template>
</u-number-box>
</view>
</view>
</view>
</view>
</view>
<view class="footer-fixed flex jc-between ai-center">
<view style="margin-left: 32rpx;">
<CheckboxIcon style="margin-right: 24rpx;" :default-state="isAll" @change="value => onAllChange(value)"/>
<text style="color:#666666;font-size: 32rpx">已选({{ selectCount }})</text>
</view>
<view class="flex ai-center">
<view style="margin-right: 20rpx;color:#666666;font-size: 32rpx">合计:
<text class="bold" style="color:#E92727">{{ total }}</text>
</view>
<view class="btn-submit bold flex jc-center ai-center" @click="submit">结算</view>
</view>
</view>
</view>
</template>
<script setup>
import {changeCartNum, getCartGroup, postCartDel} from "@/api/store";
import {VUE_APP_RESOURCES_URL} from '../config/index'
import CheckboxIcon from "@/components/CheckboxIcon.vue";
const webUrl = VUE_APP_RESOURCES_URL
export default {
name: 'CartIndex',
components: {
CheckboxIcon
},
data() {
return {
webUrl,
ready: false,
isAll: false,
selectCount: 0,
total: 0,
list: []
}
},
onShow() {
this.ready = true
this.getCart()
},
methods: {
async getCart() {
const res = await getCartGroup()
if (res.success) {
this.list = res.data['valid']
this.list.map(item => {
item.state = false
if (item.carts) {
item.carts.map(child => {
child.state = false
})
}
})
this.handleAll(true)
}
},
onChange(state, index, childIndex) {
if (childIndex === '') {
this.list[index].state = state
this.list[index].carts.map(good => {
good.state = state
})
} else {
this.list[index].carts[childIndex].state = state
let count = 0
this.list[index].carts.map(good => {
if (good.state) {
count++
}
})
this.list[index].state = count === this.list[index].carts.length
}
this.$forceUpdate()
this.calcAll()
},
onAllChange() {
this.handleAll(!this.isAll)
},
handleAll(state) {
this.list.map(item => {
item.state = state
if (item.carts) {
item.carts.map(good => {
good.state = state
})
}
})
this.isAll = state
this.calcAll()
},
calcAll() {
let total = 0
let count = 0
let goodsAll = 0
this.list.map(item => {
if (item.carts) {
item.carts.map(good => {
goodsAll++
if (good.state) {
total += good.cartNum * good.truePrice
count++
}
})
}
})
this.total = total
this.selectCount = count
this.isAll = goodsAll === count
},
navToStore(id) {
uni.navigateTo({
url: '/pagesInn/inn/innHome?id=' + id
})
},
handleIds() {
const ids = []
this.list.map(item => {
item.carts.map(good => {
if (good.state) {
ids.push(good.id)
}
})
})
return ids
},
remove() {
const _this = this
const ids = _this.handleIds()
if (ids.length === 0) return
uni.showModal({
title: '确认删除已选商品?',
content: '',
showCancel: true,
cancelText: '取消',
confirmText: '确认',
success: async () => {
const res = await postCartDel(ids)
if (res.success) await _this.getCart()
}
})
},
submit() {
const ids = this.handleIds()
if (ids.length === 0) return
const param = ids.join(',')
uni.navigateTo({
url: '/pages/order/OrderSubmission/index?id=' + param
})
}
}
}
</script>
<style scoped lang="less">
view {
box-sizing: border-box;
}
.pages-cart {
min-height: 100vh;
padding-top: calc(var(--status-bar-height) + 54px);
padding-bottom: 100rpx;
}
.group-item {
width: 710rpx;
margin: 12rpx 20rpx;
padding: 8rpx 8rpx 32rpx 20rpx;
background: #FFFFFF;
border-radius: 12rpx;
.store-cover {
width: 48rpx;
height: 48rpx;
margin-right: 8rpx;
border-radius: 50%;
}
}
.goods-box {
.goods {
margin-top: 24rpx;
.goods-cover {
width: 160rpx;
height: 160rpx;
margin-right: 16rpx;
border-radius: 8rpx;
}
.one-t {
width: 420rpx;
color: #333333;
font-size: 30rpx;
line-height: 42rpx;
font-weight: bold;
}
.sku {
display: inline-flex;
height: 42rpx;
margin-top: 12rpx;
padding: 0 20rpx;
border-radius: 22rpx;
background: #FDF1F3;
color: #999999;
font-size: 28rpx;
}
.num-btn {
width: 40rpx;
height: 40rpx;
background: rgba(236, 236, 238, 1);
border: 2px solid rgba(236, 236, 238, 1);
border-radius: 50%;
}
.num-input {
width: 64rpx;
color: #333333;
font-size: 30rpx;
}
}
}
.footer-fixed {
position: fixed;
left: 0;
bottom: 0;
width: 100vw;
height: 100rpx;
box-shadow: 0 6rpx 12rpx rgba(0, 0, 0, 0.16);
background: #FFFFFF;
.btn-submit {
width: 196rpx;
height: 100rpx;
background: #FD5749;
color: #FFFFFF;
font-size: 32rpx;
}
}
</style>
+307
View File
@@ -0,0 +1,307 @@
<template>
<view class="pages-cart" v-if="ready">
<u-navbar leftIcon="trash" title="购物车" fixed @leftClick="remove"/>
<view class="tc" style="margin-top: 300rpx" v-if="list.length===0">
<image style="width: 420rpx;height: 418rpx" :src="webUrl+'/20240106211138206789.png'" mode="scaleToFill"/>
</view>
<view class="group-item" v-for="(item,index) in list" :key="index">
<view class="flex jc-between">
<view class="flex ai-center">
<CheckboxIcon style="margin-right: 24rpx;" :default-state="item['state']" :mark="[index]" @change="onChange"/>
<image class="store-cover" :src="item['merAvatar']"
mode="scaleToFill"/>
<view style="color:#333333;font-size: 30rpx">{{ item['merName'] }}</view>
</view>
<view class="flex ai-center" style="color:#E92727;font-size: 24rpx" @click="navToStore(item['merId'])">
进店逛逛
<image style="width: 24rpx;height: 24rpx" :src="webUrl+'/20240109234706982937.png'" mode="scaleToFill"/>
</view>
</view>
<view class="goods-box">
<view class="goods flex ai-center" v-for="(goods,gIndex) in item['carts']" :key="gIndex">
<CheckboxIcon style="margin-right: 24rpx;" :default-state="goods['state']" :mark="[index,gIndex]"
@change="onChange"/>
<image class="goods-cover flex-0" :src="goods['productInfo']['attrInfo']['image']" mode="scaleToFill"
v-if="goods['productInfo']['attrInfo']['image']"/>
<image class="goods-cover flex-0" :src="goods['productInfo']['image']" mode="scaleToFill" v-else/>
<view style="width: 100%">
<view class="one-t">{{ goods['productInfo']['storeName'] }}</view>
<view class="sku ai-center">规格{{ goods['productInfo']['attrInfo']['sku'] }}</view>
<view class="flex jc-between ai-center" style="width: 100%;margin-top: 26rpx;">
<view style="color:#E92727;font-size: 32rpx;">
<text class="bold" style="font-size: 24rpx"></text>
{{ goods['truePrice'] }}
</view>
<u-number-box class="num-step" v-model="goods['cartNum']" :name="goods['id']"
:max="goods['productInfo']['attrInfo']['stock']" integer disabledInput
iconStyle="color: #fff" @change="changeNum">
<template v-slot:minus>
<view class="num-btn flex jc-center ai-center">
<u-icon name="minus" size="12" color="#FFFFFF"/>
</view>
</template>
<template v-slot:input>
<view class="num-input tc">{{ goods['cartNum'] }}</view>
</template>
<template v-slot:plus>
<view class="num-btn flex jc-center ai-center">
<u-icon name="plus" size="12" color="#FFFFFF"/>
</view>
</template>
</u-number-box>
</view>
</view>
</view>
</view>
</view>
<view class="footer-fixed flex jc-between ai-center">
<view style="margin-left: 32rpx;">
<CheckboxIcon style="margin-right: 24rpx;" :default-state="isAll" :mark="[-1]" @change="onChange"/>
<text style="color:#666666;font-size: 32rpx">全选({{ selectCount }})</text>
</view>
<view class="flex ai-center">
<view style="margin-right: 20rpx;color:#666666;font-size: 32rpx">合计:
<text class="bold" style="color:#E92727">{{ total }}</text>
</view>
<view class="btn-submit bold flex jc-center ai-center" @click="submit">结算</view>
</view>
</view>
</view>
</template>
<script setup>
import {computed, onMounted, ref} from "@vue/composition-api";
import {onShow} from '@dcloudio/uni-app'
import {changeCartNum, getCartGroup, postCartDel} from "@/api/store";
import CheckboxIcon from "@/components/CheckboxIcon.vue";
import {VUE_APP_RESOURCES_URL} from '../config/index'
const webUrl = VUE_APP_RESOURCES_URL
const ready = ref(false)
onShow(() => {
getCart()
ready.value = true
})
const list = ref([])
const getCart = async () => {
const res = await getCartGroup()
if (res.success) {
list.value = res.data['valid']
handleAll(false)
}
}
const navToStore = (id) => {
uni.navigateTo({
url: '/pagesInn/inn/innHome?id=' + id
})
}
const total = computed(() => {
let price = 0
list.value.forEach(item => {
item['carts'].forEach(goods => {
if (goods.state) price += goods['cartNum'] * goods['truePrice']
})
})
return price
})
const isAll = ref(false)
const onChange = (state, mark) => {
if (mark.length === 1) {
if (mark[0] === -1) {
handleAll(state)
} else {
list.value[mark[0]]['state'] = state
list.value[mark[0]]['carts'] = list.value[mark[0]]['carts'].map(goods => {
goods.state = state
return goods
})
}
}
if (mark.length === 2) {
list.value[mark[0]]['carts'][mark[1]]['state'] = state
const length = list.value[mark[0]]['carts'].length
let count = 0
list.value[mark[0]]['carts'] = list.value[mark[0]]['carts'].map((goods, gIndex) => {
if (gIndex === mark[1]) goods['state'] = state
if (goods['state']) count++
return goods
})
list.value[mark[0]]['state'] = count === length
}
}
const handleAll = (state) => {
isAll.value = state
list.value = list.value.map(item => {
item.state = state
item.carts = item.carts.map(goods => {
goods.state = state
return goods
})
return item
})
}
const changeNum = (event) => {
changeCartNum(event.name, event.value)
}
const selectCount = computed(() => {
let count = 0
list.value.forEach(item => {
item['carts'].forEach(goods => {
if (goods.state) count++
})
})
return count
})
const handleIds = () => {
if (selectCount.value === 0) {
uni.showToast({
title: "请选择产品",
icon: "none",
duration: 2000
})
return []
}
let ids = []
list.value.forEach(item => {
item['carts'].forEach(goods => {
if (goods['state']) ids.push(goods['id'])
})
})
return ids
}
const remove = () => {
const ids = handleIds()
if (ids.length === 0) return
uni.showModal({
title: '确认删除已选商品?',
content: '',
showCancel: true,
cancelText: '取消',
confirmText: '确认',
success: async () => {
const res = await postCartDel(ids)
if (res.success) await getCart()
}
})
}
const submit = () => {
const ids = handleIds()
if (ids.length === 0) return
const param = ids.join(',')
uni.navigateTo({
url: '/pages/order/OrderSubmission/index?id=' + param
})
}
</script>
<style scoped lang="less">
view {
box-sizing: border-box;
}
.pages-cart {
min-height: 100vh;
padding-top: calc(var(--status-bar-height) + 54px);
padding-bottom: 100rpx;
}
.group-item {
width: 710rpx;
margin: 12rpx 20rpx;
padding: 8rpx 8rpx 32rpx 20rpx;
background: #FFFFFF;
border-radius: 12rpx;
.store-cover {
width: 48rpx;
height: 48rpx;
margin-right: 8rpx;
border-radius: 50%;
}
}
.goods-box {
.goods {
margin-top: 24rpx;
.goods-cover {
width: 160rpx;
height: 160rpx;
margin-right: 16rpx;
border-radius: 8rpx;
}
.one-t {
width: 420rpx;
color: #333333;
font-size: 30rpx;
line-height: 42rpx;
font-weight: bold;
}
.sku {
display: inline-flex;
height: 42rpx;
margin-top: 12rpx;
padding: 0 20rpx;
border-radius: 22rpx;
background: #FDF1F3;
color: #999999;
font-size: 28rpx;
}
.num-btn {
width: 40rpx;
height: 40rpx;
background: rgba(236, 236, 238, 1);
border: 2px solid rgba(236, 236, 238, 1);
border-radius: 50%;
}
.num-input {
width: 64rpx;
color: #333333;
font-size: 30rpx;
}
}
}
.footer-fixed {
position: fixed;
left: 0;
bottom: 0;
width: 100vw;
height: 100rpx;
box-shadow: 0 6rpx 12rpx rgba(0, 0, 0, 0.16);
background: #FFFFFF;
.btn-submit {
width: 196rpx;
height: 100rpx;
background: #FD5749;
color: #FFFFFF;
font-size: 32rpx;
}
}
</style>
+238
View File
@@ -0,0 +1,238 @@
<template>
<view class="pages-cart" v-if="ready">
<u-navbar leftIcon="trash" title="购物车" fixed @leftClick="remove"/>
<view class="tc" style="margin-top: 300rpx" v-if="list.length===0">
<image style="width: 420rpx;height: 418rpx" :src="webUrl+'/20240106211138206789.png'" mode="scaleToFill"/>
</view>
<view class="group-item" v-for="(item,index) in list" :key="index">
<view class="flex jc-between">
<view class="flex ai-center">
<image class="store-cover" :src="item['merAvatar']"
mode="scaleToFill"/>
<view style="color:#333333;font-size: 30rpx">{{ item['merName'] }}</view>
</view>
<view class="flex ai-center" style="color:#E92727;font-size: 24rpx" @click="navToStore(item['merId'])">
进店逛逛
<image style="width: 24rpx;height: 24rpx" :src="webUrl+'/20240109234706982937.png'" mode="scaleToFill"/>
</view>
</view>
<view class="goods-box">
<view class="goods flex ai-center" v-for="(goods,gIndex) in item['carts']" :key="gIndex">
<image class="goods-cover flex-0" :src="goods['productInfo']['attrInfo']['image']" mode="scaleToFill"
v-if="goods['productInfo']['attrInfo']['image']"/>
<image class="goods-cover flex-0" :src="goods['productInfo']['image']" mode="scaleToFill" v-else/>
<view style="width: 100%">
<view class="one-t">{{ goods['productInfo']['storeName'] }}</view>
<view class="sku ai-center">规格{{ goods['productInfo']['attrInfo']['sku'] }}</view>
<view class="flex jc-between ai-center" style="width: 100%;margin-top: 26rpx;">
<view style="color:#E92727;font-size: 32rpx;">
<text class="bold" style="font-size: 24rpx"></text>
{{ goods['truePrice'] }}
</view>
<u-number-box class="num-step" v-model="goods['cartNum']" :name="goods['id']"
:max="goods['productInfo']['attrInfo']['stock']" integer disabledInput
iconStyle="color: #fff" @change="changeNum">
<template v-slot:minus>
<view class="num-btn flex jc-center ai-center">
<u-icon name="minus" size="12" color="#FFFFFF"/>
</view>
</template>
<template v-slot:input>
<view class="num-input tc">{{ goods['cartNum'] }}</view>
</template>
<template v-slot:plus>
<view class="num-btn flex jc-center ai-center">
<u-icon name="plus" size="12" color="#FFFFFF"/>
</view>
</template>
</u-number-box>
</view>
</view>
</view>
</view>
</view>
<view class="footer-fixed flex jc-between ai-center">
<view style="margin-left: 32rpx;">
<text style="color:#666666;font-size: 32rpx">全选({{ selectCount }})</text>
</view>
<view class="flex ai-center">
<view style="margin-right: 20rpx;color:#666666;font-size: 32rpx">合计:
<text class="bold" style="color:#E92727">{{ total }}</text>
</view>
<view class="btn-submit bold flex jc-center ai-center" @click="submit">结算</view>
</view>
</view>
</view>
</template>
<script setup>
import {changeCartNum, getCartGroup, postCartDel} from "@/api/store";
import {VUE_APP_RESOURCES_URL} from '../config/index'
const webUrl = VUE_APP_RESOURCES_URL
export default {
name: 'CartIndex',
data() {
return {
webUrl,
ready: false,
isAll: false,
selectCount: 0,
total: 0,
list: []
}
},
onShow() {
this.ready = true
this.getCart()
},
methods: {
async getCart() {
const res = await getCartGroup()
if (res.success) {
this.list = res.data['valid']
this.handleAll(true)
}
},
onChange(state, mark) {
},
handleAll(state) {
},
navToStore(id) {
uni.navigateTo({
url: '/pagesInn/inn/innHome?id=' + id
})
},
handleIds() {
},
remove() {
const _this = this
const ids = _this.handleIds()
if (ids.length === 0) return
uni.showModal({
title: '确认删除已选商品?',
content: '',
showCancel: true,
cancelText: '取消',
confirmText: '确认',
success: async () => {
const res = await postCartDel(ids)
if (res.success) await _this.getCart()
}
})
},
submit() {
const ids = this.handleIds()
if (ids.length === 0) return
const param = ids.join(',')
uni.navigateTo({
url: '/pages/order/OrderSubmission/index?id=' + param
})
}
}
}
</script>
<style scoped lang="less">
view {
box-sizing: border-box;
}
.pages-cart {
min-height: 100vh;
padding-top: calc(var(--status-bar-height) + 54px);
padding-bottom: 100rpx;
}
.group-item {
width: 710rpx;
margin: 12rpx 20rpx;
padding: 8rpx 8rpx 32rpx 20rpx;
background: #FFFFFF;
border-radius: 12rpx;
.store-cover {
width: 48rpx;
height: 48rpx;
margin-right: 8rpx;
border-radius: 50%;
}
}
.goods-box {
.goods {
margin-top: 24rpx;
.goods-cover {
width: 160rpx;
height: 160rpx;
margin-right: 16rpx;
border-radius: 8rpx;
}
.one-t {
width: 420rpx;
color: #333333;
font-size: 30rpx;
line-height: 42rpx;
font-weight: bold;
}
.sku {
display: inline-flex;
height: 42rpx;
margin-top: 12rpx;
padding: 0 20rpx;
border-radius: 22rpx;
background: #FDF1F3;
color: #999999;
font-size: 28rpx;
}
.num-btn {
width: 40rpx;
height: 40rpx;
background: rgba(236, 236, 238, 1);
border: 2px solid rgba(236, 236, 238, 1);
border-radius: 50%;
}
.num-input {
width: 64rpx;
color: #333333;
font-size: 30rpx;
}
}
}
.footer-fixed {
position: fixed;
left: 0;
bottom: 0;
width: 100vw;
height: 100rpx;
box-shadow: 0 6rpx 12rpx rgba(0, 0, 0, 0.16);
background: #FFFFFF;
.btn-submit {
width: 196rpx;
height: 100rpx;
background: #FD5749;
color: #FFFFFF;
font-size: 32rpx;
}
}
</style>
-973
View File
@@ -1,973 +0,0 @@
<template>
<view class="newsList" ref="container">
<hx-navbar :back="false" :fixed="true" title="七彩云上" statusBarFontColor="#ffffff" color="#ffffff" :left-slot="true"
:background-color="[13,197,197]" :right-slot="true">
<block slot="left">
<view class="location acea-row row-center row-middle"
style="position: relative;height: 42rpx;margin-left: 35rpx;box-sizing: border-box;">
<image style="width: 30rpx;height: 30rpx;" :src="webUrl+'/20210807134107296760.png'" mode=""></image>
<view class="city-name" @click="cityNameClick">{{cityName}}</view>
</view>
</block>
</hx-navbar>
<view style="position: fixed;right: 0;width: 100%;z-index: 5;" :style="{top:navHeight}">
<drop-down :showDd="showCitySelect" :list="cityList" @select="selectCity" @close="closeCitySelect"></drop-down>
</view>
<view class="acea-row row-column"
style="position: fixed;left: 0;right: 0;background-color: #0DC5C5;z-index: 4;overflow-y: hidden;"
:style="{top:segTop+'px'}">
<!-- 搜索开始 -->
<view class="searchGood" style="margin-top: 10rpx;">
<view class="search acea-row row-between-wrapper">
<view class="input acea-row row-between-wrapper">
<text class="iconfont icon-sousuo2"></text>
<input style="color: #acacac !important;" type="text" placeholder="请输入搜索关键词" confirm-type="search"
v-model="search" @confirm="refreshData" />
</view>
</view>
</view>
<!-- 搜索结束 -->
<!-- tab开始 -->
<view class="top-tab acea-row row-middle" style="position: relative;">
<view class="tab acea-row row-middle row-center" @click="changeTab(0)">
<view :style="(activeIndex==0?'background:#F6F6F6':'')"
class="tab-wrap acea-row row-column row-middle row-center">
<image v-if="activeIndex==0" style="width: 36rpx;height:36rpx" :src="webUrl+'/20210824104937140590.png'"
mode=""></image>
<image v-else style="width: 36rpx;height:36rpx" :src="webUrl+'/20210807135928525293.png'"
mode="scaleToFill"></image>
<text :style="'font-size:22rpx;margin-top4rpx;color:'+(activeIndex==0?'#0DC5C5':'#ffffff')">#住在云上</text>
</view>
</view>
<view class="tab acea-row row-middle row-center" @click="changeTab(1)">
<view :style="(activeIndex==1?'background:#F6F6F6':'')"
class="tab-wrap acea-row row-column row-middle row-center">
<image v-if="activeIndex==1" style="width: 32rpx;height:36rpx" :src="webUrl+'/20210824104954282401.png'"
mode=""></image>
<image v-else style="width: 36rpx;height:36rpx" :src="webUrl+'/20210807140012422075.png'"
mode="scaleToFill"></image>
<text :style="'font-size:22rpx;margin-top4rpx;color:'+(activeIndex==1?'#0DC5C5':'#ffffff')">#逛在云上</text>
</view>
</view>
<view class="tab acea-row row-middle row-center" @click="changeTab(2)">
<view :style="(activeIndex==2?'background:#F6F6F6':'')"
class="tab-wrap acea-row row-column row-middle row-center">
<image v-if="activeIndex==2" style="width: 32rpx;height:36rpx" :src="webUrl+'/20210824105005945092.png'"
mode=""></image>
<image v-else style="width: 36rpx;height:36rpx" :src="webUrl+'/20210807140042265370.png'"
mode="scaleToFill"></image>
<text :style="'font-size:22rpx;margin-top4rpx;color:'+(activeIndex==2?'#0DC5C5':'#ffffff')">#吃在云上</text>
</view>
</view>
<view class="tab acea-row row-middle row-center" @click="changeTab(3)">
<view :style="(activeIndex==3?'background:#F6F6F6':'')"
class="tab-wrap acea-row row-column row-middle row-center">
<image v-if="activeIndex==3" style="width: 36rpx;height:36rpx" :src="webUrl+'/20210824105016005512.png'"
mode=""></image>
<image v-else style="width: 36rpx;height:36rpx" :src="webUrl+'/20210807140136696881.png'"
mode="scaleToFill"></image>
<text :style="'font-size:22rpx;margin-top4rpx;color:'+(activeIndex==3?'#0DC5C5':'#ffffff')">#彩云资讯</text>
</view>
</view>
</view>
<!-- tab结束 -->
<!-- <block v-if="activeIndex==3">
<view class="" style="padding:30rpx 30rpx 0 30rpx;background-color: #F5F5F5;">
<v-tabs v-model="current" :fixed="true" :tabs="tabs" bgColor="#f5f5f5" itemBorderRadius="14.5px" itemMarginRight="30rpx" activeItemBgColor="#ff0000" itemBgColor="RGB(232,232,232)" line-height="0" color="RGB(197,198,204)" activeColor="#fff" @change="changeArtileTab"></v-tabs>
</view>
</block> -->
</view>
<!-- 占位 -->
<!-- <view class="" :style="{height:activeIndex==3?'252rpx':'152rpx'}"></view> -->
<view class="" style="height: 252rpx;"></view>
<!-- 住在云上开始 -->
<block v-if="activeIndex==0">
<view class="wrapper hot" v-if="innArray.length > 0">
<view class="hotGoodsList acea-row">
<view :style="{width:hotInnColumnWidth}" @click="goInnDetail(item)" class="newProductsItem"
v-for="(item, innInfoIndex) in innArray" :key="innInfoIndex">
<view class="img-box">
<image style="border-radius: 8rpx;" :style="{width:hotInnColumnWidth,height:hotInnColumnWidth}"
:src="item.cover" />
<view class="like-btn" @click="likeInn(item)">
<image v-if="item.zanHistory==0" style="width: 100%;height: 100%;" :src="webUrl+'/20230304134637330341.png'"
mode=""></image>
<image v-if="item.zanHistory>0" style="width: 100%;height: 100%;" :src="webUrl+'/20230304134642958611.png'"
mode=""></image>
</view>
<view class="acea-row row-middle"
style="flex-wrap: nowrap;position: absolute;left: 24rpx;right: 24rpx;bottom: 20rpx;z-index: 2;"
v-if="item.cityName != undefined && item.cityName.length>0">
<image style="width: 22rpx;height: 22rpx;" :src="webUrl+'/20210609100715629446.png'" mode=""></image>
<text style="color: #fff;font-size: 22rpx;margin-left: 10rpx;">{{item.cityName}}</text>
</view>
</view>
<view class="pro-info line2" style="min-height: 80rpx;padding: 0 10rpx;"><text>{{ item.content }}</text>
</view>
<!-- <view class="inn-tag-wrap acea-row row-left row-middle" style="padding:0 10rpx">
<view class="zanmost-tag" v-if="item.zanMostTag>0">点赞最多</view>
<view class="latest-tag" v-if="item.newTag>0">最新发布</view>
<view class="location-tag" v-if="item.cityName != undefined && item.cityName.length>0">{{item.cityName}}</view>
</view> -->
<view class="inn-shop-info acea-row row-middle"
style="flex-wrap: nowrap;margin-bottom: 20rpx;padding: 10rpx;">
<view class="acea-row row-center row-middle" style="flex-shrink: 0;">
<image class="inn-shop-icon" :src="item.logo" mode=""></image>
</view>
<view class="acea-row row-column row-between" style="flex-grow: 1;margin-left: 10rpx;">
<view class="inn-shop-name">{{item.name}}</view>
<view class="inn-shop-date">{{ innOpenDateString(item.createdTime,'yyyy/MM/dd') }}</view>
</view>
</view>
</view>
</view>
</view>
</block>
<!-- 住在云上结束 -->
<!-- 逛在云上开始 -->
<block v-if="activeIndex==1">
<!-- <view class="wrapper hot" v-if="innArray.length > 0" >
<view class="hotGoodsList acea-row row-column" >
<view style="border-radius: 8rpx;background: #FFFFFF;flex-wrap: nowrap;margin: 35rpx 35rpx 0 35rpx;padding: 16rpx;" @click="goInnDetail(item)" class="acea-row" v-for="(item, innInfoIndex) in innArray" :key="innInfoIndex">
<view class="img-box" style="width: 164rpx;height: 164rpx;flex-shrink: 0;">
<image style="border-radius: 4rpx 4rpx 0px 0px;width: 100%;height: 100%;" :src="item.cover" />
</view>
<view class="acea-row row-column row-around" style="flex-grow: 1;">
<view class="pro-info line1" style="padding: 0 10rpx;border-radius: 4rpx;">{{ item.name }}</view>
<view class="pro-info acea-row line2" style="padding: 0 10rpx;line-height: 28rpx;">
<text class="" style="font-size: 24rpx;color: #a9a9a9;">{{item.content}}</text>
</view>
<view class="inn-shop-info acea-row row-middle" style="flex-wrap: nowrap;padding: 10rpx;">
<image class="" style="width: 28rpx;height: 28rpx;" :src="webUrl+'/20210402172346756674.png'" mode=""></image>
<text class="" style="font-size: 24rpx;color: #666666;">{{item.address}}</text>
</view>
</view>
</view>
</view>
</view> -->
<view class="wrapper hot" v-if="innArray.length > 0">
<view class="hotGoodsList acea-row" style="">
<view :style="{width:hotGoodsColumnWidth,background:'#ffffff'}" @click="goInnDetail(item)"
class="newProductsItem" v-for="(item, innInfoIndex) in innArray" :key="innInfoIndex">
<view class="img-box" style="position: relative;">
<image style="border-radius: 8rpx" :style="{width:hotInnColumnWidth,height:hotInnColumnWidth}"
:src="item.cover" />
<view class="acea-row row-column"
style="flex-wrap: nowrap;position: absolute;left: 8rpx;right: 8rpx;bottom: 20rpx;z-index: 2;">
<view class="acea-row row-middle"
style="padding-left: 6rpx;padding-right: 16rpx;align-self: flex-start;min-height: 42rpx;color: #ffffff;font-size: 22rpx;background-image: url(http://admin-api.xdd618.com/file/pic/20210609100647993289.png);background-repeat: no-repeat;background-size: 100% 100%;"
v-if="item.cityName != undefined && item.cityName.length>0">
{{item.cityName}}
</view>
<view class="acea-row row-middle line2"
style="padding: 10rpx;background: #fff;border-radius: 0px 12px 12px 12px;opacity: 0.9;color: #333333;font-size: 24rpx;">
{{ item.content }}
</view>
</view>
</view>
<!-- <view class="pro-info line2" style="min-height: 80rpx;padding: 0 10rpx;border-radius: 4rpx;margin-top: 6rpx;">{{ item.content }}</view> -->
<view class="inn-shop-info acea-row row-middle" style="flex-wrap: nowrap;padding: 10rpx;">
<view class="acea-row row-center row-middle" style="flex-shrink: 0;">
<image class="inn-shop-icon" :src="item.logo" mode=""></image>
</view>
<view class="acea-row row-column row-between" style="flex-grow: 1;margin-left: 10rpx;">
<view class="inn-shop-name">{{item.name}}</view>
<!-- <view class="inn-shop-date">{{innOpenDateString(item.createdTime,'yyyy/MM/dd')}}</view> -->
</view>
</view>
</view>
</view>
</view>
</block>
<!-- 逛在云上结束 -->
<!-- 吃在云上开始 -->
<block v-if="activeIndex==2">
<view class="wrapper hot" v-if="innArray.length > 0">
<view class="hotGoodsList acea-row row-column">
<view
style="border-radius: 8rpx;background: #FFFFFF;flex-wrap: nowrap;margin: 35rpx 35rpx 0 35rpx;padding: 16rpx;"
@click="goInnDetail(item)" class="acea-row row-column" v-for="(item, innInfoIndex) in innArray"
:key="innInfoIndex">
<view class="inn-shop-info acea-row row-middle" style="flex-wrap: nowrap;padding: 10rpx;">
<view class="acea-row row-center row-middle" style="flex-shrink: 0;">
<image class="inn-shop-icon" :src="item.logo" mode=""></image>
</view>
<view class="acea-row row-column row-between" style="flex-grow: 1;margin-left: 10rpx;">
<view class="inn-shop-name">{{item.name}}</view>
</view>
</view>
<view class="pro-info acea-row line2" style="padding: 0 10rpx;line-height: 28rpx;">
<text class="" style="font-size: 24rpx;color: #a9a9a9;">{{item.content}}</text>
</view>
<!-- <view class="" style="height: 319rpx;overflow: hidden;margin-bottom: 28rpx;border-radius: 12rpx;">
<img-box style="width: 100%;" :imgList='item.pics.slice(0,3)' :num='item.pics.slice(0,3).length'></img-box>
</view> -->
<block v-if="item.pics && item.pics.length>1">
<img-box style="width: 100%;" :imgList='item.pics.slice(0,3)' :num='item.pics.slice(0,3).length'
:imgRadius='12'></img-box>
</block>
<block v-else>
<view class="" style="height: 319rpx;overflow: hidden;margin-bottom: 28rpx;border-radius: 12rpx;">
<img-box style="width: 100%;" :imgList='item.pics.slice(0,3)' :num='item.pics.slice(0,3).length'
:imgRadius='12'></img-box>
</view>
</block>
<view class="pro-info acea-row" style="padding: 0;line-height: 28rpx;">
<image class="" style="width: 28rpx;height: 28rpx;" :src="webUrl+'/20210402172346756674.png'" mode="">
</image>
<text class="" style="font-size: 24rpx;color: #666666;">{{item.address}}</text>
</view>
<!-- <view class="inn-tag-wrap acea-row row-left row-middle" style="">
<view class="zanmost-tag" v-if="item.zanMostTag>0">点赞最多</view>
<view class="latest-tag" v-if="item.newTag>0">最新发布</view>
<view class="location-tag" v-if="item.cityName != undefined && item.cityName.length>0">{{item.cityName}}</view>
</view> -->
</view>
</view>
</view>
</block>
<!-- 吃在云上结束 -->
<!-- 彩云资讯开始 -->
<block v-if="activeIndex==3">
<view class="list" v-for="(item, articleListIndex) in articleList" :key="articleListIndex">
<view @click="goNewsDetail(item)" class="item acea-row" style="flex-wrap: nowrap;">
<view class="text acea-row row-column-between">
<view class="acea-row row-column" style="position: relative;">
<view class="name line2">{{ item.title }}</view>
<view class="summary line2" style="width: 322rpx;">{{ item.synopsis }}</view>
</view>
<view class="acea-row row-between">
<view class="see-num-box acea-row row-middle">
<image :src="webUrl+'/20230304131559277594.png'" class="eye-icon" mode=""></image>
<text class="see-num-text">{{item.visit||0}}</text>
</view>
<view class="">
{{ shortDateString(item.addTime) }}
</view>
</view>
</view>
<view class="pictrue">
<image :src="item.imageInput" />
</view>
</view>
</view>
</block>
<!-- 彩云资讯结束 -->
<!--暂无客栈-->
<block v-if="activeIndex!=3">
<view class="noCommodity" v-if="innArray.length === 0 && !loading">
<view class="noPictrue">
<image src="@/static/images/img_nodata.png" class="image" />
<!-- <image src="@/static/images/img_nodata.png" mode="widthFix"></image> -->
</view>
</view>
</block>
<block v-if="activeIndex==3">
<view class="noCommodity" v-if="articleList.length === 0 && !loading">
<view class="noPictrue">
<image :src="webUrl+'/20210203154951097926.png'" class="image" />
</view>
</view>
</block>
</view>
</template>
<script>
import {
getArticleList,
getHotelNewsCategory
} from "@/api/public";
import {
getHotelList,
getHotelCityList
} from "@/api/inn.js";
import {
formatDateTime,
isNullOrEmpty
} from "@/utils";
import dropDown from "@/components/drop-down/drop-down.vue";
import config from '@/utils/mapConfig';
import imgBox from '@/components/imageTypeSet/imagebox.vue'
var that;
//获取系统状态栏高度
// var statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
export default {
name: "FoodInfomation",
components: {
// choseCity,
dropDown,
imgBox
},
props: {},
data: function() {
return {
showCitySelect: false,
current: 0,
webUrl: this.$VUE_APP_RESOURCES_URL,
activeIndex: 3,
navHeight: 20 + 44 + 'px',
segTop: 20 + 64,
searchTop: 64 + 64 + 20,
hotInnColumnWidth: '325rpx',
cityName: "定位中...",
page: 1,
limit: 20,
search: "",
loadTitle: "",
loading: false,
loadend: false,
imgUrls: [],
navLsit: [],
articleList: [],
cityList: [], //有客栈入驻的城市列表
innArray: [],
active: 0,
cid: 0,
swiperNew: {
pagination: {
el: ".swiper-pagination",
clickable: true
},
autoplay: {
disableOnInteraction: false,
delay: 2000
},
loop: true,
speed: 1000,
observer: true,
observeParents: true
},
tabs: [],
newsTypeArray: [],
curSelectCategory: ''
};
},
onShow: function() {
this.getHotelCityList();
//进入时如果有jumpIndex
var initIdx = uni.getStorageSync('jumpIndex');
if (initIdx) {
this.activeIndex = parseInt(initIdx);
console.log('jumpIndex:' + initIdx);
uni.removeStorageSync('jumpIndex');
}
// this.getHotelList();
this.getArticleLists();
this.getHotelNewsCategory();
},
onLoad: function(e) {
that = this;
uni.getSystemInfo({
success: (e) => {
//两列商品宽度
that.hotInnColumnWidth = (e.screenWidth - uni.upx2px(90)) / 2 + 'px';
that.navHeight = e.statusBarHeight + 44 + 'px';
that.segTop = e.statusBarHeight + 44;
that.searchTop = e.statusBarHeight + 44 + uni.upx2px(64);
}
});
uni.$on('needRefresh', item => {
console.log(item, '第一页面数据');
this.cityName = item.cityName;
this.refreshData();
});
//this.getHotelList();
//this.getArticleLists();
//获取定位地址
this.getCurAddress();
},
onUnload: function() {
uni.$off('needRefresh');
},
mounted: function() {
// this.articleBanner();
//this.articleCategory();
// this.$scroll(this.$refs.container, () => {
// !this.loading && this.getArticleLists();
// });
//this.getHotelList();
//this.getArticleLists();
//获取定位地址
//this.getCurAddress();
},
onPullDownRefresh() {
this.refreshData();
},
onReachBottom() {
if (this.activeIndex != 3) {
!this.loading && this.getHotelList();
} else {
!this.loading && this.getArticleLists();
}
},
methods: {
isNullOrEmpty,
getHotelNewsCategory() {
var that = this;
getHotelNewsCategory()
.then(res => {
if (res.data && res.data.length > 0) {
that.newsTypeArray = res.data;
that.tabs = [];
that.newsTypeArray.unshift({
'label': '全部',
'value': ''
});
that.newsTypeArray.forEach((item) => {
that.tabs.push('#' + item.label);
});
}
})
.catch(err => {
})
},
changeArtileTab(index) {
console.log('当前选中索引:' + index)
console.log("this.newsTypeArray.length: " + this.newsTypeArray.length)
//获取分类
if (index < this.newsTypeArray.length) {
//获取切换分类并刷新列表
var curCategory = this.newsTypeArray[index];
this.curSelectCategory = curCategory.value;
this.page = 1;
this.loading = false;
this.loadend = false;
this.getArticleLists();
}
},
selectCity(city) {
this.showCitySelect = false;
//this.$refs.popup.close();
// console.log("selectCity:"+this.showCitySelect);
this.cityName = city;
this.refreshData();
},
closeCitySelect() {
this.showCitySelect = false;
//this.$refs.popup.close();
// console.log("closeCitySelect:"+this.showCitySelect);
},
getHotelCityList() {
getHotelCityList().then((res) => {
that.cityList = res.data;
var allItem = {
name: '全 国'
}
that.cityList.unshift(allItem);
}).catch((err) => {
}).finally(() => {
})
},
// popChange(e){
// this.showCitySelect = e.show;
// },
cityNameClick() {
this.showCitySelect = true;
},
refreshData: function() {
this.page = 1;
this.loading = false;
this.loadend = false;
if (this.activeIndex != 3) {
this.getHotelList();
} else {
this.getArticleLists();
}
},
changeTab: function(index) {
this.innArray = [];
this.activeIndex = index;
this.page = 1;
this.loading = false;
this.loadend = false;
//刷新数据
if (this.activeIndex != 3) {
this.getHotelList();
} else {
this.getArticleLists();
}
},
goInnDetail: function(item) {
//跳转到客栈详情
this.$yrouter.push({
path: "/pagesInn/inn/innHome",
query: {
id: item.id
}
});
},
likeInn: function(item) {
//喜欢操作
},
//获取当前定位地址
getCurAddress() {
var that = this;
//定位
uni.showLoading({
title: '定位中...'
});
//this.getLocation();
uni.getLocation({
type: 'wgs84',
success: function(res) {
let latitude = res.latitude;
let longitude = res.longitude;
console.log('latitude:' + latitude + 'longitude:' + longitude)
// #ifdef H5
Vue.jsonp(
'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude + '&key=' +
config.key, {
//callbackName: 'QQmap',
output: 'jsonp',
}).then(json => {
// Success.
uni.hideLoading();
that.cityName = json.result.ad_info.city;
//定位成功刷新数据
if (that.activeIndex != 3) {
that.refreshData();
}
}).catch(err => {
// Failed.
console.log('地址解析失败:' + JSON.stringify(err));
uni.hideLoading();
})
// #endif
// #ifndef H5
uni.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude +
'&key=' + config.key,
success: function(res) {
// console.log('res:'+JSON.stringify(res.data));
uni.hideLoading();
that.cityName = res.data.result.ad_info.city;
//定位成功刷新数据
if (that.activeIndex != 3) {
that.refreshData();
}
},
fail: function(res) {
console.log('地址解析失败');
uni.hideLoading();
},
complete: function() {
}
});
// #endif
},
fail: function(res) {
uni.hideLoading();
// uni.showToast({
// title:'城市定位失败:'+JSON.stringify(res),
// icon:'none',
// duration:2000
// })
}
});
},
shortDateString(dataStr) {
var ret = '';
if (isNullOrEmpty(dataStr)) {
} else {
var s = dataStr.toString();
s = s.replace(/-/g, "/");
var date = new Date(s).getTime();
ret = formatDateTime(date, 'yyyy-MM-dd');
}
return ret;
},
innOpenDateString(str, format) {
return formatDateTime(str, format);
},
goNewsDetail(item) {
this.$yrouter.push({
path: "/pages/foodInfomation/foodInfomationDetail",
query: {
id: item.id
}
});
},
getArticleLists: function() {
let that = this;
if (that.loading) return; //阻止下次请求(false可以进行请求);
if (that.loadend) return; //阻止结束当前请求(false可以进行请求);
that.loading = true;
let q = {
page: that.page,
limit: that.limit,
name: that.search,
type: that.curSelectCategory
};
getArticleList(q).then(res => {
that.loading = false;
//apply();js将一个数组插入另一个数组;
if (that.page == 1) {
that.articleList = [];
}
that.articleList.push.apply(that.articleList, res.data);
that.loadend = res.data.length < that.limit; //判断所有数据是否加载完成;
that.page = that.page + 1;
}).catch((err) => {
}).finally(() => {
uni.stopPullDownRefresh();
});
},
getHotelList: function() {
let that = this;
if (that.loading) return; //阻止下次请求(false可以进行请求);
if (that.loadend) return; //阻止结束当前请求(false可以进行请求);
that.loading = true;
var q = {
page: that.page,
limit: that.limit,
type: that.activeIndex + 1,
name: that.search
};
//如果定位到了城市加入参数
if (this.cityName.length > 0 && this.cityName != '定位中...') {
q.cityName = this.cityName;
//全国传空字符串
if (this.cityName == '全 国') {
q.cityName = '';
}
}
getHotelList(q).then(res => {
that.loading = false;
//apply();js将一个数组插入另一个数组;
if (that.page == 1) {
that.innArray = [];
}
that.innArray.push.apply(that.innArray, res.data);
that.loadend = res.data.length < that.limit; //判断所有数据是否加载完成;
that.page = that.page + 1;
}).catch((err) => {
}).finally(() => {
uni.stopPullDownRefresh();
});
},
onClick: function(name) {
if (name === 0) this.articleHotList();
else {
this.cid = this.navLsit[name].id;
this.articleList = [];
this.page = 1;
this.loadend = false;
this.loading = false;
this.getArticleLists(name);
}
}
}
};
</script>
<style scoped lang="less">
.searchGood .search .input {
background-color: #f6f6f6 !important;
}
.searchGood .search {
padding-left: 35rpx !important;
padding-right: 35rpx !important;
}
.pink-dot {
width: 24rpx;
height: 24rpx;
background: rgba(255, 86, 74, 0.4);
border-radius: 50%;
position: absolute;
z-index: 0;
bottom: 0;
right: -12rpx;
}
.main-title {
font-size: 36rpx;
line-height: 36rpx;
// color: #080F1A;
color: #FFFFFF;
position: relative;
}
.eye-icon {
width: 32rpx;
height: 32rpx;
margin-right: 8rpx;
}
.zan-icon {
width: 32rpx;
height: 32rpx;
margin-right: 8rpx;
}
.zan-num-text {
color: #080F1A;
font-size: 24rpx;
}
.see-num-text {
color: #080F1A;
font-size: 24rpx;
}
.newsList .list .item .text .name {
color: #080F1A !important;
font-size: 32rpx;
font-weight: bold;
}
.newsList .list .item .text {
margin-right: 10rpx;
width: auto !important;
height: auto !important;
}
.newsList .list .item .pictrue {
flex-shrink: 0;
width: 288rpx !important;
height: 216rpx !important;
}
.newsList .list .item {
background-color: #fff;
flex-wrap: nowrap;
padding: 35rpx !important;
margin: 35rpx 30rpx !important;
border-radius: 8rpx;
}
.summary {
color: #C2C5CC;
font-size: 24rpx;
}
.sub-title {
font-size: 14*2rpx;
margin-top: 10rpx;
color: rgba(252, 85, 179, 0.7);
}
.title .hot-title {
font-size: 18*2rpx;
color: #FF7900;
background: rgba(255, 255, 255, 1);
margin-left: 5*2rpx;
margin-right: 5*2rpx;
}
.hotGoodsList {
position: relative;
margin: 20rpx 0 35rpx 0;
background-color: transparent;
flex-wrap: wrap;
}
.hotGoodsList .newProductsItem {
margin-left: 35rpx;
margin-top: 20rpx;
background-color: #ffffff;
}
.img-box {
position: relative;
}
.price-tag {
position: absolute;
width: 39*2rpx;
height: 19*2rpx;
left: 0;
top: 0;
}
.like-btn {
position: absolute;
width: 24*2rpx;
height: 24*2rpx;
right: 0;
top: 0;
}
.inn-tag-wrap {
margin-top: 10rpx;
margin-bottom: 10rpx;
}
.zanmost-tag {
padding: 2rpx 8rpx 2rpx 8rpx;
background: #FF2D69;
font-size: 10*2rpx;
color: #FFFFFF;
}
.latest-tag {
padding: 2rpx 8rpx 2rpx 8rpx;
background: #0DC5C5;
font-size: 10*2rpx;
color: #FFFFFF;
margin-left: 8rpx;
}
.location-tag {
padding: 2rpx 8rpx 2rpx 8rpx;
background: #EBECF0;
font-size: 10*2rpx;
color: #333333;
margin-left: 8rpx;
}
.inn-shop-icon {
border-radius: 50%;
width: 24*2rpx;
height: 24*2rpx;
}
.inn-shop-name {
font-size: 28rpx;
color: #080F1A;
font-weight: 500;
}
.inn-shop-date {
font-size: 18rpx;
color: #C2C5CC;
}
.location {
padding: 4rpx 16rpx;
background: #EBECF0;
color: #41454D;
border-radius: 22rpx;
}
.city-name {
color: #41454D;
font-size: 24rpx;
margin-left: 4rpx;
line-height: 24rpx;
}
.btLine {
width: 100%;
height: 12rpx;
margin-top: -4rpx;
background: #FD685D;
}
.pro-info {
font-size: 14*2rpx;
}
.top-tab {
height: 104rpx;
margin-left: 35rpx;
margin-right: 35rpx;
margin-top: 20rpx;
// background: #E9E9E9;
// border-radius:22rpx;
}
.top-tab .tab {
position: relative;
// padding: 0 20rpx;
flex: 1;
text-align: center;
height: 100%;
}
.top-tab .tab .tab-title {
position: relative;
z-index: 1;
line-height: 84rpx;
}
.top-tab .tab .tab-bg {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 54rpx;
z-index: 0;
}
.top-tab .tab .tab-wrap {
// background: linear-gradient(180deg, #56D4D4 0%, #0DC5C5 100%);
// background: #F6F6F6;
// box-shadow: 0px 6rpx 16rpx #91D5D5;
opacity: 1;
border-radius: 12rpx;
padding: 10rpx;
height: 100%;
width: 100%;
}
</style>
@@ -1,210 +0,0 @@
<template>
<view class="newsDetail">
<view class="title">{{ articleInfo.title }}</view>
<view class="list acea-row row-middle">
<view class="label line1" style="color: #999;">来源:{{articleInfo.author||"未知"}}</view>
<view class="item">
<!-- <text class="iconfont icon-shenhezhong"></text> -->
{{ articleInfo.addTime }}
</view>
<view class="item acea-row row-middle">
<image :src="webUrl+'/20230304131559277594.png'" class="eye-icon" mode=""></image>
<text class="see-num-text">{{articleInfo.visit||0}}</text>
</view>
</view>
<view class="conter" v-html="articleInfo.content"></view>
</view>
</template>
<style>
.conter>>>img{
display:block;
max-width:100% !important;
}
page{
background: #fff !important;
}
</style>
<style scoped lang="less">
.newsDetail .list .label{
padding: 0;
max-width: auto !important;
}
.eye-icon{
width: 32rpx;
height: 32rpx;
margin-right: 8rpx;
}
.zan-icon{
width: 32rpx;
height: 32rpx;
margin-right: 8rpx;
}
.zan-num-text{
color: #080F1A;
font-size: 24rpx;
}
.see-num-text{
color: #080F1A;
font-size: 24rpx;
}
.newsDetail .title{
font-size: 40rpx !important;
font-weight: bold;
color: #080F1A !important;
}
.newsDetail .picTxt {
width: 6.9*100rpx;
height: 2*100rpx;
border-radius: 0.2*100rpx;
border: 1px solid #e1e1e1;
position: relative;
margin: 0.3*100rpx auto 0 auto;
}
.newsDetail .picTxt .pictrue {
width: 2*100rpx;
height: 2*100rpx;
}
.newsDetail .picTxt .pictrue image{
width: 100%;
height: 100%;
border-radius: 0.2*100rpx 0 0 0.2*100rpx;
display: block;
}
.newsDetail .picTxt .text {
width: 4.6*100rpx;
}
.newsDetail .picTxt .text .name {
font-size: 0.3*100rpx;
color: #282828;
}
.newsDetail .picTxt .text .money {
font-size: 0.24*100rpx;
margin-top: 0.4*100rpx;
font-weight: bold;
}
.newsDetail .picTxt .text .money .num {
font-size: 0.36*100rpx;
}
.newsDetail .picTxt .text .y_money {
font-size: 0.26*100rpx;
color: #999;
text-decoration: line-through;
}
.newsDetail .picTxt .label {
position: absolute;
background-color: #303131;
width: 1.6*100rpx;
height: 0.5*100rpx;
right: -0.07*100rpx;
border-radius: 0.25*100rpx 0 0.06*100rpx 0.25*100rpx;
text-align: center;
line-height: 0.5*100rpx;
bottom: 0.24*100rpx;
}
.newsDetail .picTxt .label .span {
background-image: linear-gradient(to right, #fff71e 0%, #f9b513 100%);
background-image: -webkit-linear-gradient(to right, #fff71e 0%, #f9b513 100%);
background-image: -moz-linear-gradient(to right, #fff71e 0%, #f9b513 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.newsDetail .picTxt .label:after {
content: " ";
position: absolute;
width: 0;
height: 0;
border-bottom: 0.08*100rpx solid #303131;
border-right: 0.08*100rpx solid transparent;
top: -0.08*100rpx;
right: 0;
}
.newsDetail .bnt {
color: #fff;
font-size: 0.3*100rpx;
width: 6.9*100rpx;
height: 0.9*100rpx;
border-radius: 0.45*100rpx;
margin: 0.48*100rpx auto 0 auto;
text-align: center;
line-height: 0.9*100rpx;
}
</style>
<script>
import { getArticleDetails } from "@/api/public";
export default {
name: "FoodInfomationDetail",
components: {},
props: {},
data: function() {
return {
articleInfo: {}
};
},
watch: {
$yroute(to) {
if (to.name === "NewsDetail") this.articleDetails();
}
},
mounted: function() {
this.articleDetails();
},
methods: {
updateTitle() {
// document.title = this.articleInfo.title || this.$yroute.meta.title;
},
articleDetails: function() {
let that = this,
id = this.$yroute.query.id;
getArticleDetails(id).then(res => {
var data = res.data;
data.content = that.formatRichText(data.content);
that.articleInfo = data;
that.updateTitle();
console.log('current path:'+that.$yroute.path);
//动态配置share参数
that.$set(that, "share", {
title:that.articleInfo.title,
path:'/pages/foodInfomation/foodInfomationDetail?id='+that.$yroute.query.id,
imageUrl:'',
desc:'',
content:''
});
});
},
/**
* 处理富文本里的图片宽度自适应
* 1.去掉img标签里的style、width、height属性
* 2.img标签添加style属性:max-width:100%;height:auto
* 3.修改所有style里的width属性为max-width:100%
* 4.去掉<br/>标签
* @param html
* @returns {void|string|*}
*/
formatRichText:function(html){
let newContent= html.replace(/<img[^>]*>/gi,function(match,capture){
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
return match;
});
newContent = newContent.replace(/style="[^"]+"/gi,function(match,capture){
match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi, 'max-width:100%;');
return match;
});
newContent = newContent.replace(/<br[^>]*\/>/gi, '');
newContent = newContent.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;margin-top:0;margin-bottom:0;"');
return newContent;
}
}
};
</script>
-163
View File
@@ -1,163 +0,0 @@
<template>
<view>
<view class="search-box">
<uni-search-bar placeholder="输入搜索关键词" @confirm="search" @clear="clearName"></uni-search-bar>
</view>
<view class="list" v-if="list.length">
<custom-waterfalls-flow :value="list" imageKey="imageInput">
<view class="item" v-for="(item,index) in list" :key="index" slot="slot{{index}}" @click="goNewsDetail(item)">
<image class="cover" :src="item.imageInput" mode="scaleToFill"></image>
<view class="content">
<view class="title more-t">{{item.title}}</view>
<view class="mark more-t">{{item.synopsis}}</view>
<view class="footer flex jc-between ai-center">
<view class="visit flex ai-center">
<image class="icon" :src="webUrl+'/20220609111928828152.png'" mode="scaleToFill"></image>
{{item.visit}}
</view>
<view class="time">{{item.addTime.substring(0,10)}}</view>
</view>
</view>
</view>
</custom-waterfalls-flow>
</view>
<view class="v4-nodata" v-else>
<image src="@/static/images/img_nodata.png" mode="scaleToFill" />
<view class="text">暂无数据</view>
</view>
</view>
</template>
<script>
import {
getArticleList
} from "@/api/public";
export default {
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
page: 1,
limit: 8,
keyword: "",
list: [],
isWait: false
}
},
onLoad() {
this.fetchList();
},
onReachBottom() {
this.page++;
this.fetchList();
},
methods: {
search(e) {
this.keyword = e.value;
this.page = 1;
this.list = [];
this.fetchList();
},
clearName() {
this.keyword = "";
this.page = 1;
this.list = [];
this.fetchList();
},
fetchList() {
if (this.isWait) return;
this.isWait = true;
let params = {
keyword: this.keyword,
page: this.page,
limit: this.limit
};
getArticleList(params).then(res => {
if (res.status === 200) {
for (let i = 0; i < res.data.length; i++) {
res.data[i].hide = true;
this.list.push(res.data[i])
}
}
this.isWait = false;
});
},
goNewsDetail(item) {
this.$yrouter.push({
path: "/pages/foodInfomation/foodInfomationDetail",
query: {
id: item.id
}
});
}
}
}
</script>
<style lang="less">
.search-box {
padding: 0 12rpx;
background: #fff;
/deep/.uni-searchbar__box {
border-radius: 44rpx !important;
}
}
.list {
margin: 28rpx 32rpx;
.item {
border-radius: 4rpx;
background: #fff;
.cover {
width: 332rpx;
height: 200rpx;
vertical-align: middle;
}
.title {
padding: 12rpx 16rpx 0;
font-size: 26rpx;
font-weight: bold;
line-height: 38rpx;
color: #333;
}
.mark {
margin: 14rpx 16rpx;
font-size: 22rpx;
line-height: 32rpx;
color: #999;
}
.footer {
padding: 12rpx 16rpx 16rpx;
border-top: 1rpx solid #E1E1E1;
font-size: 22rpx;
}
.icon {
width: 28rpx;
height: 28rpx;
vertical-align: middle;
margin-right: 4rpx;
}
.visit {
color: #333;
}
.time {
color: #999;
}
}
}
</style>
+10 -57
View File
@@ -60,62 +60,17 @@
<!-- 快捷跳转块v4 -->
<view class="fast-nav x-start">
<view class="item y-f" v-for="(item,index) in menus" :key="index" @click="$global.commonJump(item.uniapp_url)">
<image :src="item.pic" mode="scaleToFill"></image>
<image :src="item.pic"
mode="scaleToFill"></image>
<view class="one-t">{{ item.name }}</view>
</view>
</view>
<!-- 快捷跳转块v4end -->
<!-- <view style="padding-bottom:20rpx;background: #fff;">-->
<!-- 转盘-->
<!-- <image class="home-luck" :src="`${webUrl}/20220519145845818243.png`" mode="scaleToFill" @click="goLuck"></image>-->
<!-- </view>-->
<!-- 伴手礼精品 -->
<!-- <view class="wrapper hot" v-if="likeInfo.length > 0">-->
<!-- <view class="title acea-row row-between row-middle">-->
<!-- <view class="text acea-row row-left row-middle" style="">-->
<!-- <image style="width: 288rpx;height: 46rpx;" :src="webUrl+'/20220521111639280569.png'" mode="scaleToFill">-->
<!-- </image>-->
<!-- </view>-->
<!-- <view class="sub-title" style="flex-wrap: nowrap;" @click="goMoreBoutiqueGift()">-->
<!-- <image style="width: 68rpx;height: 34rpx;" :src="webUrl+'/20210609100740164364.png'" mode="scaleToFill">-->
<!-- </image>-->
<!-- </view>-->
<!-- </view>-->
<!-- <view class="hotGoodsList">-->
<!-- <ls-swiper @clickItem="clickItem()" :list="likeInfo" :slotsMode="true" imgKey="image" :interval="3000"-->
<!-- :duration='4000' :dots='false' :crown="true" :loop="true" :shadow='true' :autoplay='false' height='200'-->
<!-- :previousMargin="160" :nextMargin="160" imgRadius="5">-->
<!-- <template v-slot="{data}">-->
<!-- <view class="acea-row row-column my-swiper-item">-->
<!-- <view class="acea-row row-middle" style="position: relative;">-->
<!-- <image style="width: 420rpx;height: 260rpx;" :src="data.image" lazy-load mode="scaleToFill"></image>-->
<!-- <image-->
<!-- style="width: 168rpx;height: 44rpx;position: absolute;top: 0;left: 0;border-top-left-radius: 12rpx;z-index: 2;"-->
<!-- src="http://admin-api.xdd618.com/file/pic/20220519145858134058.png" mode="scaleToFill"></image>-->
<!-- </view>-->
<!-- <view class="acea-row row-column" style="padding: 10rpx;">-->
<!-- <view class="ac" style="color: #333333;font-size: 24rpx;margin-bottom: 8rpx;">-->
<!-- {{data.storeName}}-->
<!-- </view>-->
<!-- <view v-if="data.vipPrice && data.vipPrice > 0" class="money x-bc" style="color: #FF564A;">-->
<!-- <text style="font-size: 26rpx;">{{data.vipPrice}}</text>-->
<!-- <text class="btn-pay">立即抢购</text>-->
<!-- </view>-->
<!-- <view v-else class="money x-bc" style="color: #FF564A;">-->
<!-- <text style="font-size: 26rpx;">{{data.price}}</text>-->
<!-- <text class="btn-pay">立即抢购</text>-->
<!-- </view>-->
<!-- </view>-->
<!-- </view>-->
<!-- </template>-->
<!-- </ls-swiper>-->
<!-- </view>-->
<!-- </view>-->
<!-- 伴手礼精品end -->
<!-- 导航v9 -->
<!-- <u-scroll-list style="background: pink">-->
<!-- <view>aaa</view>-->
<!-- </u-scroll-list>-->
<!-- 导航v9end -->
<!-- v4 预售专区开始 -->
<view class="pre-sale" v-if="preSaleList.length">
@@ -312,7 +267,6 @@ import CouponWindow from '@/components/CouponWindow';
import CountDown from "@/components/CountDown";
import hxNavbar from "@/components/hx-navbar/hx-navbar.vue"
import imgBox from '@/components/imageTypeSet/imagebox.vue'
import LsSwiper from '@/components//ls-swiper/index.vue'
import {getCouponReceive, noticeDetail, noticeList} from "@/api/user";
import {getHomeData, getShareImage} from '@/api/public';
@@ -325,7 +279,6 @@ var that;
export default {
name: 'Index',
components: {
LsSwiper,
imgBox,
PromotionGood,
CouponWindow,
@@ -832,7 +785,7 @@ export default {
uni.navigateTo({url: '/pkg_product/views/festival'})
},
tapOld() {
this.isOldUser =false
this.isOldUser = false
const {type, text, jumpTime, pageLevel, url, params, couponId} = this.oldUserPopup
if (couponId != null) {
getCouponReceive(couponId).then(res => {
@@ -846,9 +799,9 @@ export default {
}
}).catch((err) => {
uni.showToast({
title: err.data.msg+'',
title: err.data.msg + '',
icon: 'none',
duration:3000
duration: 3000
})
})
}
+5 -5
View File
@@ -125,7 +125,7 @@
<view class="noCart" v-if="orderList.length === 0 && page > 1">
<view class="pictrue">
<image :src="webUrl+'/20210203155245713983.png'"/>
<image :src="webUrl+'/20240102232734472795.png'"/>
</view>
</view>
<Loading :loaded="loaded" :loading="loading"></Loading>
@@ -453,15 +453,15 @@ page {
}
.noCart .pictrue {
width: 4 * 100rpx;
height: 3 * 100rpx;
width: 408rpx;
height: 414rpx;
overflow: hidden;
margin: 0.7 * 100rpx auto 0.5 * 100rpx auto;
}
.noCart .pictrue image {
width: 4 * 100rpx;
height: 3 * 100rpx;
width: 408rpx;
height: 414rpx;
}
.statusTag {
+8 -4
View File
@@ -269,6 +269,7 @@ export default {
contactsTel: "",
storeSelfMention: 0,
cartid: "",
lotteryRecordId:'',
payPassword: null,
// v9-2
couponList: {},
@@ -298,7 +299,6 @@ export default {
//地址切换也要重新计算一下
that.computedPrice('onLoad chooseAddress');
})
that.getCartInfo();
console.log(that.$yroute);
if (that.$yroute.query.pinkid !== undefined) {
that.pinkId = that.$yroute.query.pinkid;
@@ -307,6 +307,10 @@ export default {
that.cartid = that.$yroute.query.id;
console.log(that.cartid)
}
if (that.$yroute.query.lotteryRecordId !== undefined) {
that.lotteryRecordId = that.$yroute.query.lotteryRecordId;
}
that.getCartInfo();
},
onUnload: function () {
console.log('关闭监听选择收货地址');
@@ -351,8 +355,8 @@ export default {
},
getCartInfo() {
var that = this;
const cartIds = this.$yroute.query.id;
if (!cartIds) {
// const cartIds = this.$yroute.query.id;
if (!that.cartid && !that.lotteryRecordId) {
uni.showToast({
title: "参数有误",
icon: "none",
@@ -360,7 +364,7 @@ export default {
});
return this.$yrouter.back();
}
postOrderConfirm(cartIds)
postOrderConfirm(that.cartid,that.lotteryRecordId)
.then(res => {
that.offlinePayStatus = res.data.offline_pay_status;
that.orderGroupInfo = res.data;
+29 -15
View File
@@ -429,11 +429,11 @@
<text style="text-align: center;">购物车</text>
</view>
<view style="position: relative;" class="item" @click="toHome">
<view class="iconfont icon-shouye-xianxing"></view>
<view style="text-align: center;">首页</view>
<view class="item" @click="doneFavorite">
<!-- <view class="iconfont icon-shouye-xianxing"></view>-->
<image style="width: 40rpx;height: 40rpx" :src="webUrl+'/20240113230535491918.png'" mode="scaleToFill" v-if="isFavorite"/>
<image style="width: 40rpx;height: 40rpx" :src="webUrl+'/20240122001533781400.png'" mode="scaleToFill" v-else/>
<view style="text-align: center;">收藏</view>
</view>
@@ -447,7 +447,6 @@
</view>
</view>
</view>
<!-- <CouponPop v-on:changeFun="changeFun" :coupon="coupon"></CouponPop>-->
<ProductWindow v-on:changeFun="changeFun" :attr="attr" :cartNum="cart_num"/>
<StorePoster v-on:setPosterImageStatus="setPosterImageStatus" :posterImageStatus="posterImageStatus"
:posterData="posterData" :goodId="id"></StorePoster>
@@ -491,7 +490,7 @@ import {getCurAddress, getLocation, getUrlParam} from "@/utils/common.js";
import cookie from "@/utils/store/cookie";
import {famousGoodsShareImage, secKillGoodsShareImage} from "@/api/share";
import CouponsPopup from "@/components/CouponsPopup.vue"
import { formatContent } from '@/utils/util.js'
import {addProduct, checkProduct, removeProduct} from "@/api/favorite";
export default {
name: "GoodsCon",
@@ -573,6 +572,8 @@ export default {
webUrl: this.$VUE_APP_RESOURCES_URL,
// v9-2
show: false,
uniqueId: null,
isFavorite: false
};
},
computed: mapGetters(["isLogin", "location", "userInfo"]),
@@ -669,6 +670,13 @@ export default {
} else {
this.productConClass = "product-con";
}
},
attr: {
deep: true,
handler(newVal, oldVal) {
this.uniqueId = newVal.productSelect.unique || null
if (this.uniqueId) this.checkFavorite()
}
}
},
methods: {
@@ -886,11 +894,8 @@ export default {
toggleProductInfo() {
this.isProductInfoExpand = !this.isProductInfoExpand;
},
toHome() {
this.$yrouter.switchTab("/pages/home/index");
},
goShoppingCart() {
this.$yrouter.switchTab("/pages/shop/ShoppingCart/index");
this.$yrouter.switchTab("/pages/cart");
},
goCustomerList() {
this.$yrouter.push({
@@ -963,10 +968,6 @@ export default {
// /\<img/gi,
// '<img style="display:block;max-width:100%;height:auto;"'
// );
if (res.data.storeInfo.description) {
console.log(res.data.storeInfo.description)
res.data.storeInfo.description = formatContent(res.data.storeInfo.description)
}
that.$set(that, "storeInfo", res.data.storeInfo);
that.isWenwan = res.data.isWenwan;
@@ -1300,6 +1301,19 @@ export default {
changeCoupons() {
this.show = !this.show
},
async checkFavorite() {
const res = await checkProduct(this.id, this.uniqueId)
if (res.success) this.isFavorite = res.data.hasFavorite
},
async doneFavorite() {
if (this.isFavorite) {
const res = await removeProduct(this.id, this.uniqueId)
if (res.success) this.isFavorite = false
} else {
const res = await addProduct(this.id, this.uniqueId)
if (res.success) this.isFavorite = true
}
}
}
};
</script>
File diff suppressed because it is too large Load Diff
-701
View File
@@ -1,701 +0,0 @@
<template>
<view class="shoppingCart">
<hx-navbar
title="购物车"
:fixed="true"
:back="false"
:left-slot="true"
:right-slot="true"
color="#333333"
statusBarFontColor="#ffffff"
:background-color="[255,255,255]"
>
<block slot="left">
<view style="padding-left: 30rpx;" class="top-delete-btn acea-row row-middle" @click="delgoods">
<image class="delete-icon" :src="webUrl+'/20210806133058078099.png'" mode=""></image>
</view>
</block>
</hx-navbar>
<view v-if="false" class="nav acea-row row-between-wrapper" style="border-top: 1px solid #f5f5f5">
<view>
<text class="num" style="color: #666666;">{{ count }}件商品</text>
</view>
<view class="top-delete-btn acea-row row-middle" @click="delgoods">
<image class="delete-icon" :src="webUrl+'/20210806133058078099.png'" mode=""></image>
</view>
</view>
<view style="border-top: 1px solid #f5f5f5" v-if="$store.getters.token||userInfo.uid">
<view v-if="validList.length > 0 || cartList.invalid.length > 0">
<view class="list">
<view
class="item acea-row row-between-wrapper"
v-for="(item, cartListValidIndex) in validList"
:key="cartListValidIndex"
>
<view class="select-btn">
<view class="checkbox-wrapper">
<checkbox-group @change="switchSelect(cartListValidIndex)">
<label class="well-check">
<checkbox :checked="item.checked" color="#fff"
style="border-radius: 50%;transform:scale(0.7)"></checkbox>
</label>
</checkbox-group>
</view>
</view>
<view class="picTxt acea-row row-between">
<view class="pictrue" @click="goGoodsCon(item)">
<image :src="item.productInfo.attrInfo.image" v-if="item.productInfo.attrInfo.image"/>
<image :src="item.productInfo.image" v-else/>
</view>
<view class="text acea-row row-column-between">
<view class="line1">{{ item.productInfo.storeName }}</view>
<view class="acea-row row-middle row-left">
<!-- height: 38rpx; -->
<view
class="infor"
style="background-color: #FFF3F2;border-radius: 19rpx;padding: 4rpx 20rpx;"
v-if="item.productInfo.attrInfo"
>规格{{ item.productInfo.attrInfo.sku }}
</view>
</view>
<view class="money" style="color: #FF564A !important;">{{ force2Decimal(item.truePrice) }}</view>
</view>
<view class="carnum acea-row row-middle row-between">
<view
class="reduce"
:class="validList[cartListValidIndex].cartNum <= 1 ? 'on' : ''"
@click.prevent="reduce(cartListValidIndex)"
></view>
<view class="num">{{ item.cartNum }}</view>
<view
class="plus"
v-if="validList[cartListValidIndex].attrInfo"
:class="validList[cartListValidIndex].cartNum >= validList[cartListValidIndex].attrInfo.stock ? 'on' : ''"
@click.prevent="plus(cartListValidIndex)"
></view>
<view
class="plus"
v-else
:class="validList[cartListValidIndex].cartNum >= validList[cartListValidIndex].stock ? 'on' : ''"
@click.prevent="plus(cartListValidIndex)"
></view>
</view>
</view>
</view>
</view>
<!-- 失效商品开始 -->
<view class="invalidGoods" v-if="cartList.invalid.length > 0">
<view class="goodsNav acea-row row-between-wrapper">
<view @click="goodsOpen">
<text
class="iconfont"
:class="goodsHidden === true ? 'icon-xiangyou' : 'icon-xiangxia'"
></text>
失效商品
</view>
<view class="del" @click="delInvalidGoods">
<text class="iconfont icon-shanchu1"></text>
清空
</view>
</view>
<view class="goodsList" :hidden="goodsHidden">
<view
v-for="(item, cartListinvalidIndex) in cartList.invalid"
:key="cartListinvalidIndex"
>
<view
@click="goGoodsCon(item)"
class="item acea-row row-between-wrapper"
v-if="item.productInfo"
>
<view class="invalid acea-row row-center-wrapper">失效</view>
<view class="pictrue">
<image :src="item.productInfo.attrInfo.image" v-if="item.productInfo.attrInfo"/>
<image :src="item.productInfo.image" v-else/>
</view>
<view class="text acea-row row-column-between">
<view class="line1">{{ item.productInfo.storeName }}</view>
<view
class="infor line1"
v-if="item.productInfo.attrInfo"
>属性{{ item.productInfo.attrInfo.sku }}
</view>
<view class="acea-row row-between-wrapper">
<view class="end">该商品已下架</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 失效商品结束 -->
</view>
<!--购物车暂无商品-->
<view class="noCart" v-if="cartList.valid.length === 0 && cartList.invalid.length === 0">
<view class="pictrue">
<image :src="webUrl+'/20210203153734554332.png'"/>
</view>
<Recommend></Recommend>
</view>
<view style="height:210rpx"></view>
<view class="footer" v-if="cartList.valid.length > 0">
<view class="footer-content acea-row row-between-wrapper">
<view class="acea-row row-middle row-between" style="flex: 1;flex-wrap: nowrap;">
<view class="select-btn">
<view class="checkbox-wrapper">
<!-- <label class="well-check">
<input
type="checkbox"
name
value
:checked="isAllSelect && cartCount > 0"
@click="allChecked"
/>
<i class="icon"></i>
<text class="checkAll">全选 ({{ cartCount }})</text>
</label>-->
<checkbox-group @change="allChecked">
<label class="well-check">
<checkbox style="transform:scale(0.7)" value="allSelect" :checked="isAllSelect && cartCount > 0"
color="#fff"></checkbox>
<text class="checkAll" style="color: #666666;">全选 ({{ cartCount }})</text>
</label>
</checkbox-group>
</view>
</view>
<view class="acea-row row-middle" style="margin-left: 20rpx">
<text style="color: #000000;font-size: 28rpx;font-weight: bold;">合计:</text>
<text style="color: #FF564A;font-size: 24rpx;"></text>
<text class="" style="font-size: 32rpx;color: #FF564A;">{{ force2Decimal(countmoney) }}</text>
</view>
</view>
<!-- <view class="money acea-row row-middle" v-if="footerswitch === false"> -->
<view class="money acea-row row-center row-middle" style="background: #FF564A;
height: 100%;
width: 198rpx;
text-align: center;
margin-right: -30rpx;flex-shrink: 0;margin-left: 10rpx;">
<!-- <view class="vline"></view> -->
<view class="placeOrder" @click="placeOrder">结算</view>
</view>
<!-- <view class="button acea-row row-middle" style="position: relative;" v-else>
<view class="vline"></view>
<view class="bnt cart-color" @click="collectAll">收藏</view>
<view class="bnt" @click="delgoods">删除</view>
</view> -->
</view>
</view>
</view>
</view>
</template>
<script>
import Recommend from "@/components/Recommend";
import {mapGetters} from "vuex";
import {changeCartNum, getCartCount, getCartList, postCartDel} from "@/api/store";
import {postCollectAll} from "@/api/user";
import {add, mul} from "@/utils/bc";
import cookie from "@/utils/store/cookie";
const CHECKED_IDS = "cart_checked";
var that;
export default {
name: "ShoppingCart",
components: {
Recommend
},
props: {},
data: function () {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
cartList: {
invalid: [],
valid: []
},
bgImgHeight: '20px',
validList: [],
isAllSelect: false,
cartCount: 0,
countmoney: 0,
goodsHidden: true,
footerswitch: false,
count: 0,
checkedIds: [],
loaded: false
};
},
computed: mapGetters(["userInfo", "token"]),
// watch: {
// $yroute(n) {
// if (n.name === "ShoppingCart") {
// this.carnum();
// this.countMoney();
// this.getCartList();
// this.gainCount();
// this.goodsHidden = true;
// this.footerswitch = false;
// }
// },
// cartList(list) {
// this.validList = list.valid;
// }
// },
watch: {
userInfo(user) {
if (user.uid) {
this.carnum();
this.countMoney();
this.getCartList();
this.gainCount();
}
},
token(token) {
if (this.userInfo.uid) {
this.carnum();
this.countMoney();
this.getCartList();
this.gainCount();
}
},
cartList(list) {
this.validList = list.valid;
}
},
onShow: function () {
this.carnum();
this.countMoney();
this.getCartList();
this.gainCount();
},
onLoad: function () {
that = this;
uni.getSystemInfo({
success: (e) => {
// this.compareVersion(e.SDKVersion, '2.5.0')
let statusBar = 0;
let customBar = 0;
// #ifdef MP
statusBar = e.statusBarHeight
customBar = e.statusBarHeight + 45
if (e.platform === 'android') {
//this.$store.commit('SET_SYSTEM_IOSANDROID', false)
customBar = e.statusBarHeight + 50
}
// #endif
// #ifdef MP-WEIXIN
statusBar = e.statusBarHeight
// @ts-ignore
//uni.getMenuButtonBoundingClientRect();
const custom = uni.getMenuButtonBoundingClientRect()
customBar = custom.bottom + custom.top - e.statusBarHeight
// #endif
// #ifdef MP-ALIPAY
statusBar = e.statusBarHeight
customBar = e.statusBarHeight + e.titleBarHeight
// #endif
// #ifdef APP-PLUS
console.log('app-plus', e)
statusBar = e.statusBarHeight
customBar = e.statusBarHeight + 45
// #endif
// #ifdef H5
statusBar = 0
customBar = e.statusBarHeight + 45
// #endif
// 这里你可以自己决定存放方式,建议放在store中,因为store是实时变化的
// this.$store.commit('SET_STATUS_BAR', statusBar)
// this.$store.commit('SET_CUSTOM_BAR', customBar)
// this.$store.commit('SET_SYSTEM_INFO', e)
// //两列商品宽度
// that.hotGoodsColumnWidth = (e.screenWidth - uni.upx2px(90))/2+'px';
//状态栏图片高度
that.bgImgHeight = statusBar + 'px';
}
});
},
methods: {
force2Decimal(v) {
return this.$force2Decimal(v);
},
goGoodsCon(item) {
this.$yrouter.push({
path: "/pages/shop/GoodsCon/index",
query: {
id: item.productId
}
});
},
getCartList: function () {
let that = this;
getCartList().then(res => {
that.cartList = res.data;
let checkedIds = cookie.get(CHECKED_IDS) || [];
if (!Array.isArray(checkedIds)) checkedIds = [];
this.cartList.valid.forEach(cart => {
if (checkedIds.indexOf(cart.id) !== -1) cart.checked = true;
});
if (checkedIds.length) {
that.checkedIds = checkedIds;
that.isAllSelect = checkedIds.length === this.cartList.valid.length;
that.carnum();
that.countMoney();
}
this.loaded = true;
});
},
//删除商品;
delgoods: function () {
let that = this,
id = [],
valid = [],
list = that.cartList.valid;
list.forEach(function (val) {
if (val.checked === true) {
id.push(val.id);
}
});
if (id.length === 0) {
uni.showToast({
title: "请选择产品",
icon: "none",
duration: 2000
});
return;
}
uni.showModal({
title: '确认删除已选商品?',
content: '',
showCancel: true,
cancelText: '取消',
confirmText: '确认',
success: res => {
uni.showLoading();
postCartDel(id).then(function () {
list.forEach(function (val, i) {
if (val.checked === false || val.checked === undefined)
valid.push(list[i]);
});
that.$set(that.cartList, "valid", valid);
that.carnum();
that.countMoney();
that.gainCount();
that.getCartList();
}).finally(() => {
uni.hideLoading();
});
},
fail: () => {
},
complete: () => {
}
});
},
// //获取数量
gainCount: function () {
let that = this;
getCartCount().then(res => {
that.count = res.data.count;
});
},
//清除失效产品;
delInvalidGoods: function () {
let that = this,
id = [],
list = that.cartList.invalid;
list.forEach(function (val) {
id.push(val.id);
});
postCartDel(id).then(function () {
list.splice(0, list.length);
that.gainCount();
that.getCartList();
});
},
//批量收藏;
collectAll: function () {
let that = this,
data = {
id: [],
category: ""
},
list = that.cartList.valid;
list.forEach(function (val) {
if (val.checked === true) {
data.id.push(val.product_id);
data.category = val.type;
}
});
if (data.id.length === 0) {
uni.showToast({
title: "请选择产品",
icon: "none",
duration: 2000
});
return;
}
postCollectAll(data).then(function () {
uni.showToast({
title: "收藏成功!",
icon: "none",
duration: 2000
});
});
},
//立即下单;
placeOrder: function () {
let that = this,
list = that.cartList.valid,
id = [];
list.forEach(function (val) {
if (val.checked === true) {
id.push(val.id);
}
});
if (id.length === 0) {
uni.showToast({
title: "请选择产品",
icon: "none",
duration: 2000
});
return;
}
this.$yrouter.push({
path: "/pages/order/OrderSubmission/index",
query: {
id: id.join(",")
}
});
},
manage: function () {
let that = this;
that.footerswitch = !that.footerswitch;
},
goodsOpen: function () {
let that = this;
that.goodsHidden = !that.goodsHidden;
},
//加
plus: function (index) {
let that = this;
let list = that.cartList.valid[index];
if (list.cartNum + 1 > list.trueStock) {
uni.showToast({
title: '该商品库存不足,无法继续增加',
icon: 'none'
})
return
}
list.cartNum++;
if (list.attrInfo) {
if (list.cartNum >= list.attrInfo.stock) {
that.$set(list, "cart_num", list.attrInfo.stock);
}
} else {
if (list.cartNum >= list.stock) {
that.$set(list, "cart_num", list.stock);
}
}
that.carnum();
that.countMoney();
that.syncCartNum(list);
},
//减
reduce: function (index) {
let that = this;
let list = that.cartList.valid[index];
if (list.cartNum <= 1) {
uni.showToast({
title: "不能再少了!",
icon: "none",
duration: 2000
});
return;
}
list.cartNum--;
if (list.cartNum < 1) {
that.$set(list, "cart_num", 1);
}
that.carnum();
that.countMoney();
that.syncCartNum(list);
},
syncCartNum(cart) {
if (!cart.sync) {
changeCartNum(cart.id, Math.max(cart.cartNum, 1) || 1)
.then(res => {
this.getCartList();
this.gainCount();
})
.catch(error => {
this.gainCount();
uni.showToast({
title: error.response.data.msg,
icon: "none",
duration: 2000
});
});
}
},
//单选
switchSelect: function (index) {
let that = this,
cart = that.cartList.valid[index],
i = this.checkedIds.indexOf(cart.id);
cart.checked = !cart.checked;
if (i !== -1) this.checkedIds.splice(i, 1);
if (cart.checked) {
this.checkedIds.push(cart.id);
}
let len = that.cartList.valid.length;
let selectnum = [];
for (let i = 0; i < len; i++) {
if (that.cartList.valid[i].checked === true) {
selectnum.push(true);
}
}
that.isAllSelect = selectnum.length === len;
that.$set(that, "cartList", that.cartList);
that.$set(that, "isAllSelect", that.isAllSelect);
cookie.set(CHECKED_IDS, that.checkedIds);
that.carnum();
that.gainCount();
that.countMoney();
},
//全选
allChecked: function (e) {
console.log(e);
let that = this;
let selectAllStatus = e.mp.detail.value[0] == "allSelect" ? true : false;
console.log(selectAllStatus);
// let selectAllStatus = that.isAllSelect;
let checkedIds = [];
// for (let i = 0; i < array.length; i++) {
// array[i].checked = selectAllStatus;
// checked.push()
// }
that.cartList.valid.forEach(cart => {
cart.checked = selectAllStatus;
if (selectAllStatus) {
checkedIds.push(cart.id);
}
});
let cartList = {
...that.cartList
};
that.cartList = [];
that.cartList = cartList;
console.log(this.cartList);
this.$set(this, "cartList", this.cartList);
this.$set(this, "isAllSelect", selectAllStatus);
this.checkedIds = checkedIds;
cookie.set(CHECKED_IDS, checkedIds);
that.carnum();
that.countMoney();
this.$forceUpdate();
},
//数量
carnum: function () {
let that = this;
var carnum = 0;
var array = that.cartList.valid;
for (let i = 0; i < array.length; i++) {
if (array[i].checked === true) {
carnum += parseInt(array[i].cartNum);
}
}
that.$set(that, "cartCount", carnum);
},
//总共价钱;
countMoney: function () {
let that = this;
let carmoney = 0;
let array = that.cartList.valid;
for (let i = 0; i < array.length; i++) {
if (array[i].checked === true) {
carmoney = add(carmoney, mul(array[i].cartNum, array[i].truePrice));
}
}
that.countmoney = carmoney;
}
}
};
</script>
<style scoped lang="less">
.plus {
background-image: url("~@/static/images/num_plus_icon.png");
background-repeat: no-repeat;
background-size: 100% 100%;
border: none !important;
width: 38rpx !important;
height: 38rpx !important;
}
.reduce {
background-image: url("~@/static/images/num_minus_icon.png");
background-repeat: no-repeat;
background-size: 100% 100%;
border: none !important;
width: 38rpx !important;
height: 38rpx !important;
}
.shoppingCart .list .item .picTxt .text .money {
color: #feb655 !important;
}
.vline {
width: 0px;
height: 36rpx;
border-left: 1px solid rgba(255, 255, 255, 0.6);
margin: 26rpx 30rpx 26rpx 0;
}
.top-delete-btn {
padding: 10rpx;
//background:rgba(255,187,225,0.4);
//border-radius:12rpx;
}
.delete-icon {
width: 36rpx;
height: 36rpx;
}
.shoppingCart .footer-content {
background: #fff !important;
border-radius: 0 !important;
margin: 0 !important;
}
.shoppingCart .footer {
height: auto !important;
}
</style>
+4 -1
View File
@@ -45,7 +45,10 @@ export default {
noMoreSize: 10, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
auto:true,
empty:{
tip: '暂无消息' // 提示
tip: '', // 提示
icon:this.$VUE_APP_RESOURCES_URL+'/20240102232728574017.png',
width:500,
height:500
// btnText:'点击刷新'
}
},
+115 -103
View File
@@ -16,76 +16,78 @@
<view class="header acea-row row-column"
style="flex-wrap: nowrap;background: #fff !important;margin: 0 30rpx;border-radius: 16rpx;box-shadow: 0px 6rpx 12rpx rgba(0, 0, 0, 0.1);">
<view v-if="userInfo.hotel != null && userInfo.hotel.checkState=='C1'"
class="innTag acea-row row-middle row-center align-left" @click="innTagClick">
<image style="width: 36rpx;height: 36rpx;" :src="webUrl+'/20230304133702462853.png'" mode=""></image>
<view class="innTag acea-row row-middle row-center align-left" @click="innTagClick" v-if="userInfo.hotel != null && userInfo.hotel.checkState=='C1'">
<image style="width: 36rpx;height: 36rpx;" :src="webUrl+'/20240107224552660125.png'" mode=""></image>
<text style="font-size: 24rpx;color: #ffffff;">店铺主页</text>
</view>
<view class="acea-row row-between-wrapper"
style="margin-top: 40rpx;background: #0DC5C5 !important;border-top-left-radius: 16rpx;border-top-right-radius: 16rpx;padding: 30rpx;">
<view class="picTxt acea-row" style="flex-wrap: nowrap;flex: 1;">
<view class="pictrue">
<image :src="userInfo.avatar"/>
</view>
<view class="text acea-row row-column-between">
<view class="acea-row row-middle">
<view class="name line1"
style="color: #000000 !important;font-size: 28rpx !important;font-weight: 500;">
{{ userInfo.nickname }}
</view>
<view class="member acea-row row-middle" v-if="userInfo.vip">
<image :src="userInfo.vipIcon"/>
<text>{{ userInfo.vipName }}</text>
</view>
<!-- background: #0DC5C5 !important;border-top-left-radius: 16rpx;border-top-right-radius: 16rpx;-->
<view class="center-box" :style="{'backgroundImage':`url(${webUrl}/20240111201405837746.png)`}">
<view class="flex jc-between"
style="padding: 30rpx;">
<view class="picTxt acea-row" style="flex-wrap: nowrap;flex: 1;">
<view class="pictrue">
<image :src="userInfo.avatar"/>
</view>
<view class="acea-row row-middle" style="margin-top: 8rpx;">
<view class="vip-box acea-row row-center row-middle">
<text class="vip-title">{{ userInfo.levelName }}</text>
<view class="text acea-row row-column-between">
<view class="acea-row row-middle">
<view class="name line1"
style="color: #000000 !important;font-size: 28rpx !important;font-weight: 500;">
{{ userInfo.nickname }}
</view>
<view class="member acea-row row-middle" v-if="userInfo.vip">
<image :src="userInfo.vipIcon"/>
<text>{{ userInfo.vipName }}</text>
</view>
</view>
<view v-if="userLevelInfo && userLevelInfo.idcardOne && userLevelInfo.checkState!=3"
class="protocol-state-box">
{{ protocolCheckState(userLevelInfo.checkState) }}
<view class="acea-row row-middle" style="margin-top: 8rpx;">
<view class="vip-box btn-change acea-row row-center row-middle">
<text class="vip-title">{{ userInfo.levelName }}</text>
</view>
<view v-if="userLevelInfo && userLevelInfo.idcardOne && userLevelInfo.checkState!=3"
class="protocol-state-box">
{{ protocolCheckState(userLevelInfo.checkState) }}
</view>
</view>
</view>
</view>
</view>
<view class="acea-row row-column row-middle" style="flex-shrink: 0;">
<view class="promotion-code-box acea-row row-center row-middle" @click="goPromotionPoster()">
<image style="width: 48rpx;height: 48rpx;" :src="webUrl+'/20210819110607117638.png'" mode=""></image>
<view class="promotion-code-box flex jc-center ai-center" @click="goPromotionPoster()">
<image style="width: 24rpx;height: 24rpx;" :src="webUrl+'/20240111201400020095.png'" mode=""></image>
会员码
</view>
</view>
</view>
<view class="acea-row row-middle row-around"
style="padding:0 30rpx 30rpx 30rpx;margin-bottom: 20rpx;background: #0DC5C5 !important;border-bottom-left-radius: 16rpx;border-bottom-right-radius: 16rpx">
<view class="acea-row row-middle" @click="goBindParent()">
<image style="width: 48rpx;height: 48rpx;margin-right: 10rpx;" :src="webUrl+'/20210515195227226132.png'"
mode=""></image>
<text style="font-size: 24rpx;color: #fff;">扫一扫</text>
</view>
<view class="vline"></view>
<view class="acea-row row-middle" @click="goLikeList()">
<image style="width: 48rpx;height: 48rpx;margin-right: 10rpx;" :src="webUrl+'/20230304134637330341.png'"
mode=""></image>
<text style="font-size: 24rpx;color: #fff;">收藏</text>
</view>
<view class="vline"></view>
<view class="acea-row row-middle" style="position: relative;" @click="goMessageData()">
<image style="width: 48rpx;height: 48rpx;margin-right: 10rpx;" :src="webUrl+'/20230304135730954990.png'"
mode=""></image>
<text style="font-size: 24rpx;color: #fff;">消息</text>
<view v-if="unreadMsgList.length>0" class="unread-dot"></view>
</view>
<view class="vline"></view>
<view class="acea-row row-middle" @click="goPersonalData()">
<image style="width: 48rpx;height: 48rpx;margin-right: 10rpx;" :src="webUrl+'/20230304203605140668.png'"
mode=""></image>
<text style="font-size: 24rpx;color: #fff;">设置</text>
<view class="acea-row row-middle row-around" style="margin-bottom: 20rpx;
padding: 0 30rpx 30rpx 30rpx;">
<view class="acea-row row-middle" @click="goBindParent()">
<image style="width: 48rpx;height: 48rpx;margin-right: 10rpx;" :src="webUrl+'/20240107224558355949.png'"
mode=""></image>
<text style="font-size: 24rpx;color: #fff;">扫一扫</text>
</view>
<view class="vline"></view>
<view class="acea-row row-middle" @click="goLikeList()">
<image style="width: 48rpx;height: 48rpx;margin-right: 10rpx;" :src="webUrl+'/20240107224606011625.png'"
mode=""></image>
<text style="font-size: 24rpx;color: #fff;">收藏</text>
</view>
<view class="vline"></view>
<view class="acea-row row-middle" style="position: relative;" @click="goMessageData()">
<image style="width: 48rpx;height: 48rpx;margin-right: 10rpx;" :src="webUrl+'/20240107224620893707.png'"
mode=""></image>
<text style="font-size: 24rpx;color: #fff;">消息</text>
<view v-if="unreadMsgList.length>0" class="unread-dot"></view>
</view>
<view class="vline"></view>
<view class="acea-row row-middle" @click="goPersonalData()">
<image style="width: 48rpx;height: 48rpx;margin-right: 10rpx;" :src="webUrl+'/20240107224612250643.png'"
mode=""></image>
<text style="font-size: 24rpx;color: #fff;">设置</text>
</view>
</view>
</view>
<view class="acea-row row-column" style="border-bottom-left-radius: 16rpx;border-bottom-right-radius: 16rpx;">
@@ -94,12 +96,12 @@
<text style="font-size: 26rpx;color: #333333;font-weight: 400;">我的账户</text>
</view>
<view class="nav acea-row row-column" style="padding: 25rpx;">
<view class="nav acea-row row-column" style="padding:24rpx 12rpx">
<view class="acea-row row-middle row-between"
style="padding-bottom: 30rpx;margin-bottom: 20rpx;border-bottom: 1px solid #f6f6f6;">
<view @click="goUserAccount()" class="acea-row row-middle" style="flex-grow: 1;">
<view class="acea-row row-middle" style="margin-right: 20rpx;">
<image style="width: 40rpx;height: 40rpx;" :src="webUrl+'/20210807160248159814.png'" mode=""></image>
<image style="width: 56rpx;height: 56rpx" :src="webUrl+'/20240107224629408613.png'" mode=""></image>
</view>
<view class="acea-row row-column">
<text style="color: #999999;font-size: 20rpx;font-weight: 400;">余额</text>
@@ -110,7 +112,7 @@
</view>
<view class="acea-row row-middle" style="color: #fff;font-size: 24rpx;flex-shrink: 0;">
<view @click="goWithdrawl()" class="withdrawBtn" style="margin-right: 10rpx;">提现</view>
<view @click="goWithdrawl()" class="withdrawBtn btn-change" style="margin-right: 10rpx;">提现</view>
<view @click="goAccountDetail()" class="accountDetailBtn">账户明细</view>
</view>
</view>
@@ -119,7 +121,7 @@
<view class="acea-row row-middle">
<view class="acea-row row-middle" style="margin-right: 20rpx;">
<image style="width: 40rpx;height: 40rpx;" :src="webUrl+'/20210807160409159991.png'" mode=""></image>
<image style="width: 56rpx;height: 56rpx;" :src="webUrl+'/20240107224636733995.png'" mode=""></image>
</view>
<view class="acea-row row-column">
<text style="color: #999999;font-size: 20rpx;font-weight: 400;">恭喜你成为了{{ userInfo.levelName }}
@@ -153,7 +155,7 @@
<view class="orderState acea-row row-middle">
<view @click="goMyOrder(1)" class="item">
<view class="pictrue">
<image :src="webUrl+'/20230526120059732570.png'"/>
<image style="width:52rpx;height: 52rpx" :src="webUrl+'/20240107224703391856.png'"/>
<text
class="order-status-num"
v-if="orderStatusNum.unpaidCount > 0"
@@ -164,7 +166,7 @@
</view>
<view @click="goMyOrder(2)" class="item">
<view class="pictrue">
<image :src="webUrl+'/20230526120053924703.png'"/>
<image style="width:52rpx;height: 52rpx" :src="webUrl+'/20240107224656826240.png'"/>
<text
class="order-status-num"
v-if="orderStatusNum.unshippedCount > 0"
@@ -175,7 +177,7 @@
</view>
<view @click="goMyOrder(3)" class="item">
<view class="pictrue">
<image :src="webUrl+'/20230526120107983364.png'"/>
<image style="width:52rpx;height: 52rpx" :src="webUrl+'/20240107224650489311.png'"/>
<text
class="order-status-num"
v-if="orderStatusNum.receivedCount > 0"
@@ -186,7 +188,7 @@
</view>
<view @click="goMyOrder(4)" class="item">
<view class="pictrue">
<image :src="webUrl+'/20230526114414134581.png'"/>
<image style="width:52rpx;height: 52rpx" :src="webUrl+'/20240109234147411394.png'"/>
<text
class="order-status-num"
v-if="orderStatusNum.evaluatedCount > 0"
@@ -197,7 +199,7 @@
</view>
<view @click="goReturnList()" class="item">
<view class="pictrue">
<image :src="webUrl+'/20230304203355905710.png'"/>
<image style="width:52rpx;height: 52rpx" :src="webUrl+'/20240107224643038018.png'"/>
<text
class="order-status-num"
v-if="orderStatusNum.refundCount > 0"
@@ -250,25 +252,25 @@
<text class="iconfont icon-jiantou"></text>
</view>
<view v-if="userInfo.hotel==null || userInfo.hotel.checkState!='C1'" class="item" @click="goInnApply()">
<view class="pictrue">
<image :src="webUrl+'/20221010170138874734.png'"/>
</view>
<view class="cell acea-row row-between row-middle" style="flex-wrap: nowrap;">
<view class="" style="flex-shrink: 0;margin-right: 10rpx;">申请我的店铺</view>
<view v-if="userInfo.hotel!=null" class="acea-row row-column row-right" style="text-align: right;">
<view class="" style="font-size: 24rpx;color: #0DC5C5;">
{{ checkStateStr(userInfo.hotel.checkState) }}
</view>
<!-- <view v-if="userInfo.hotel==null || userInfo.hotel.checkState!='C1'" class="item" @click="goInnApply()">-->
<!-- <view class="pictrue">-->
<!-- <image :src="webUrl+'/20221010170138874734.png'"/>-->
<!-- </view>-->
<!-- <view class="cell acea-row row-between row-middle" style="flex-wrap: nowrap;">-->
<!-- <view class="" style="flex-shrink: 0;margin-right: 10rpx;">申请我的店铺</view>-->
<!-- <view v-if="userInfo.hotel!=null" class="acea-row row-column row-right" style="text-align: right;">-->
<!-- <view class="" style="font-size: 24rpx;color: #0DC5C5;">-->
<!-- {{ checkStateStr(userInfo.hotel.checkState) }}-->
<!-- </view>-->
<block v-if="userInfo.hotel.checkState=='C2' && userInfo.hotel.checkMsg.length>0">
<text style="font-size: 24rpx;color: #aaa;">驳回原因:{{ userInfo.hotel.checkMsg }}</text>
</block>
</view>
<!-- <block v-if="userInfo.hotel.checkState=='C2' && userInfo.hotel.checkMsg.length>0">-->
<!-- <text style="font-size: 24rpx;color: #aaa;">驳回原因:{{ userInfo.hotel.checkMsg }}</text>-->
<!-- </block>-->
<!-- </view>-->
</view>
<text class="iconfont icon-jiantou"></text>
</view>
<!-- </view>-->
<!-- <text class="iconfont icon-jiantou"></text>-->
<!-- </view>-->
<view v-if="userInfo.hotel != null && userInfo.hotel.checkState=='C1'" class="item"
@click="goInnInfoEdit()">
@@ -310,6 +312,7 @@
</uni-popup>
</view>
</template>
<script>
import {mapGetters, mapMutations} from "vuex";
import {
@@ -655,8 +658,11 @@ export default {
this.$yrouter.push("/pkg_user/views/personalData");
},
goLikeList() {
uni.navigateTo({
url:'/pkg_user/views/myFavorite'
})
//跳转到我的喜欢列表
this.$yrouter.push("/pages/user/UserFavorite/UserFavorite");
// this.$yrouter.push("/pages/user/UserFavorite/UserFavorite");
},
getPhoneNumber: function (e) {
let thit = this;
@@ -857,10 +863,6 @@ export default {
</script>
<style lang="less">
page {
background-color: #FFF;
}
.user .header .picTxt .pictrue {
width: 76rpx !important;
height: 76rpx !important;
@@ -875,7 +877,7 @@ page {
width: 196rpx;
height: 64rpx;
border-radius: 0px 32rpx 32rpx 0px;
background: #0DC5C5;
background: #C51919;
}
.order-status-num {
@@ -916,17 +918,23 @@ page {
}
.promotion-code-box {
position: relative;
padding: 8rpx 8rpx 16rpx 8rpx;
box-sizing: border-box;
width: 120rpx;
height: 40rpx;
border-radius: 20rpx;
background: #9C1C1A;
color: #FFFFFF;
font-size: 22rpx;
}
.user .header .picTxt .text {
width: auto !important;
}
.btn-change {
background: linear-gradient(180deg, #F8F3B4 0%, #F2CB6F 100%);
}
.vip-box {
background: linear-gradient(to right, #FFECC2, #E8CE87);
border-radius: 8rpx;
padding: 4rpx 8rpx;
margin-right: 20rpx;
@@ -990,11 +998,6 @@ page {
border-radius: 24px;
}
.item-img {
width: 48rpx;
height: 48rpx;
}
.wrapper {
// background-color: #FFF;
margin: 0 30rpx;
@@ -1057,8 +1060,7 @@ page {
}
.withdrawBtn {
background: #593D13;
color: #fff;
color: #482D00;
font-size: 24rpx;
width: 132rpx;
height: 48rpx;
@@ -1068,7 +1070,7 @@ page {
}
.accountDetailBtn {
background: #FF564A;
background: #C51718;
color: #fff;
font-size: 24rpx;
width: 132rpx;
@@ -1079,7 +1081,7 @@ page {
}
.benifitIntroBtn {
background: #0DC5C5;
background: #C51718;
color: #fff;
font-size: 24rpx;
width: 132rpx;
@@ -1089,4 +1091,14 @@ page {
border-radius: 24rpx;
}
.center-box {
width: 632rpx;
height: 218rpx;
margin-top: 40rpx;
background-size: 632rpx 218rpx;
background-repeat: no-repeat;
//background: #0DC5C5 !important;
//border-bottom-left-radius: 16rpx;
//border-bottom-right-radius: 16rpx
}
</style>
@@ -50,9 +50,9 @@
</view>
</view>
<Loading :loaded="loadend" :loading="loading"></Loading>
<view class="noCommodity" v-if="addressList.length < 1 && page > 1">
<view class="noCommodity flex jc-center" v-if="addressList.length < 1 && page > 1">
<view class="noPictrue">
<image :src="webUrl+'/20210203154438492268.png'" class="image"/>
<image :src="webUrl+'/20240102232705995178.png'" class="image"/>
</view>
</view>
<view style="height:100rpx;"></view>
-107
View File
@@ -1,107 +0,0 @@
<template>
<view ref="container">
<div class="coupon-list" v-if="couponsList.length > 0">
<div
class="item acea-row row-center-wrapper"
v-for="(item, index) in couponsList"
:key="index"
>
<div class="money" :class="item.isUse ? 'moneyGray' : ''">
<div>
<span class="num">{{ item.couponPrice }}</span>
</div>
<div class="pic-num">{{ item.useMinPrice }}元可用</div>
</div>
<div class="text">
<div class="condition line1">
<span class="line-title bg-color-check" v-if="item.ctype === 0">通用劵</span>
<span class="line-title bg-color-check" v-else-if="item.ctype === 1">商品券</span>
<span class="line-title bg-color-check" v-else>未知</span>
<span>{{ item.cname }}</span>
</div>
<div class="data acea-row row-between-wrapper">
<div v-if="item.endTime !== 0">{{ item.startTime }}-{{ item.endTime }}</div>
<div v-else>不限时</div>
<div class="bnt gray" v-if="item.isUse === true">已领取</div>
<div class="bnt gray" v-else-if="item.isUse === 2">已领完</div>
<div class="bnt bg-color-red" v-else @click="getCoupon(item.id, index)">立即领取</div>
</div>
</div>
</div>
</div>
<Loading :loaded="loadend" :loading="loading"></Loading>
<!--暂无优惠券-->
<view class="noCommodity" v-if="couponsList.length === 0 && page > 1">
<view class="noPictrue">
<image src="http://admin-api.xdd618.com/file/pic/20210203154207179472.png" class="image" />
</view>
</view>
</view>
</template>
<script>
import { getCoupon, getCouponReceive } from "@/api/user";
import Loading from "@/components/Loading";
import DataFormatT from "@/components/DataFormatT";
export default {
name: "getCoupon",
components: {
Loading,
DataFormatT
},
props: {},
data: function() {
return {
page: 1,
limit: 10,
couponsList: [],
loading: false,
loadend: false
};
},
mounted: function() {
this.getUseCoupons();
},
onReachBottom() {
!this.loading && this.getUseCoupons();
},
methods: {
getCoupon: function(id, index) {
let that = this;
let list = that.couponsList;
getCouponReceive(id)
.then(function(res) {
list[index].isUse = true;
uni.showToast({
title: "领取成功",
icon: "success",
duration: 2000
});
})
.catch(function(err) {
uni.showToast({
title:
err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
});
},
getUseCoupons: function() {
let that = this;
if (that.loading) return; //阻止下次请求(false可以进行请求);
if (that.loadend) return; //阻止结束当前请求(false可以进行请求);
that.loading = true;
let q = { page: that.page, limit: that.limit };
getCoupon(q).then(res => {
that.loading = false;
//apply();js将一个数组插入另一个数组;
that.couponsList.push.apply(that.couponsList, res.data);
that.loadend = res.data.length < that.limit; //判断所有数据是否加载完成;
that.page = that.page + 1;
});
}
}
};
</script>
-79
View File
@@ -1,79 +0,0 @@
<template>
<view ref="container">
<div class="coupon-list" v-if="couponsList.length > 0">
<div
class="item acea-row row-center-wrapper"
v-for="(item, index) in couponsList"
:key="index"
>
<div class="money" :class="item._type === 0 ? 'moneyGray' : ''">
<div>
<span class="num">{{ item.couponPrice }}</span>
</div>
<div class="pic-num">{{ item.useMinPrice }}元可用</div>
</div>
<div class="text">
<div class="condition line1">
{{ item.couponTitle }}
</div>
<div class="data acea-row row-between-wrapper">
<div v-if="item.endTime === 0">不限时</div>
<div v-else>{{ item.createTime }}-{{ item.endTime }}</div>
<div class="bnt gray" v-if="item._type === 0">{{ item._msg }}</div>
<div class="bnt bg-color-red" v-else>{{ item._msg }}</div>
</div>
</div>
</div>
</div>
<!--暂无优惠券-->
<view
class="noCommodity"
v-if="couponsList.length === 0 && loading === true"
>
<view class="noPictrue">
<image src="http://admin-api.xdd618.com/file/pic/20210203154207179472.png" class="image"/>
</view>
</view>
</view>
</template>
<script>
import {getCouponsUser} from "@/api/user";
import DataFormatT from "@/components/DataFormatT";
const NAME = "UserCoupon";
export default {
name: "UserCoupon",
components: {
DataFormatT
},
props: {},
data: function () {
return {
couponsList: [],
loading: false
};
},
watch: {
$yroute: function (n) {
var that = this;
if (n.name === NAME) {
that.getUseCoupons();
}
}
},
mounted: function () {
this.getUseCoupons();
},
methods: {
getUseCoupons: function () {
let that = this,
type = 0;
getCouponsUser(type).then(res => {
that.couponsList = res.data;
that.loading = true;
});
}
}
};
</script>
-162
View File
@@ -1,162 +0,0 @@
<template>
<view class="commission-details" ref="container">
<view class="promoterHeader bg-color-red">
<view class="headerCon acea-row row-between-wrapper">
<view>
<view class="name">提现记录</view>
<view class="money">
<text class="num">{{ force2Decimal(commission) }}</text>
</view>
</view>
<view class="iconfont icon-jinbi1"></view>
</view>
</view>
<view class="sign-record" ref="content">
<view class="list">
<view class="item">
<view class="listn" v-for="(item, infoIndex) in info" :key="infoIndex">
<view class="itemn acea-row row-column row-center">
<view class="acea-row row-middle row-between">
<view class="txt">提现金额:<text class="font-color-red">{{ force2Decimal(item.extractPrice) }}</text></view>
<view class="txt">手续费:<text class="font-color-red">{{ force2Decimal(item.extractSxf) }}</text></view>
</view>
<view class="txt" v-if="item.status==-1">失败原因:{{item.failMsg}}</view>
<view class="acea-row row-middle row-between row-center">
<view class="txt">{{item.createTime}}</view>
<view class="txt font-color-green">{{item.statusText}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- <view class="sign-record" ref="content">
<view class="list">
<view class="item" v-for="(item, infoIndex) in info" :key="infoIndex">
<view class="data">{{ item.time }}</view>
<view class="listn" v-for="(val, indexn) in item.list" :key="indexn">
<view class="itemn acea-row row-between-wrapper">
<view>
<view class="name line1">{{ val.title }}</view>
<view>{{ val.addTime }}</view>
</view>
<view class="num" v-if="val.pm == 1">+{{ force2Decimal(val.number) }}</view>
<view class="num font-color-red" v-if="val.pm == 0">-{{ force2Decimal(val.number) }}</view>
</view>
</view>
</view>
</view>
</view> -->
<Loading :loaded="loaded" :loading="loading"></Loading>
</view>
</template>
<script>
import { getCommissionInfo, getSpreadInfo,getWithdrawalRecordList } from "@/api/user";
import Loading from "@/components/Loading";
import { formatDateTime,isNullOrEmpty} from "@/utils";
export default {
name: "CashRecord",
components: {
Loading
},
props: {},
data: function() {
return {
info: [],
commission: 0,
where: {
page: 1,
limit: 10
},
types: 4,
loaded: false,
loading: false
};
},
mounted: function() {
this.getCommission();
this.getIndex();
},
onReachBottom() {
this.loading === false && this.getIndex();
},
methods: {
fitDateString(str,format){
return formatDateTime(str,format);
},
force2Decimal(v){
return this.$force2Decimal(v);
},
getIndex: function() {
let that = this;
if (that.loading == true || that.loaded == true) return;
that.loading = true;
getWithdrawalRecordList(that.where).then(
//getCommissionInfo(that.where, that.types).then(
res => {
that.loading = false;
that.loaded = res.data.length < that.where.limit;
that.where.page = that.where.page + 1;
that.info.push.apply(that.info, res.data.map((item)=>{
switch (item.status){
case -1:
item.statusText = "提现未通过";
break;
case 0:
item.statusText = "提现审核中";
break;
case 1:
item.statusText = "提现已完成";
break;
case 2:
item.statusText = "提现待打款";
break;
default:
break;
}
return item;
}));
},
err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none',
duration: 2000
});
}
);
},
getCommission: function() {
let that = this;
getSpreadInfo().then(
res => {
that.commission = res.data.commissionCount;
},
err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none",
duration: 2000
});
}
);
}
}
};
</script>
<style>
.txt{
font-size: 28rpx;
color: #282828;
margin-bottom: 10rpx;
}
.sign-record .list .item .listn .itemn{
height: auto;
padding-top: 10rpx;
}
</style>
+1 -1
View File
@@ -129,7 +129,7 @@ export default {
this.$yrouter.push("/pages/user/promotion/Poster/index");
},
goCashRecord() {
this.$yrouter.push("/pages/user/promotion/CashRecord/index");
this.$yrouter.push('/pkg_user/views/withdrawalLog');
},
goPromoterList() {
this.$yrouter.push("/pages/user/promotion/PromoterList/index");