Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop-uniapp

This commit is contained in:
paulGao
2022-11-04 17:56:57 +08:00
41 changed files with 2087 additions and 1380 deletions

View File

@@ -98,18 +98,18 @@
},
onBackPress(e) {
if (e.from == "backbutton") {
if(this.routerVal.recharge_sn){
uni.switchTab({
url: '/pages/tabbar/user/my'
});
}
else{
uni.redirectTo({
url: "/pages/order/myOrder?status=0",
});
}
return true; //阻止默认返回行为
}
if(this.routerVal.recharge_sn){
uni.switchTab({
url: '/pages/tabbar/user/my'
});
}
else{
uni.navigateTo({
url: "/pages/order/myOrder?status=0",
});
}
return true; //阻止默认返回行为
}
},
mounted() {
this.cashierData();

View File

@@ -1,6 +1,6 @@
<template>
<view class="wap">
<u-navbar back-text="" title="预存款列表">
<u-navbar title="预存款列表">
</u-navbar>
<view class="wrapper-show-money">
<view class="money-view">
@@ -28,7 +28,7 @@
</view>
<u-empty v-if="datas.length==0" mode="history" text="暂无记录" />
<u-loadmore v-else bg-color='#f8f8f8' :status="status" />
</scroll-view>
</swiper-item>
@@ -45,7 +45,7 @@ export default {
data() {
return {
walletNum: 0,
status: "loadmore",
current: 0,
swiperCurrent: 0,
userInfo: "", //用户详情信息
@@ -82,27 +82,23 @@ export default {
/**分页获取预存款充值记录 */
getRecharge() {
this.status = "loading";
getUserRecharge(this.params).then((res) => {
if (res.data.success) {
if (res.data.result.records.length != 0) {
this.status = "loadmore";
this.datas.push(...res.data.result.records);
} else {
this.status = "nomore";
}
}
});
},
getWallet() {
this.status = "loading";
getWalletLog(this.params).then((res) => {
if (res.data.success) {
if (res.data.result.records.length != 0) {
this.datas.push(...res.data.result.records);
} else {
this.status = "nomore";
}
}
});

View File

@@ -1,18 +1,18 @@
<template>
<div class="wrapper">
<u-parse v-html="res.content"></u-parse>
<u-parse :show-with-animation="true" :lazy-load="true" :selectable="true" :html="res.content" v-if="res"></u-parse>
</div>
</template>
<script>
import { getArticleDetail } from "@/api/article";
import { getArticleDetailByType } from "@/api/article";
export default {
data() {
return {
res: "",
way: {
user: {
title: "用户协议",
title: "服务协议",
type: "USER_AGREEMENT",
},
privacy: {
@@ -40,9 +40,10 @@ export default {
methods: {
init(option) {
getArticleDetail(this.way[option.type].type).then((res) => {
getArticleDetailByType(this.way[option.type].type).then((res) => {
if (res.data.success) {
this.res = res.data.result;
console.log(res)
}
});
},

View File

@@ -20,10 +20,10 @@
<u-cell-item title="检查更新" @click="checkUpdate"></u-cell-item>
<!-- #endif -->
<u-cell-item title="证照信息" @click="navigateTo('/pages/mine/help/tips?type=message')"></u-cell-item>
<u-cell-item title="服务协议" @click="navigateTo('/pages/mine/help/tips?type=user')"></u-cell-item>
<u-cell-item title="隐私协议" @click="navigateTo('/pages/mine/help/tips?type=privacy')"></u-cell-item>
<u-cell-item title="关于我们" :border-bottom="false" @click="navigateTo('/pages/mine/help/tips?type=about')"></u-cell-item>
<u-cell-item title="证照信息" @click="navigateTo('/pages/mine/help/tips?type=LICENSE_INFORMATION')"></u-cell-item>
<u-cell-item title="服务协议" @click="navigateTo('/pages/mine/help/tips?type=USER_AGREEMENT')"></u-cell-item>
<u-cell-item title="隐私协议" @click="navigateTo('/pages/mine/help/tips?type=PRIVACY_POLICY')"></u-cell-item>
<u-cell-item title="关于我们" :border-bottom="false" @click="navigateTo('/pages/mine/help/tips?type=ABOUT')"></u-cell-item>
</u-cell-group>

View File

@@ -35,7 +35,8 @@
@click="doSearch(keyword)">
<span>{{ keyword }} </span>
</div>
<div @click="showMore" v-if=" oldKeywordIndex > loadIndex" class="oldKeyItem">展示更多</div>
<div @click="showMore" v-if="oldKeywordIndex > loadIndex" class="oldKeyItem">展示更多</div>
</div>
</view>
@@ -202,7 +203,7 @@ export default {
empty:false,
scrollTop: 0,
loadIndex: 10,
oldKeywordIndex: "",
oldKeywordIndex: 0,
selectedWay: {
brand: [],
categoryId: [],
@@ -370,15 +371,6 @@ export default {
return array;
}
},
// 格式化金钱 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return val.toFixed(2).split(".");
},
// 展示更多数据
showMore() {
this.loadOldKeyword(this.oldKeywordIndex);
@@ -579,7 +571,7 @@ export default {
key: "OldKeys",
success: (res) => {
var OldKeys = JSON.parse(res.data);
this.oldKeywordIndex = res.data.length;
this.oldKeywordIndex = OldKeys.length;
for (let i = 0; i < index; i++) {
this.oldKeywordList.push(OldKeys[i]);
}

View File

@@ -147,9 +147,9 @@
<p class="goods-prices">
<span></span>
<span class="goods-price">{{
formatPrice(val.goodsSku.price)[0]
$options.filters.goodsFormatPrice(val.purchasePrice)[0]
}}</span>
<span>.{{ formatPrice(val.goodsSku.price)[1] }}</span>
<span>.{{ $options.filters.goodsFormatPrice(val.purchasePrice)[1] }}</span>
</p>
</div>
</div>
@@ -315,10 +315,10 @@
<div v-if="!orderMessage.priceDetailDTO.payPoint" class="number">
<span>¥</span>
<span class="price">{{
formatPrice(orderMessage.priceDetailDTO.flowPrice)[0]
$options.filters.goodsFormatPrice(orderMessage.priceDetailDTO.flowPrice)[0]
}}</span>
<span
>.{{ formatPrice(orderMessage.priceDetailDTO.flowPrice)[1] }}
>.{{ $options.filters.goodsFormatPrice(orderMessage.priceDetailDTO.flowPrice)[1] }}
</span>
</div>
<span v-else class="number"
@@ -421,7 +421,7 @@ export default {
item.route == "pages/tabbar/cart/cartList" ||
item.route.indexOf("pages/product/goods") != -1
) {
uni.redirectTo({
uni.navigateTo({
url: item.route,
});
}
@@ -455,13 +455,6 @@ export default {
mounted() {},
methods: {
// 格式化金钱 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return val.toFixed(2).split(".");
},
//发票回调 选择发票之后刷新购物车
async callbackInvoice(val) {
this.invoiceFlag = false;
@@ -611,7 +604,7 @@ export default {
});
// 如果当前价格为0跳转到订单列表
if (this.orderMessage.priceDetailDTO.billPrice == 0) {
uni.redirectTo({
uni.navigateTo({
url: "/pages/order/myOrder?status=0",
});
} else {
@@ -675,7 +668,7 @@ export default {
});
}
if (res.data.result.skuList.length <= 0) {
uni.redirectTo({
uni.navigateTo({
url: "/pages/order/myOrder?status=0",
});
}

View File

@@ -311,7 +311,7 @@ export default {
*/
onBackPress(e) {
if (e.from == "backbutton") {
uni.reLaunch({
uni.switchTab({
url: "/pages/tabbar/user/my",
});
return true; //阻止默认返回行为
@@ -331,7 +331,7 @@ export default {
this.initData(0);
}
}
this.loadData(this.status);
// this.loadData(this.status);
},
onLoad(options) {

File diff suppressed because it is too large Load Diff

View File

@@ -151,12 +151,12 @@
<span v-else>
<span v-if="wholesaleList.length">
<span>¥</span><span class="price">{{ formatPrice(wholesaleList[wholesaleList.length-1].price)[0] }}</span>.{{ formatPrice(wholesaleList[wholesaleList.length-1].price)[1] }}
<span>¥</span><span class="price">{{ $options.filters.goodsFormatPrice(wholesaleList[wholesaleList.length-1].price)[0] }}</span>.{{ $options.filters.goodsFormatPrice(wholesaleList[wholesaleList.length-1].price)[1] }}
~
<span>¥</span><span class="price">{{ formatPrice(wholesaleList[0].price)[0] }}</span>.{{ formatPrice(wholesaleList[0].price)[1] }}
<span>¥</span><span class="price">{{ $options.filters.goodsFormatPrice(wholesaleList[0].price)[0] }}</span>.{{ $options.filters.goodsFormatPrice(wholesaleList[0].price)[1] }}
</span>
<span v-else>
<span>¥</span><span class="price">{{ formatPrice(goodsDetail.price)[0] }}</span>.{{ formatPrice(goodsDetail.price)[1] }}
<span>¥</span><span class="price">{{ $options.filters.goodsFormatPrice(goodsDetail.price)[0] }}</span>.{{ $options.filters.goodsFormatPrice(goodsDetail.price)[1] }}
</span>
</span>
</view>
@@ -752,14 +752,6 @@ export default {
// // #endif
},
// 格式化金钱 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return val.toFixed(2).split(".");
},
/**选择商品 */
changedGoods(val) {
this.selectedGoods = val;

View File

@@ -21,15 +21,15 @@
>
<span class="flex-price">
{{ formatPrice(detail.promotionPrice)[0] }}.{{
formatPrice(detail.promotionPrice)[1]
{{ $options.filters.goodsFormatPrice(detail.promotionPrice)[0] }}.{{
$options.filters.goodsFormatPrice(detail.promotionPrice)[1]
}}</span
>
</span>
<view class="u-group-flex" v-if="detail.price != undefined">
<span class="old-price"
>¥{{ formatPrice(detail.price)[0] }}.{{
formatPrice(detail.price)[1]
>¥{{ $options.filters.goodsFormatPrice(detail.price)[0] }}.{{
$options.filters.goodsFormatPrice(detail.price)[1]
}}</span
>
<view class="promotion">限时抢购</view>
@@ -42,8 +42,8 @@
<span
class="flex-price"
v-if="promotion.groupbuy_goods_vo.price != undefined"
>¥{{ formatPrice(promotion.groupbuy_goods_vo.price)[0] }}.{{
formatPrice(promotion.groupbuy_goods_vo.price)[1]
>¥{{ $options.filters.goodsFormatPrice(promotion.groupbuy_goods_vo.price)[0] }}.{{
$options.filters.goodsFormatPrice(promotion.groupbuy_goods_vo.price)[1]
}}</span
>
<!-- <span v-if="promotion.point">+{{promotion.point}}积分</span> -->
@@ -53,9 +53,9 @@
class="old-price"
v-if="promotion.groupbuy_goods_vo.original_price != undefined"
>¥{{
formatPrice(promotion.groupbuy_goods_vo.original_price)[0]
$options.filters.goodsFormatPrice(promotion.groupbuy_goods_vo.original_price)[0]
}}.{{
formatPrice(promotion.groupbuy_goods_vo.original_price)[1]
$options.filters.goodsFormatPrice(promotion.groupbuy_goods_vo.original_price)[1]
}}</span
>
<view class="promotion">团购活动</view>
@@ -68,13 +68,13 @@
v-if="detail.promotionPrice != undefined"
>
¥<span class="flex-price">
{{ formatPrice(detail.promotionPrice)[0] }}.</span
>{{ formatPrice(detail.promotionPrice)[1] }}
{{ $options.filters.goodsFormatPrice(detail.promotionPrice)[0] }}.</span
>{{ $options.filters.goodsFormatPrice(detail.promotionPrice)[1] }}
</span>
<view class="u-group-flex" v-if="detail.price != undefined">
<span class="old-price"
>¥{{ formatPrice(detail.price)[0] }}.{{
formatPrice(detail.price)[1]
>¥{{ $options.filters.goodsFormatPrice(detail.price)[0] }}.{{
$options.filters.goodsFormatPrice(detail.price)[1]
}}</span
>
<view class="promotion">拼团活动</view>
@@ -141,13 +141,6 @@ export default {
},
mounted() {},
methods: {
// 格式化金钱 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return val.toFixed(2).split(".");
},
getCountDownTime(val) {
let date = new Date(val);
let timeSimple = new Date(date).getTime() / 1000;

View File

@@ -32,7 +32,7 @@
{{ item.content.goodsName }}
</view>
<view class="item-price" v-if="item.price != undefined">
<span class="item-price-blod">{{ formatPrice(item.content.price)[0] }}</span>.{{ formatPrice(item.content.price)[1] }}
<span class="item-price-blod">{{ $options.filters.goodsFormatPrice(item.content.price)[0] }}</span>.{{ $options.filters.goodsFormatPrice(item.content.price)[1] }}
</view>
</view>
</view>
@@ -48,13 +48,6 @@ export default {
props: ["res", "goodsDetail", "storeDetail"],
mounted() {},
methods: {
// 格式化金钱 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return val.toFixed(2).split(".");
},
// 点击商品
clickGoods(val) {
uni.navigateTo({

View File

@@ -82,13 +82,7 @@ export default {
this.storeList = [];
this.init();
},
// 格式化金钱 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return val.toFixed(2).split(".");
},
async init() {
let res = await getStoreList(this.params);
if (res.data.success) {

View File

@@ -527,7 +527,7 @@ export default {
color: #999;
}
.contant {
.content {
margin-top: 20rpx;
display: flex;
flex-wrap: wrap;

View File

@@ -79,8 +79,8 @@
<view class="sp-price">
<div class="default-color" :class="{'main-color':Object.keys(skuItem.promotionMap).length ==0 }">
<span>{{ formatPrice(skuItem.goodsSku.price)[0] }}</span>
<span>.{{ formatPrice(skuItem.goodsSku.price)[1] }}</span>
<span>{{ $options.filters.goodsFormatPrice(skuItem.goodsSku.price)[0] }}</span>
<span>.{{ $options.filters.goodsFormatPrice(skuItem.goodsSku.price)[1] }}</span>
</div>
</view>
<view>
@@ -108,8 +108,8 @@
<!-- 如果有活动 并且是选中的状态,显示预估到手价格 -->
<div class="priceDetail-flowPrice" :class="{'main-color':skuItem.priceDetailDTO}"
v-if="skuItem.priceDetailDTO && skuItem.invalid == 0 && Object.keys(skuItem.promotionMap).length != 0 && skuItem.checked && skuItem.checked">
预估到手价 <span>{{ formatPrice(skuItem.priceDetailDTO.flowPrice)[0]}}</span>
<span>.{{ formatPrice(skuItem.priceDetailDTO.flowPrice)[1] }} </span>
预估到手价 <span>{{ $options.filters.goodsFormatPrice(skuItem.priceDetailDTO.flowPrice)[0]}}</span>
<span>.{{ $options.filters.goodsFormatPrice(skuItem.priceDetailDTO.flowPrice)[1] }} </span>
</div>
<div style='margin-left: 20rpx;' v-if="!skuItem.checked && skuItem.errorMessage">
{{skuItem.errorMessage}}
@@ -131,7 +131,7 @@
<div class="fullPrice">
<span class="number" v-if="cartDetail && cartDetail.priceDetailDTO">
总计:
<span>¥{{ formatPrice(cartDetail.priceDetailDTO.flowPrice)[0] }}</span>.<span>{{ formatPrice(cartDetail.priceDetailDTO.flowPrice)[1] }}</span>
<span>¥{{ $options.filters.goodsFormatPrice(cartDetail.priceDetailDTO.flowPrice)[0] }}</span>.<span>{{ $options.filters.goodsFormatPrice(cartDetail.priceDetailDTO.flowPrice)[1] }}</span>
</span>
<span class="number" v-else>总计:0.00</span>
</div>
@@ -256,17 +256,6 @@ export default {
discountDetails() {
this.discountDetailsFlag = true;
},
/**
* 格式化金钱 1999 --> [1999,00]
*/
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return val.toFixed(2).split(".");
},
/**
* 左滑打开删除
*/

View File

@@ -15,6 +15,11 @@ export default {
},
};
},
onReachBottom(){
// 给子级监听触底加载
uni.$emit('onReachBottom',true)
},
onPullDownRefresh() {
this.$refs.tpl.init();

View File

@@ -1,118 +1,208 @@
/** 配置楼层模块的跳转 */
export function modelNavigateTo(item) {
let val = item.url || item;
console.log(item);
// return;
switch (val.___type || item.type) {
case "goods":
uni.navigateTo({
url: "/pages/product/goods?id=" + val.id + "&goodsId=" + val.goodsId,
});
break;
case "category":
if (val.id) {
let val = item.url || item;
//链接跳转到专题
if (val && val.id && val.pageType == "special") {
uni.navigateTo({
url: `/pages/tabbar/special/special?id=${val.id}`,
});
}
switch (val.___type || val.type) {
case "goods":
uni.navigateTo({
url: "/pages/product/goods?id=" + val.id + "&goodsId=" + val.goodsId,
});
break;
case "category":
if (val.id) {
uni.navigateTo({
url: `/pages/navigation/search/searchPage?category=${val.id}`,
});
} else {
uni.navigateTo({
url: `/pages/navigation/search/searchPage`,
});
}
break;
case "shops":
uni.navigateTo({
url: `/pages/product/shopPage?id=${val.id}`,
});
break;
// 活动
case "marketing":
uni.navigateTo({
url: "/pages/product/goods?id=" + val.id + "goodsId=" + val.goodsId,
});
break;
case "pages":
uni.navigateTo({
url: val.___path + "?id=" + val.id + "&title=" + val.title,
});
break;
case "other":
switch (val.title || item.title) {
case "首页":
uni.switchTab({
url: `/pages/tabbar/home/index`,
});
break;
case "购物车":
uni.switchTab({
url: `/pages/tabbar/cart/cartList`,
});
return;
case "个人中心":
uni.switchTab({
url: `/pages/tabbar/user/my`,
});
break;
case "收藏商品":
uni.navigateTo({
url: `/pages/mine/myCollect`,
});
break;
case "我的订单":
uni.navigateTo({
url: `/pages/order/myOrder?status=0`,
});
break;
case "领券中心":
uni.navigateTo({
url: `/pages/cart/coupon/couponCenter`,
});
break;
case "签到":
uni.navigateTo({
url: `/pages/mine/signIn`,
});
break;
case "秒杀频道":
uni.navigateTo({
url: `/pages/promotion/seckill`,
});
break;
case "拼团频道":
uni.navigateTo({
url: `/pages/promotion/joinGroup`,
});
break;
case "小程序直播":
uni.navigateTo({
url: `/pages/promotion/lives`,
});
break;
case "砍价":
uni.navigateTo({
url: `/pages/promotion/bargain/list`,
});
break;
case "积分商城":
uni.navigateTo({
url: `/pages/promotion/point/pointList`,
});
break;
case "店铺列表":
uni.navigateTo({
url: `/pages/product/shopList`,
});
break;
default:
// #ifdef H5
window.location.href = val.url || item.link;
// #endif
// #ifdef APP-PLUS
plus.runtime.openURL(val.url || item.link) //不需要拼接\
// #endif
break;
}
break;
}
}
import config from "@/config/config";
async function scan() {
// #ifdef APP-PLUS
let isIos = plus.os.name == "iOS";
// 判断是否是Ios
if (isIos) {
const iosFirstCamera = uni.getStorageSync("iosFirstCamera"); //是不是第一次开启相机
if (iosFirstCamera !== "false") {
uni.setStorageSync("iosFirstCamera", "false"); //设为false就代表不是第一次开启相机
seacnCode();
} else {
if (permision.judgeIosPermission("camera")) {
seacnCode();
} else {
// 没有权限提醒是否去申请权限
tipsGetSettings();
}
}
} else {
/**
* TODO 安卓 权限已经授权了调用api总是显示用户已永久拒绝申请。人傻了
* TODO 如果xdm有更好的办法请在 https://gitee.com/beijing_hongye_huicheng/lilishop/issues 提下谢谢
*/
seacnCode();
}
// #endif
// #ifdef MP-WEIXIN
seacnCode();
// #endif
}
/**
* 提示获取权限
*/
function tipsGetSettings() {
uni.showModal({
title: "提示",
content: "您已经关闭相机权限,去设置",
success: function (res) {
if (res.confirm) {
if (isIos) {
plus.runtime.openURL("app-settings:");
} else {
permision.gotoAppPermissionSetting();
}
}
},
});
}
function seacnCode() {
uni.scanCode({
success: function (res) {
let path = encodeURIComponent(res.result);
// WX_CODE 为小程序码
if (res.scanType == "WX_CODE") {
console.log(res);
uni.navigateTo({
url: `/pages/navigation/search/searchPage?category=${val.id}`,
url: `/${res.path}`,
});
} else {
uni.navigateTo({
url: `/pages/navigation/search/searchPage`,
config.scanAuthNavigation.forEach((src) => {
if (res.result.indexOf(src) != -1) {
uni.navigateTo({
url: `/${res.result.substring(src.length)}`,
});
} else {
setTimeout(() => {
uni.navigateTo({
url: "/pages/tabbar/home/web-view?src=" + path,
});
}, 100);
}
});
}
break;
case "shops":
uni.navigateTo({
url: `/pages/product/shopPage?id=${val.id}`,
});
break;
// 活动
case "marketing":
uni.navigateTo({
url: "/pages/product/goods?id=" + val.id + "goodsId=" + val.goodsId,
});
break;
case "pages":
uni.navigateTo({
url: val.___path + "?id=" + val.id + "&title=" + val.title,
});
break;
case "other":
switch (val.title || item.title) {
case "首页":
uni.switchTab({
url: `/pages/tabbar/home/index`,
});
break;
case "购物车":
uni.switchTab({
url: `/pages/tabbar/cart/cartList`,
});
return;
case "个人中心":
uni.switchTab({
url: `/pages/tabbar/user/my`,
});
break;
case "收藏商品":
uni.navigateTo({
url: `/pages/mine/myCollect`,
});
break;
case "我的订单":
uni.navigateTo({
url: `/pages/order/myOrder?status=0`,
});
break;
case "领券中心":
uni.navigateTo({
url: `/pages/cart/coupon/couponCenter`,
});
break;
case "签到":
uni.navigateTo({
url: `/pages/mine/signIn`,
});
break;
case "秒杀频道":
uni.navigateTo({
url: `/pages/promotion/seckill`,
});
break;
case "拼团频道":
uni.navigateTo({
url: `/pages/promotion/joinGroup`,
});
break;
case "小程序直播":
uni.navigateTo({
url: `/pages/promotion/lives`,
});
break;
case "砍价":
uni.navigateTo({
url: `/pages/promotion/bargain/list`,
});
break;
case "积分商城":
uni.navigateTo({
url: `/pages/promotion/point/pointList`,
});
break;
case "店铺列表":
uni.navigateTo({
url: `/pages/product/shopList`,
});
break;
default:
// #ifdef H5
window.location.href = val.url || item.link;
// #endif
// #ifdef APP-PLUS
plus.runtime.openURL(val.url || item.link) //不需要拼接\
// #endif
break;
}
break;
}
}
},
});
}

View File

@@ -1,8 +1,8 @@
<template>
<div class="layout">
<div class="flex-one">
<!-- <u-image width="100%" mode="aspectFit" height="280rpx" :src="res.list[0].img" alt=""></u-image> -->
<hotzone :res="res"></hotzone>
<u-image v-if="res.list[0].zoneInfo == ''" @click="modelNavigateTo(res.list[0])" width="100%" mode="aspectFit" height="280rpx" :src="res.list[0].img" alt=""></u-image>
<hotzone v-else :res="res"></hotzone>
</div>
</div>
</template>
@@ -17,7 +17,7 @@ export default {
},
data() {
return {
modelNavigateTo,
modelNavigateTo
};
},
props: ["res"],

View File

@@ -1,21 +1,38 @@
<template>
<div class="layout">
<u-sticky>
<div class="goods-cell-title">
<div class="goods-item-title" :class="{ 'selected-title': selected.index == index }"
@click="handleClickTitle(title, index)" v-for="(title, index) in res.list[0].titleWay" :key="index">
<div
class="goods-item-title"
:class="{ 'selected-title': selected.index == index }"
@click="handleClickTitle(title, index)"
v-for="(title, index) in res.list[0].titleWay"
:key="index"
>
<h4 class="h4">{{ title.title }}</h4>
<div>{{ title.desc }}</div>
</div>
</div>
</u-sticky>
<div class="goods-list">
<div v-if="item.___index != undefined ? (selected.index == item.___index) : ( selected.val == item.type)"
@click="handleClick(item)" class="goods-item" v-for="(item, item_index) in res.list[0].listWay"
:key="item_index">
<div
v-if="
item.___index != undefined
? selected.index == item.___index
: selected.val == item.type
"
@click="handleClick(item)"
class="goods-item"
v-for="(item, item_index) in res.list[0].listWay"
:key="item_index"
>
<div class="goods-img">
<u-image :src="item.img" height="350rpx" mode="aspectFit" width="100%">
<u-image
:src="item.img"
height="350rpx"
mode="aspectFit"
width="100%"
>
<u-loading slot="loading"></u-loading>
</u-image>
</div>
@@ -24,9 +41,42 @@
{{ item.title }}
</div>
<div class="goods-bottom">
<div class="goods-price"> ¥<span>{{ formatPrice(item.price )[0] }} </span>.{{
formatPrice(item.price )[1]
}}</div>
<div class="goods-price">
¥<span
>{{ $options.filters.goodsFormatPrice(item.price)[0] }} </span
>.{{ $options.filters.goodsFormatPrice(item.price)[1] }}
</div>
</div>
</div>
</div>
<div
v-if="res.list[0].titleWay[selected.index].bindCategory && goodsData.length"
v-for="(item, index) in goodsData"
:key="index"
class="goods-item"
@click="handleClick(item)"
>
<div class="goods-img">
<u-image
:src="item.thumbnail"
height="350rpx"
mode="aspectFit"
width="100%"
>
<u-loading slot="loading"></u-loading>
</u-image>
</div>
<div class="goods-desc">
<div class="goods-title">
{{ item.goodsName }}
</div>
<div class="goods-bottom">
<div class="goods-price">
¥<span
>{{ $options.filters.goodsFormatPrice(item.price)[0] }} </span
>.{{ $options.filters.goodsFormatPrice(item.price)[1] }}
</div>
</div>
</div>
</div>
@@ -34,6 +84,7 @@
</div>
</template>
<script>
import { getGoodsList } from "@/api/goods.js";
export default {
title: "商品分类以及商品",
data() {
@@ -42,29 +93,44 @@ export default {
index: 0,
val: "",
},
params: {
pageNumber: 1,
pageSize: 100,
categoryId: "",
},
goodsData: [], //商品循环内容
goodsResult:"", //es总返回内容
};
},
props: ["res"],
props: ["res","enableBottomLoad"],
watch: {
res: {
handler(val) {
// 监听父级的值 如果有值将值赋给selected
if (val) {
this.selected.val = this.res.list[0].listWay[0].type;
console.log(val)
// 如果第一个标签页绑定为商品
this.selected.val = this.res.list[0].listWay[0] ? this.res.list[0].listWay[0].type: '';
// 如果第一个标签为绑定为分类
this.res.list[0].titleWay[0].bindCategory ? this.initGoods(this.res.list[0].titleWay[0]) : ''
}
},
immediate: true,
},
},
mounted() {},
mounted() {
uni.$on('onReachBottom',()=>{
if(this.enableBottomLoad && this.goodsResult.totalElements >= this.params.pageNumber * this.params.pageSize){
this.params.pageNumber++
this.initGoods(this.res.list[0].titleWay[this.selected.index])
}
})
},
destroyed(){
uni.$off('onReachBottom')
},
methods: {
// 格式化金钱 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return val.toFixed(2).split(".");
},
handleClick(item) {
uni.navigateTo({
url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`,
@@ -73,9 +139,25 @@ export default {
closeGoods(val, index) {
this.res.list[0].listWay.splice(index, 1);
},
async initGoods(val) {
if(this.enableBottomLoad) this.params.pageSize = 20
val ? this.params.categoryId = val.bindCategory.id : '';
const res = await getGoodsList(this.params);
if (res.data.success) {
this.goodsResult = res.data.result
const result = res.data.result.content.map(item=>item.content)
this.goodsData.push(...result);
console.log(this.goodsData)
}
},
handleClickTitle(val, index) {
this.selected.index = index;
this.selected.val = val.title;
if (val.bindCategory) {
this.params.pageNumber = 1
this.goodsData = []
this.initGoods(val);
}
},
},
};
@@ -158,7 +240,7 @@ $w_94: 94%;
margin: 0 auto;
> .goods-title {
font-size: 24rpx;
height: 70rpx;
height: 67rpx;
display: -webkit-box;
font-weight: 500;
-webkit-box-orient: vertical;
@@ -172,11 +254,10 @@ $w_94: 94%;
> .goods-price {
line-height: 2;
color: $main-color;
>span{
> span {
font-size: 42rpx;
}
}
}
}
</style>

View File

@@ -4,6 +4,9 @@
<u-icon name="search"></u-icon>
{{ res.list[0].title }}
</div>
<div slot="right" open-type="contact" class="navbar-right message" @click="linkMsgDetail" style="border-style:none;background:rgb(234,234,234);" >
<image style="width:53rpx;height:53rpx;margin-top:6rpx;" src="@/static/img/title.png"></image>
</div>
</div>
</template>
<script>
@@ -11,6 +14,11 @@ export default {
title:"搜索栏",
props: ["res"],
methods: {
linkMsgDetail(){
uni.navigateTo({
url:`/pages/tabbar/home/title`
})
},
handleSearch() {
uni.navigateTo({
url: "/pages/navigation/search/searchPage",
@@ -34,5 +42,14 @@ export default {
.layout {
background: #fff;
padding: 0 16rpx;
position: relative;
}
.navbar-right{
position: absolute;
top: 0;
// right: 0;
}
.message{
right:40rpx;
}
</style>

185
pages/tabbar/home/title.vue Normal file
View File

@@ -0,0 +1,185 @@
<template>
<view>
<view>
<u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
<u-cell-group v-if="current == 0">
<view v-for="(item,index) in lists" :key="index">
<u-cell-item :arrow="false" v-if="item.status =='UN_READY'" style="position: relative;"
@click="linkMsgDetail(item)">
<template slot="label">
<view style="display: inline-block;
width: 100%;
height: auto;
font-family: Gibson;
font-size: 25rpx;
word-break: break-all;
text-overflow: ellipsis;
word-wrap: break-word;
white-space: pre-wrap;">
<view style="color:black;font-size:30rpx;font-weight:500;">{{item.title}}</view>
<view>{{item.content}}</view>
<view style="width:400rpx;padding: 10rpx 0;">{{item.createTime}}</view>
</view>
</template>
<!-- <button style="width:100rpx;height:60rpx;float:right;font-size:20rpx;line-height:60rpx;background:#000000;color:white;">未读</button> -->
</u-cell-item>
</view>
</u-cell-group>
<u-cell-group v-if="current == 1">
<view v-for="(item,index) in lists" :key="index">
<u-cell-item :arrow="false" v-if="item.status == 'ALREADY_READY'" style="position: relative;"
@click="linkMsgDetail(item)">
<template slot="label">
<view style="display: inline-block;
width: 100%;
height: auto;
font-family: Gibson;
font-size: 25rpx;
word-break: break-all;
text-overflow: ellipsis;
word-wrap: break-word;
white-space: pre-wrap;">
<view style="color:black;font-size:30rpx;font-weight:500;">{{item.title}}</view>
<view>{{item.content}}</view>
<view style="width:400rpx;padding: 10rpx 0;">{{item.createTime}}</view>
</view>
</template>
<!-- <button style="width:100rpx;height:60rpx;float:right;font-size:20rpx;line-height:60rpx;background:#F3F3FA;color:black;">已读</button> -->
</u-cell-item>
</view>
</u-cell-group>
</view>
</view>
</template>
<script>
import {
messages,
editMessages
} from "@/api/message.js"
export default {
data() {
return {
params: {
pageSize: 20,
pageNumber: 1,
memberId: "",
messageId: "",
status:"UN_READY"
},
loadText: {
loadmore: '轻轻上拉',
loading: '努力加载中',
nomore: '实在没有了'
},
list: [{
name: "未读"
}, {
name: "已读"
}],
current: 0,
lists: [],
status: "loadmore"
}
},
onShow() {
this.getMessage()
},
onReachBottom() {
this.params.pageNumber++;
this.statuss = "loading";
this.getMessage()
},
methods: {
linkMsgDetail(v) {
if (v.status == 'UN_READY') {
let params = {}
params.messageId = v.memberId
editMessages(v.id, params).then(res => {
if (res.data.success) {
console.log( this.lists)
this.lists.forEach((item,index)=>{
console.log(item)
if(item.id == v.id){
this.lists.splice(index, 1)
}
})
}
})
}
// uni.navigateTo({
// url:`/pages/tabbar/home/messageDetail?data=${encodeURIComponent(JSON.stringify(v))}`
// })
},
/**
* 返回
*/
back() {
if (getCurrentPages().length == 1) {
uni.switchTab({
url: "/pages/tabbar/home/index",
});
} else {
uni.navigateBack();
}
},
change(e) {
console.log(e)
this.current = e;
if (e == 0) {
this.params.status = "UN_READY"
this.params.pageNumber = 1;
} else if (e == 1) {
this.params.status = "ALREADY_READY"
this.params.pageNumber = 1;
}
this.lists = []
this.getMessage()
},
getMessage() {
this.params.memberId = this.$options.filters.isLogin().id;
messages(this.params).then(res => {
console.log(res)
if (res.data.success) {
if (res.data.result.records == '') {
console.log(11111)
this.status = "nomore"
}
res.data.result.records.forEach(item => {
this.lists.push(item)
let obj = {};
this.lists = this.lists.reduce(
(cur, next) => {
//对象去重
if (next.id != undefined) {
obj[next.id] ?
"" :
(obj[next.id] = true && cur.push(next));
}
console.log(cur);
return cur;
},
[]
)
})
}
})
}
},
}
</script>
<style>
.foot {
position: fixed;
bottom: 0;
}
</style>

View File

@@ -42,7 +42,7 @@
<textPicture v-if="item.type == 'textPicture'" :res="item.options" />
<menuLayout v-if="item.type == 'menu'" :res="item.options" />
<flexOne v-if="item.type == 'flexOne'" :res="item.options" />
<goods v-if="item.type == 'goods'" :res="item.options" />
<goods :enableBottomLoad="enableLoad" v-if="item.type == 'goods'" :res="item.options" />
<group v-if="item.type == 'group'" :res="item.options" />
<notice v-if="item.type == 'notice'" :res="item.options" />
<promotions v-if="item.type == 'promotionDetail'" :res="item.options" />
@@ -85,6 +85,7 @@ export default {
config,
pageData: "", //楼层页面数据
isIos: "",
enableLoad:false, //触底加载 针对于商品模块
};
},
components: {
@@ -124,8 +125,12 @@ export default {
this.pageData = "";
getFloorData().then((res) => {
if (res.data.success) {
this.pageData = JSON.parse(res.data.result.pageData);
console.log(this.pageData);
const result = JSON.parse(res.data.result.pageData)
this.pageData = result;
if(result.list.length){
// 如果最后一个装修模块是商品模块的话 默认启用自动加载
result.list[result.list.length-1] ? result.list[result.list.length-1].model == 'goods' ? this.enableLoad = true : '' : ''
}
}
});
},

View File

@@ -0,0 +1,247 @@
<template>
<div class="wrapper">
<!-- uni 中不能使用 vue component 所以用if判断每个组件 -->
<div v-for="(item, index) in pageData.list" :key="index">
<!-- 搜索栏如果在楼层装修顶部则会自动浮动否则不浮动 -->
<div class="navbar" v-if="item.type == 'search'">
<search style="width: 100%" :res="item.options" />
<!-- #ifndef H5 -->
<!-- 扫码功能 不兼容h5 详情文档: https://uniapp.dcloud.io/api/system/barcode?id=scancode -->
<div slot="right" class="navbar-right">
<u-icon name="scan" @click="scan()" color="#666" size="50"></u-icon>
</div>
<!-- #endif -->
</div>
<carousel v-if="item.type == 'carousel'" :res="item.options" />
<titleLayout v-if="item.type == 'title'" :res="item.options" />
<leftOneRightTwo
v-if="item.type == 'leftOneRightTwo'"
:res="item.options"
/>
<leftTwoRightOne
v-if="item.type == 'leftTwoRightOne'"
:res="item.options"
/>
<topOneBottomTwo
v-if="item.type == 'topOneBottomTwo'"
:res="item.options"
/>
<topTwoBottomOne
v-if="item.type == 'topTwoBottomOne'"
:res="item.options"
/>
<flexThree v-if="item.type == 'flexThree'" :res="item.options" />
<flexFive v-if="item.type == 'flexFive'" :res="item.options" />
<flexFour v-if="item.type == 'flexFour'" :res="item.options" />
<flexTwo v-if="item.type == 'flexTwo'" :res="item.options" />
<textPicture v-if="item.type == 'textPicture'" :res="item.options" />
<menuLayout v-if="item.type == 'menu'" :res="item.options" />
<flexOne v-if="item.type == 'flexOne'" :res="item.options" />
<goods v-if="item.type == 'goods'" :res="item.options" />
<group v-if="item.type == 'group'" :res="item.options" />
<notice v-if="item.type == 'notice'" :res="item.options" />
<promotions v-if="item.type == 'promotionDetail'" :res="item.options" />
<!-- <joinGroup v-if="item.type == 'joinGroup'" :res="item.options" /> -->
<!-- <integral v-if="item.type == 'integral'" :res="item.options" /> -->
<!-- <spike v-if="item.type == 'spike'" :res="item.options" /> -->
</div>
<u-no-network></u-no-network>
</div>
</template>
<script>
// 引用组件
import tpl_banner from "@/pages/tabbar/home/template/tpl_banner"; //导航栏模块
import tpl_title from "@/pages/tabbar/home/template/tpl_title"; //标题栏模块
import tpl_left_one_right_two from "@/pages/tabbar/home/template/tpl_left_one_right_two"; //左一右二模块
import tpl_left_two_right_one from "@/pages/tabbar/home/template/tpl_left_two_right_one"; //左二右一模块
import tpl_top_one_bottom_two from "@/pages/tabbar/home/template/tpl_top_one_bottom_two"; //上一下二模块
import tpl_top_two_bottom_one from "@/pages/tabbar/home/template/tpl_top_two_bottom_one"; //上二下一模块
import tpl_flex_one from "@/pages/tabbar/home/template/tpl_flex_one"; //单行图片模块
import tpl_flex_two from "@/pages/tabbar/home/template/tpl_flex_two"; //两张横图模块
import tpl_flex_three from "@/pages/tabbar/home/template/tpl_flex_three"; //三列单行图片模块
import tpl_flex_five from "@/pages/tabbar/home/template/tpl_flex_five"; //五列单行图片模块
import tpl_flex_four from "@/pages/tabbar/home/template/tpl_flex_four"; //四列单行图片模块
import tpl_text_picture from "@/pages/tabbar/home/template/tpl_text_picture"; //文字图片模板
import tpl_menu from "@/pages/tabbar/home/template/tpl_menu"; //五列菜单模块
import tpl_search from "@/pages/tabbar/home/template/tpl_search"; //搜索栏
import tpl_group from "@/pages/tabbar/home/template/tpl_group"; //
import tpl_goods from "@/pages/tabbar/home/template/tpl_goods"; //商品分类以及分类中的商品
// 结束引用组件
import { toSpecial, getSpecial } from "@/api/home"; //获取楼层装修接口
import permision from "@/js_sdk/wa-permission/permission.js"; //权限工具类
import config from "@/config/config";
import tpl_notice from "@/pages/tabbar/home/template/tpl_notice"; //标题栏模块
import tpl_promotions from "@/pages/tabbar/home/template/tpl_promotions_detail"; //标题栏模块
export default {
data() {
return {
id: "",
config,
pageData: "", //楼层页面数据
bodyParam: "",
isIos: ""
};
},
components: {
carousel: tpl_banner,
titleLayout: tpl_title,
leftOneRightTwo: tpl_left_one_right_two,
leftTwoRightOne: tpl_left_two_right_one,
topOneBottomTwo: tpl_top_one_bottom_two,
topTwoBottomOne: tpl_top_two_bottom_one,
flexThree: tpl_flex_three,
flexFive: tpl_flex_five,
flexFour: tpl_flex_four,
flexTwo: tpl_flex_two,
textPicture: tpl_text_picture,
menuLayout: tpl_menu,
search: tpl_search,
flexOne: tpl_flex_one,
goods: tpl_goods,
group: tpl_group,
notice: tpl_notice,
promotions: tpl_promotions
},
mounted() {
this.init();
// #ifdef MP-WEIXIN
// 小程序默认分享
uni.showShareMenu({ withShareTicket: true });
// #endif
},
onLoad(val) {
this.id = val.id;
this.bodyParam = val.body;
},
methods: {
/**
* 实例化首页数据楼层
*/
init() {
this.pageData = "";
console.log(this.bodyParam);
if (this.bodyParam) {
toSpecial({body: this.bodyParam}).then(res => {
if (res.data.success) {
this.pageData = JSON.parse(res.data.result.pageData);
}
});
} else {
getSpecial(this.id).then(res => {
if (res.data.success) {
this.pageData = JSON.parse(res.data.result.pageData);
}
});
}
},
/**
* TODO 扫码功能后续还会后续增加
* 应该实现的功能目前计划有:
* 扫描商品跳转商品页面
* 扫描活动跳转活动页面
* 扫描二维码登录
* 扫描其他站信息 弹出提示,返回首页。
*/
seacnCode() {
uni.scanCode({
success: function(res) {
let path = encodeURIComponent(res.result);
// WX_CODE 为小程序码
if (res.scanType == "WX_CODE") {
console.log(res);
uni.navigateTo({
url: `/${res.path}`
});
} else {
config.scanAuthNavigation.forEach(src => {
if (res.result.indexOf(src) != -1) {
uni.navigateTo({
url: `/${res.result.substring(src.length)}`
});
} else {
setTimeout(() => {
uni.navigateTo({
url: "/pages/tabbar/home/web-view?src=" + path
});
}, 100);
}
});
}
}
});
},
/**
* 提示获取权限
*/
tipsGetSettings() {
uni.showModal({
title: "提示",
content: "您已经关闭相机权限,去设置",
success: function(res) {
if (res.confirm) {
if (this.isIos) {
plus.runtime.openURL("app-settings:");
} else {
permision.gotoAppPermissionSetting();
}
}
}
});
},
/**
* 唤醒客户端扫码
* 没权限去申请权限,有权限获取扫码功能
*/
async scan() {
// #ifdef APP-PLUS
this.isIos = plus.os.name == "iOS";
// 判断是否是Ios
if (this.isIos) {
const iosFirstCamera = uni.getStorageSync("iosFirstCamera"); //是不是第一次开启相机
if (iosFirstCamera !== "false") {
uni.setStorageSync("iosFirstCamera", "false"); //设为false就代表不是第一次开启相机
this.seacnCode();
} else {
if (permision.judgeIosPermission("camera")) {
this.seacnCode();
} else {
// 没有权限提醒是否去申请权限
this.tipsGetSettings();
}
}
} else {
/**
* TODO 安卓 权限已经授权了调用api总是显示用户已永久拒绝申请。人傻了
* TODO 如果xdm有更好的办法请在 https://gitee.com/beijing_hongye_huicheng/lilishop/issues 提下谢谢
*/
this.seacnCode();
}
// #endif
// #ifdef MP-WEIXIN
this.seacnCode();
// #endif
}
}
};
</script>
<style scoped lang="scss">
.navbar-right {
padding: 0 16rpx 0 0;
}
.navbar {
display: flex;
align-items: center;
}
</style>