feat: 🎨 合并其他分支代码

master
学习很差啦 2022-09-23 15:10:25 +08:00
commit 638e82dd28
31 changed files with 1248 additions and 746 deletions

467
App.vue
View File

@ -1,232 +1,257 @@
<script> <script>
/** /**
* vuex管理登录状态具体可以参考官方登录模板示例 * vuex管理登录状态具体可以参考官方登录模板示例
*/ */
import { mapMutations } from "vuex"; import {
import APPUpdate from "@/plugins/APPUpdate"; mapMutations
import { getClipboardData } from "@/js_sdk/h5-copy/h5-copy.js"; } from "vuex";
import config from "@/config/config"; import APPUpdate from "@/plugins/APPUpdate";
import storage from "@/utils/storage"; import {
// getClipboardData
} from "@/js_sdk/h5-copy/h5-copy.js";
import config from "@/config/config";
import storage from "@/utils/storage";
export default {
data() {
return {
config,
};
},
/**
* 监听返回
*/
onBackPress(e) {
if (e.from == "backbutton") {
let routes = getCurrentPages();
let curRoute = routes[routes.length - 1].options;
routes.forEach((item) => {
if (
item.route == "pages/tabbar/cart/cartList" ||
item.route.indexOf("pages/product/goods") != -1
) {
uni.redirectTo({
url: item.route,
});
}
});
if (curRoute.addId) {
uni.reLaunch({
url: "/pages/tabbar/cart/cartList",
});
} else {
uni.navigateBack();
}
return true; //
}
},
methods: {
...mapMutations(["login"]),
},
onLaunch: function () {
// #ifdef APP-PLUS
this.checkArguments(); //
APPUpdate();
//
plus.globalEvent.addEventListener("newintent", (e) => {
this.checkArguments(); //
});
// #endif
// #ifdef MP-WEIXIN
this.applyUpdateWeChat();
// #endif
},
onShow() {
// #ifndef H5
this.getClipboard();
// #endif
// #ifdef APP-PLUS
if (storage.getShow()) {
if(uni.getSystemInfoSync().platform == 'ios'){
this.$u.route("/pages/tabbar/screen/fullScreen");
}
}
// #endif
},
methods: {
/**
* 微信小程序版本提交更新版本 解决缓存问题
*/
applyUpdateWeChat() {
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function (res) {
//
});
updateManager.onUpdateReady(function (res) {
uni.showModal({
title: "更新提示",
content: "发现新版本,是否重启应用?",
success(res) {
if (res.confirm) {
// applyUpdate
updateManager.applyUpdate();
}
},
});
});
updateManager.onUpdateFailed(function (res) {
//
});
},
// TODO 广
launch() {
try {
// launchFlag 广
const value = uni.getStorageSync("launchFlag");
if (!value) {
// this.$u.route("/pages/index/agreement");
} else {
//app广
var w = plus.webview.open(
"/hybrid/html/advertise/advertise.html",
"本地地址",
{
top: 0,
bottom: 0,
zindex: 999,
},
"fade-in",
500
);
//4s广
setTimeout(function () {
plus.webview.close(w);
APPUpdate();
}, 3000);
}
} catch (e) {
// error
uni.setStorage({
key: "launchFlag",
data: true,
success: function () {
console.log("error时存储launchFlag");
},
});
}
},
/**
* 获取粘贴板数据
*/
async getClipboard() {
let res = await getClipboardData();
/**
* 解析粘贴板数据 /**
*/ * 路由监听并删除路由
* https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.html
if (res.indexOf(config.shareLink) != -1 && (res!= this.$store.state.shareLink)) { * */
this.$store.state.shareLink = res // #ifdef MP-WEIXIN
uni.showModal({ wx.onAppRoute((res) => {
title: "提示", const pages = getCurrentPages();
content: "检测到一个分享链接是否跳转?", console.log("pages:" + pages.length,pages);
confirmText: "跳转", if (pages.length > 3) {
success: function (callback) { delete getCurrentPages()[2]
if (callback.confirm) { }
const path = res.split(config.shareLink)[1]; console.log('路由监听', {
if (path.indexOf("tabbar") != -1) { res
uni.switchTab({ })
url: path, })
}); // #endif
} else {
uni.navigateTo({
url: path,
});
}
}
},
});
}
},
/** export default {
* h5中打开app获取跳转app的链接并跳转 data() {
*/ return {
checkArguments() { config,
// #ifdef APP-PLUS };
setTimeout(() => { },
const args = plus.runtime.arguments;
if (args) {
const argsStr = decodeURIComponent(args); /**
const path = argsStr.split("//")[1]; * 监听返回
if (path.indexOf("tabbar") != -1) { */
uni.switchTab({ onBackPress(e) {
url: `/${path}`, if (e.from == "backbutton") {
}); let routes = getCurrentPages();
} else { let curRoute = routes[routes.length - 1].options;
uni.navigateTo({ routes.forEach((item) => {
url: `/${path}`, if (
}); item.route == "pages/tabbar/cart/cartList" ||
} item.route.indexOf("pages/product/goods") != -1
} ) {
}); uni.redirectTo({
// #endif url: item.route,
}, });
}, }
}; });
if (curRoute.addId) {
uni.reLaunch({
url: "/pages/tabbar/cart/cartList",
});
} else {
uni.navigateBack();
}
return true; //
}
},
methods: {
...mapMutations(["login"]),
},
onLaunch: function() {
// #ifdef APP-PLUS
this.checkArguments(); //
APPUpdate();
//
plus.globalEvent.addEventListener("newintent", (e) => {
this.checkArguments(); //
});
// #endif
// #ifdef MP-WEIXIN
this.applyUpdateWeChat();
// #endif
},
onShow() {
// #ifndef H5
this.getClipboard();
// #endif
// #ifdef APP-PLUS
if (storage.getShow()) {
if (uni.getSystemInfoSync().platform == 'ios') {
this.$u.route("/pages/tabbar/screen/fullScreen");
}
}
// #endif
},
methods: {
/**
* 微信小程序版本提交更新版本 解决缓存问题
*/
applyUpdateWeChat() {
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function(res) {
//
});
updateManager.onUpdateReady(function(res) {
uni.showModal({
title: "更新提示",
content: "发现新版本,是否重启应用?",
success(res) {
if (res.confirm) {
// applyUpdate
updateManager.applyUpdate();
}
},
});
});
updateManager.onUpdateFailed(function(res) {
//
});
},
// TODO 广
launch() {
try {
// launchFlag 广
const value = uni.getStorageSync("launchFlag");
if (!value) {
// this.$u.route("/pages/index/agreement");
} else {
//app广
var w = plus.webview.open(
"/hybrid/html/advertise/advertise.html",
"本地地址", {
top: 0,
bottom: 0,
zindex: 999,
},
"fade-in",
500
);
//4s广
setTimeout(function() {
plus.webview.close(w);
APPUpdate();
}, 3000);
}
} catch (e) {
// error
uni.setStorage({
key: "launchFlag",
data: true,
success: function() {
console.log("error时存储launchFlag");
},
});
}
},
/**
* 获取粘贴板数据
*/
async getClipboard() {
let res = await getClipboardData();
/**
* 解析粘贴板数据
*/
if (res.indexOf(config.shareLink) != -1 && (res != this.$store.state.shareLink)) {
this.$store.state.shareLink = res
uni.showModal({
title: "提示",
content: "检测到一个分享链接是否跳转?",
confirmText: "跳转",
success: function(callback) {
if (callback.confirm) {
const path = res.split(config.shareLink)[1];
if (path.indexOf("tabbar") != -1) {
uni.switchTab({
url: path,
});
} else {
uni.navigateTo({
url: path,
});
}
}
},
});
}
},
/**
* h5中打开app获取跳转app的链接并跳转
*/
checkArguments() {
// #ifdef APP-PLUS
setTimeout(() => {
const args = plus.runtime.arguments;
if (args) {
const argsStr = decodeURIComponent(args);
const path = argsStr.split("//")[1];
if (path.indexOf("tabbar") != -1) {
uni.switchTab({
url: `/${path}`,
});
} else {
uni.navigateTo({
url: `/${path}`,
});
}
}
});
// #endif
},
},
};
</script> </script>
<style lang="scss"> <style lang="scss">
@import "uview-ui/index.scss"; @import "uview-ui/index.scss";
// ------- x // ------- x
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
.mp-iphonex-bottom { .mp-iphonex-bottom {
padding-bottom: constant(safe-area-inset-bottom); padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
box-sizing: content-box; box-sizing: content-box;
height: auto !important; height: auto !important;
padding-top: 10rpx; padding-top: 10rpx;
} }
// #endif
body { // #endif
background-color: $bg-color;
} body {
/************************ */ background-color: $bg-color;
.w200 { }
width: 200rpx !important;
} /************************ */
.flex1 { .w200 {
flex: 1; //flex width: 200rpx !important;
} }
.flex1 {
flex: 1; //flex
}
</style> </style>

View File

@ -46,20 +46,20 @@
formatPrice(item.price)[0] formatPrice(item.price)[0]
}}</span> }}</span>
.{{ formatPrice(item.price)[1] }} .{{ formatPrice(item.price)[1] }}
</span> </span>
<span class='wholesale-item'> <span class='wholesale-item'>
{{item.num}}{{goodsDetail.goodsUnit}} {{item.num}}{{goodsDetail.goodsUnit}}
</span> </span>
</div> </div>
</div> </div>
<div class="goods-price" v-else> <div class="goods-price" v-else>
<span> <span>
<span class="goods-price-bigshow">{{ <span class="goods-price-bigshow">{{
formatPrice(goodsDetail.price)[0] formatPrice(goodsDetail.price)[0]
}}</span> }}</span>
.{{ formatPrice(goodsDetail.price)[1] }} .{{ formatPrice(goodsDetail.price)[1] }}
</span> </span>
</div> </div>
</view> </view>
<view class="goods-check-skus"> <view class="goods-check-skus">
@ -68,12 +68,12 @@
{{ selectName }} {{ selectName }}
<span>{{ num }}</span> <span>{{ num }}</span>
</span> </span>
</view> </view>
<view class="goods-check-skus"> <view class="goods-check-skus">
库存 库存
<span class="goods-check-skus-name"> <span class="goods-check-skus-name">
<span>{{ goodsDetail.quantity }}</span> <span>{{ goodsDetail.quantity }}</span>
</span> </span>
</view> </view>
</view> </view>
</view> </view>
@ -99,10 +99,10 @@
</view> </view>
</view> </view>
<!-- 数量 --> <!-- 数量 -->
<view class="goods-skus-number"> <view class="goods-skus-number flex flex-a-c flex-j-sb">
<view class="view-class-title">数量</view> <view class="view-class-title">数量</view>
<u-input style='text-align: right;' v-model="num" type="number" /> <u-input class="view-class-input" v-model="num" type="number" />
</view> </view>
</scroll-view> </scroll-view>
<!-- 按钮 --> <!-- 按钮 -->
@ -133,14 +133,14 @@
formatList: [], formatList: [],
currentSelceted: [], currentSelceted: [],
skuList: "", skuList: "",
isClose: false, // isClose: false, //
}; };
}, },
props: { props: {
wholesaleList:{ wholesaleList:{
type: null, type: null,
default: false, default: false,
}, },
buyMask: { buyMask: {
type: Boolean, type: Boolean,
@ -170,23 +170,22 @@
default: "", default: "",
type: null, type: null,
}, },
},
computed: {
wholesalePrice(key){
return this.wholesaleList.length ? this.wholesaleList.map(item=>{ return item.price }) :[]
},
wholesaleNum(key){
return this.wholesaleList.length ? this.wholesaleList.map(item=>{ return item.num }) :[]
}
}, },
watch: { computed: {
num(val){ wholesalePrice(key){
if(val){ return this.wholesaleList.length ? this.wholesaleList.map(item=>{ return item.price }) :[]
if(val > this.goodsDetail.quantity){ },
console.log(val) wholesaleNum(key){
this.val = this.goodsDetail.quantity return this.wholesaleList.length ? this.wholesaleList.map(item=>{ return item.num }) :[]
} }
} },
watch: {
num(val){
if(val){
if(val > this.goodsDetail.quantity){
this.val = this.goodsDetail.quantity
}
}
}, },
buyType: { buyType: {
handler(val) { handler(val) {
@ -399,9 +398,9 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./popup.scss"; @import "./popup.scss";
.price-row{ .price-row{
text-align: center; text-align: center;
} }
.buy { .buy {
background-image: linear-gradient(135deg, #ffba0d, #ffc30d 69%, #ffcf0d); background-image: linear-gradient(135deg, #ffba0d, #ffc30d 69%, #ffcf0d);
@ -422,8 +421,14 @@
.goods-skus-number { .goods-skus-number {
justify-content: space-between; justify-content: space-between;
display: flex; display: flex;
text-align: right
>.view-class-title{
flex: 8;
}
>.view-class-input{
flex:1
}
} }
/deep/ .uni-scroll-view { /deep/ .uni-scroll-view {
@ -468,13 +473,13 @@
border-radius: 30rpx; border-radius: 30rpx;
} }
} }
} }
.wholesale-item{ .wholesale-item{
color: #999 !important; color: #999 !important;
font-size: 24rpx; font-size: 24rpx;
margin:0 20rpx; margin:0 20rpx;
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.goods-header { .goods-header {
@ -494,7 +499,7 @@
.goods-price { .goods-price {
color: $price-color; color: $price-color;
line-height: 80rpx; line-height: 80rpx;
margin-right: 20rpx; margin-right: 20rpx;
>* { >* {
color: $price-color; color: $price-color;
@ -536,4 +541,4 @@
color: #333; color: #333;
} }
} }
</style> </style>

View File

@ -0,0 +1,347 @@
<template>
<view>
<!-- 一行两列商品展示 -->
<view class="goods-list" v-if="type == 'twoColumns'">
<view v-for="(item, index) in res" :key="index" class="goods-item">
<view class="image-wrapper" @click="navigateToDetailPage(item)">
<u-image :src="item.content.thumbnail" width="100%" height='330rpx' mode="aspectFill">
<u-loading slot="loading"></u-loading>
</u-image>
</view>
<view class="goods-detail">
<div class="title clamp" v-html="lightSearchStr(keyword,item.content.goodsName)"
@click="navigateToDetailPage(item)">
</div>
<view class="price-box" @click="navigateToDetailPage(item)">
<div class="price" v-if="item.content.price!=undefined">
¥<span>{{ formatPrice(item.content.price )[0] }} </span>.{{
formatPrice(item.content.price )[1]
}}
</div>
</view>
<div class="promotion" @click="navigateToDetailPage(item)">
<div v-if="item.content.salesModel == 'WHOLESALE'">
<span></span>
</div>
<div v-for="(promotionItem,promotionIndex) in getPromotion(item)" :key="promotionIndex">
<span v-if="promotionItem.indexOf('COUPON') != -1"></span>
<span v-if="promotionItem.indexOf('FULL_DISCOUNT') != -1"></span>
<span v-if="promotionItem.indexOf('SECKILL') != -1"></span>
</div>
</div>
<div class="count-config" @click="navigateToDetailPage(item)">
<span>已售 {{ item.content.buyCount || "0" }}</span>
<span>{{ item.content.commentNum || "0" }}条评论</span>
</div>
<div class="store-seller-name" v-if="storeName" @click="navigateToStoreDetailPage(item)">
<div class="text-hidden">
<u-tag style="margin-right: 10rpx" size="mini" mode="dark" v-if="item.selfOperated"
text="自营" type="error" />
<span>{{ item.content.storeName || "暂无" }}</span>
</div>
<span>
<u-icon name="arrow-right"></u-icon>
</span>
</div>
</view>
</view>
</view>
<!-- 一行一列商品展示 -->
<div v-if="type == 'oneColumns'">
<div v-for="(item, index) in res" :key="index" class="goods-row">
<div class="flex goods-col">
<div class="goods-img" @click="navigateToDetailPage(item)">
<u-image width="230rpx" border-radius='16' height="230rpx" :src="item.content.thumbnail">
<u-loading slot="loading"></u-loading>
</u-image>
</div>
<div class="goods-detail">
<div class="title clamp3" @click="navigateToDetailPage(item)">{{ item.content.goodsName }}</div>
<view class="price-box" @click="navigateToDetailPage(item)">
<div class="price" v-if="item.content.price!=undefined">
¥<span>{{ formatPrice(item.content.price )[0] }} </span>.{{
formatPrice(item.content.price )[1]
}}
</div>
</view>
<div class="promotion" @click="navigateToDetailPage(item)">
<div v-if="item.content.salesModel == 'WHOLESALE'">
<span></span>
</div>
<div v-for="(promotionItem,promotionIndex) in getPromotion(item)" :key="promotionIndex">
<span v-if="promotionItem.indexOf('COUPON') != -1"></span>
<span v-if="promotionItem.indexOf('FULL_DISCOUNT') != -1"></span>
<span v-if="promotionItem.indexOf('SECKILL') != -1"></span>
</div>
</div>
<div style="overflow: hidden" @click="navigateToDetailPage(item)" class="count-config">
<span style="float: left; font-size: 22rpx">已售 {{ item.content.buyCount || '0' }}</span>
<span style="float: right; font-size: 22rpx">{{ item.content.commentNum || '0' }}条评论</span>
</div>
<div style="overflow: hidden" @click="navigateToStoreDetailPage(item)" class="count-config">
<div class="text-hidden" v-if="storeName">
<u-tag style="margin-right: 10rpx" size="mini" mode="dark" v-if="item.selfOperated"
text="自营" type="error" />
<span class="line1-store-name">{{ item.content.storeName }}</span>
<span class="to-store">进店<u-icon size="24" name="arrow-right" color="#666"></u-icon>
</span>
</div>
<span>
<u-icon name="arrow-right" color="#c5c5c5"></u-icon>
</span>
</div>
</div>
</div>
</div>
</div>
</view>
</template>
<script>
import commonTpl from '@/components/m-goods-list/common'
export default {
data() {
return {
lightColor: this.$mainColor
}
},
mixins: [commonTpl],
props: {
//
res: {
type: Array,
default: () => {
return []
}
},
//
type: {
type: String,
default: 'twoColumns',
validator() {
return ['twoColumns', 'oneColumns']
}
},
storeName: {
type: Boolean,
default: true
},
keyword: {
type: null,
default: ''
}
},
watch: {
keyword(val) {
if (val) {
this.lightSearchStr(val)
}
}
},
methods: {
//
lightSearchStr(keyword, str) {
if (!keyword) {
return str
} else {
let unicodes = '';
for (let i of Array.from(keyword)) {
unicodes += this.unicode(i) + "|"
}
const rule = '(' + unicodes + ')'
const reg = new RegExp(rule, 'gi');
return str ? str.replace(reg, matchValue =>
`<span style="color:${this.lightColor}">${matchValue}</span>`
) : ''
}
},
// unicode
unicode(str) {
var value = '';
for (var i = 0; i < str.length; i++) {
value += '\\u' + this.left_zero_4(parseInt(str.charCodeAt(i)).toString(16));
}
return value;
},
left_zero_4(str) {
if (str != null && str != '' && str != 'undefined') {
if (str.length == 2) {
return '00' + str;
}
}
return str;
},
// 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return val.toFixed(2).split(".");
},
//
getPromotion(item) {
if (item.promotionMap) {
let array = [];
Object.keys(item.promotionMap).forEach((child) => {
if (!array.includes(child.split("-")[0])) {
array.push(child.split("-")[0]);
}
});
return array;
}
},
//
navigateToDetailPage(item) {
uni.navigateTo({
url: `/pages/product/goods?id=${item.content.id}&goodsId=${item.content.goodsId}`,
});
},
//
navigateToStoreDetailPage(item) {
uni.navigateTo({
url: `/pages/product/shopPage?id=${item.content.storeId}`,
});
},
}
}
</script>
<style lang='scss' scoped>
/* 商品列表 */
.goods-list {
display: flex;
flex-wrap: wrap;
margin: 10rpx 20rpx 284rpx;
width: 100%;
>.goods-item {
background-color: #ffffff;
display: flex;
border-radius: 16rpx;
flex-direction: column;
width: calc(50% - 30rpx);
margin-bottom: 20rpx;
padding-bottom: 20rpx;
&:nth-child(2n + 1) {
margin-right: 20rpx;
}
.image-wrapper {
width: 100%;
height: 330rpx;
border-radius: 16rpx 16rpx 0 0;
overflow: hidden;
padding: 0;
}
}
.count-config,
.store-seller-name {
font-size: $font-sm;
}
.text-hidden {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.goods-row {
background: #fff;
padding: 16rpx;
>.goods-col {
display: flex;
>.goods-img {
overflow: hidden;
flex: 4;
}
>.goods-detail {
flex: 7;
}
}
}
.goods-detail {
margin: 0 20rpx;
>.title {
font-size: $font-base;
color: $font-color-dark;
line-height: 1.5;
height: 84rpx;
padding: 10rpx 0 0;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.promotion {
margin-top: 4rpx;
display: flex;
div {
span {
font-size: 24rpx;
color: $light-color;
margin-right: 10rpx;
padding: 0 4rpx;
border-radius: 2rpx;
}
}
}
.store-seller-name {
color: #666;
overflow: hidden;
display: flex;
justify-content: space-between;
}
.count-config {
padding: 5rpx 0;
color: #666;
display: flex;
font-size: 24rpx;
justify-content: space-between;
}
>.price-box {
margin-top: 10rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 10rpx;
font-size: 24rpx;
color: $font-color-light;
>.price {
font-size: 26rpx;
line-height: 1;
color: $main-color;
font-weight: bold;
/deep/ span:nth-of-type(1) {
font-size: 38rpx;
}
}
}
}
</style>

View File

@ -0,0 +1,160 @@
<template>
<div>
<div v-for="(item, index) in res" :key="index" class="goods-row" @click="navigateToDetailPage(item)">
<div class="flex goods-col">
<div class="goods-img">
<u-image width="230rpx" border-radius='16' height="230rpx" :src="item.goodsImage || item.thumbnail">
<u-loading slot="loading"></u-loading>
</u-image>
</div>
<div class="goods-detail">
<div class="title clamp3">{{ item.goodsName }}</div>
<div class='flex flex-a-c flex-j-sb'>
<view class="price-box">
<!-- 秒杀 / 拼团 -->
<div class="price" v-if="!type && item.price!=undefined">
¥<span>{{ formatPrice(item.price )[0] }} </span>.{{
formatPrice(item.price )[1]
}}
</div>
<!-- 砍价 -->
<div class="price" v-if="type && item.purchasePrice!=undefined">
最低
¥<span>{{ formatPrice(item.purchasePrice )[0] }} </span>.{{
formatPrice(item.purchasePrice )[1]
}}
</div>
</view>
<div>
<image class='buy' :src="buy"></image>
</div>
</div>
<div class='count-config' v-if="!type">
<span>即将恢复{{ item.originalPrice}}</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import commonTpl from '@/components/m-goods-list/common'
export default {
data() {
return {
lightColor: this.$mainColor,
buy: require('@/static/buy.png')
}
},
mixins: [commonTpl],
props: {
//
res: {
type: Array,
default: () => {
return []
}
},
type:{
type:null,
default:""
}
},
methods: {
//
navigateToDetailPage(item) {
uni.navigateTo({
url: `/pages/product/goods?id=${item.skuId}&goodsId=${item.goodsId}`,
});
},
}
}
</script>
<style lang='scss' scoped>
.buy {
width: 152rpx;
height: 108rpx;
}
.flex-j-sb {
width: 100%;
}
.goods-row {
background: #fff;
padding: 16rpx;
>.goods-col {
display: flex;
>.goods-img {
overflow: hidden;
flex: 4;
}
>.goods-detail {
flex: 7;
}
}
}
.goods-detail {
margin: 0 20rpx;
>.title {
font-size: $font-base;
color: $font-color-dark;
line-height: 1.5;
height: 84rpx;
padding: 10rpx 0 0;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.promotion {
margin-top: 4rpx;
display: flex;
div {
span {
font-size: 24rpx;
color: $light-color;
margin-right: 10rpx;
padding: 0 4rpx;
border-radius: 2rpx;
}
}
}
.count-config {
padding: 5rpx 0;
color: #666;
display: flex;
font-size: 24rpx;
letter-spacing:2rpx;
padding-left: 10rpx;
}
}
.price-box {
margin-top: 10rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 10rpx;
font-size: 24rpx;
color: $font-color-light;
>.price {
font-size: 26rpx;
line-height: 1;
color: $main-color;
font-weight: bold;
/deep/ span:nth-of-type(1) {
font-size: 48rpx;
}
}
}
</style>

View File

@ -4,14 +4,8 @@
*/ */
// 开发环境 // 开发环境
const dev = { const dev = {
// common: "https://common-api.pickmall.cn", common: "https://common-api.pickmall.cn",
// buyer: "https://buyer-api.pickmall.cn", buyer: "https://buyer-api.pickmall.cn",
common: "http://192.168.0.106:8890",
buyer: "http://192.168.0.106:8888",
}; };
// 生产环境 // 生产环境
const prod = { const prod = {

View File

@ -30,6 +30,8 @@ Object.keys(filters).forEach((key) => {
// 引入Vuex // 引入Vuex
Vue.prototype.$store = store; Vue.prototype.$store = store;
Vue.use(uView); Vue.use(uView);
Vue.config.productionTip = false; Vue.config.productionTip = false;

View File

@ -2,8 +2,8 @@
"name" : "lili商城", "name" : "lili商城",
"appid" : "__UNI__EC9FD60", "appid" : "__UNI__EC9FD60",
"description" : "", "description" : "",
"versionName" : "4.2.6", "versionName" : "4.2.5",
"versionCode" : 4000260, "versionCode" : 4000250,
"transformPx" : false, "transformPx" : false,
"app-plus" : { "app-plus" : {
"compatible" : { "compatible" : {

View File

@ -465,7 +465,9 @@
"pages": [ { "pages": [ {
"path": "seckill", "path": "seckill",
"style": { "style": {
"navigationBarTitleText": "限时抢购", "navigationBarTitleText": "限时抢购",
"navigationStyle": "custom", //
"navigationBarTextStyle": "white" ,
"app-plus": { "app-plus": {
"titleNView": { "titleNView": {
"homeButton":true "homeButton":true
@ -478,7 +480,8 @@
"path": "joinGroup", "path": "joinGroup",
"style": { "style": {
"navigationBarTitleText": "拼团活动", "navigationBarTitleText": "拼团活动",
"navigationStyle": "custom", // "navigationStyle": "custom", //
"navigationBarTextStyle": "white" ,
"app-plus": { "app-plus": {
// //
"bounce": "none" "bounce": "none"

View File

@ -138,7 +138,7 @@
if (this.routerVal.recharge_sn) { if (this.routerVal.recharge_sn) {
// //
this.sn = this.routerVal.recharge_sn; this.sn = this.routerVal.recharge_sn;
this.orderType = "RECHARGE"; this.orderType = "RECHARGE";
} else if (this.routerVal.trade_sn) { } else if (this.routerVal.trade_sn) {
this.sn = this.routerVal.trade_sn; this.sn = this.routerVal.trade_sn;
@ -178,12 +178,12 @@
this.payList = res.data.result.support.filter((item) => { this.payList = res.data.result.support.filter((item) => {
return item != "ALIPAY"; return item != "ALIPAY";
}); });
// //
if(this.orderType == "RECHARGE"){ if(this.orderType == "RECHARGE"){
this.payList = res.data.result.support.filter((item) => { this.payList = res.data.result.support.filter((item) => {
return item == "WECHAT"; return item == "WECHAT";
}); });
} }
} }

View File

@ -1,11 +1,11 @@
<template> <template>
<view class="add-address"> <view class="add-address">
<div class="uForm"> <div class="uForm">
<u-form :border-bottom="false" :model="form" ref="uForm" :error-type="['toast']" :rule="rules"> <u-form :border-bottom="false" :model="form" ref="uForm" :error-type="['toast']" :rule="rules">
<!-- #ifndef H5 --> <!-- #ifndef H5 -->
<view class="selectAddress" @click="clickUniMap"> <view class="selectAddress" @click="clickUniMap">
选择收货地址 选择收货地址
</view> </view>
<!-- #endif --> <!-- #endif -->
<u-form-item class="border" label="收货人" label-width="130" prop="name"> <u-form-item class="border" label="收货人" label-width="130" prop="name">
<u-input v-model="form.name" clearable placeholder="请输入收货人姓名" /> <u-input v-model="form.name" clearable placeholder="请输入收货人姓名" />
@ -162,9 +162,7 @@ export default {
delete this.form.updateTime; delete this.form.updateTime;
editAddress(this.form).then((res) => { editAddress(this.form).then((res) => {
if (res.data.success) { if (res.data.success) {
uni.navigateTo({ uni.navigateBack();
url: `/${beforePage.route}`,
});
} }
}); });
} }

View File

@ -86,23 +86,9 @@ export default {
* 进入页面检测当前账户是否登录 * 进入页面检测当前账户是否登录
*/ */
onShow() { onShow() {
let that = this; if (this.$options.filters.tipsToLogin()) {
if (this.$options.filters.isLogin("auth")) {
this.getAddressList(); this.getAddressList();
} else { }
uni.showModal({
title: "提示",
content: "检测到您的账号还未登录,是否去登录?",
confirmColor: this.$lightColor,
success: function (res) {
if (res.confirm) {
that.$options.filters.navigateToLogin();
} else if (res.cancel) {
uni.navigateBack();
}
},
});
}
}, },
methods: { methods: {
// //

View File

@ -256,4 +256,4 @@
display: -webkit-flex; display: -webkit-flex;
display: flex; display: flex;
} }
</style> </style>

View File

@ -326,10 +326,10 @@ export default {
// this.loadData(this.status); // this.loadData(this.status);
}, },
onShow() { onShow() {
if (!this.tabCurrentIndex) { if(this.$options.filters.tipsToLogin()){
this.initData(0); if (!this.tabCurrentIndex) {
} else { this.initData(0);
}
} }
// this.loadData(this.status); // this.loadData(this.status);
}, },
@ -340,7 +340,7 @@ export default {
* 替换onLoad下代码即可 * 替换onLoad下代码即可
*/ */
let status = Number(options.status); let status = Number(options.status);
this.status = status; this.status = status;
this.tabCurrentIndex = status; this.tabCurrentIndex = status;
// if (status == 0) { // if (status == 0) {

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<u-navbar :border-bottom="false"> <u-navbar :border-bottom="false">
<u-search v-model="keyword" @custom='search' :show-action="true" action-text="搜索" :animation="true" @search="search" @click="search" placeholder="请输入搜索"></u-search> <u-search v-model="keyword" @custom='search' :show-action="true" action-text="搜索" :animation="true" @search="search" @click="search" placeholder="请输入搜索"></u-search>
</u-navbar> </u-navbar>
<div class="wrapper"> <div class="wrapper">
@ -58,7 +58,7 @@
<!-- menu --> <!-- menu -->
<!-- 商品 --> <!-- 商品 -->
<div class="contant" v-if="current == 0"> <div class="contant" v-if="current == 0">
<u-empty style='margin-top:100rpx' v-if="goodsList.length == 0" class="empty" text='暂无商品信息'></u-empty> <u-empty style='margin-top:100rpx' v-if="goodsList.length == 0" class="empty" text='暂无商品信息'></u-empty>
<goodsTemplate v-else :res="goodsList" :storeName="false" /> <goodsTemplate v-else :res="goodsList" :storeName="false" />
@ -84,7 +84,7 @@
</template> </template>
<script> <script>
import { getStoreBaseInfo, getStoreCategory } from "@/api/store.js"; import { getStoreBaseInfo, getStoreCategory } from "@/api/store.js";
import goodsTemplate from '@/components/m-goods-list/list' import goodsTemplate from '@/components/m-goods-list/list'
import { import {
receiveCoupons, receiveCoupons,
@ -119,7 +119,7 @@ export default {
current(val) { current(val) {
val == 0 ? ()=>{ this.goodsList = []; this.getGoodsData()} : this.getCategoryData(); val == 0 ? ()=>{ this.goodsList = []; this.getGoodsData()} : this.getCategoryData();
}, },
}, },
components:{goodsTemplate}, components:{goodsTemplate},
/** /**
@ -203,10 +203,10 @@ export default {
// "/pages/tabbar/home/web-view?src=https://yzf.qq.com/xv/web/static/chat/index.html?sign=" + // "/pages/tabbar/home/web-view?src=https://yzf.qq.com/xv/web/static/chat/index.html?sign=" +
// sign, // sign,
// }); // });
// // #endif // // #endif
uni.navigateTo({ uni.navigateTo({
url: `/pages/tabbar/home/web-view?IM=${this.storeId}`, url: `/pages/tabbar/home/web-view?IM=${this.storeId}`,
}); });
}, },
@ -235,7 +235,7 @@ export default {
/** /**
* 搜索 * 搜索
*/ */
search() { search() {
console.log("点击") console.log("点击")
uni.navigateTo({ uni.navigateTo({
url: `/pages/navigation/search/searchPage?storeId=${this.storeId}&keyword=${this.keyword}`, url: `/pages/navigation/search/searchPage?storeId=${this.storeId}&keyword=${this.keyword}`,
@ -261,7 +261,7 @@ export default {
async getGoodsData() { async getGoodsData() {
let res = await getGoodsList(this.goodsParams); let res = await getGoodsList(this.goodsParams);
if (res.data.success) { if (res.data.success) {
this.goodsList.push(...res.data.result.content); this.goodsList.push(...res.data.result.content);
console.log(this.goodsList) console.log(this.goodsList)
} }
}, },

View File

@ -3,7 +3,7 @@
<u-navbar :custom-back="back" back-icon-color="#fff" :background="background" :border-bottom="false"> <u-navbar :custom-back="back" back-icon-color="#fff" :background="background" :border-bottom="false">
</u-navbar> </u-navbar>
<div class="wrapper"> <div class="wrapper-box">
<!-- 砍价列表 --> <!-- 砍价列表 -->
<div class="box box1"> <div class="box box1">
<div class="bargain"> <div class="bargain">
@ -106,10 +106,6 @@
<popupGoods ref="popupGoods" :buyMask="maskFlag" @closeBuy="closePopupBuy" :goodsDetail="bargainDetail" <popupGoods ref="popupGoods" :buyMask="maskFlag" @closeBuy="closePopupBuy" :goodsDetail="bargainDetail"
:goodsSpec="goodsSpec" v-if="bargainDetail.id " @handleClickSku="getGoodsDetail" /> :goodsSpec="goodsSpec" v-if="bargainDetail.id " @handleClickSku="getGoodsDetail" />
<!-- 产品详情 -->
<div class=" box4">
</div>
</div> </div>
</div> </div>
</template> </template>
@ -352,11 +348,11 @@ page {
align-items: center; align-items: center;
padding: 10rpx 0; padding: 10rpx 0;
} }
.wrapper { .wrapper-box {
background: url("https://lilishop-oss.oss-cn-beijing.aliyuncs.com/aac88f4e8eff452a8010af42c4560b04.png"); background: url("https://lili-system.oss-cn-beijing.aliyuncs.com/kanjia.png");
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
height: 700rpx; height: 506rpx;
width: 100%; width: 100%;
} }
@ -371,16 +367,16 @@ page {
} }
} }
.box1 { .box1 {
top: 750rpx; top: 560rpx;
} }
.box2 { .box2 {
top: 770rpx; top: 580rpx;
} }
.box3 { .box3 {
top: 790rpx; top: 600rpx;
} }
.box4 { .box4 {
top: 810rpx; top: 620 rpx;
height: 200rpx; height: 200rpx;
} }
.bargain-item { .bargain-item {

View File

@ -6,22 +6,7 @@
<!-- 砍价列表 --> <!-- 砍价列表 -->
<div class="box"> <div class="box">
<!-- 已砍的商品 --> <!-- 已砍的商品 -->
<div class="bargain" v-if="bargainList.length!=0"> <goodsTemplate type="kanJia" v-if="bargainList.length!=0" :res="bargainList" />
<div class="flex bargain-item" v-for="(item,index) in bargainList" :key="index">
<div class="goods-img">
<u-image width="150" height="150" :src="item.thumbnail"></u-image>
</div>
<div class="goods-config">
<div class="goods-title wes-2">
{{item.goodsName}}
</div>
<div class="flex goods-buy">
<div class="max-price">最低<span>{{item.purchasePrice | unitPrice}}</span></div>
<div class="bargaining" @click="navigateToBargainDetail(item)"></div>
</div>
</div>
</div>
</div>
<div class="bargain empty" v-else> <div class="bargain empty" v-else>
<u-empty text="暂无活动" mode="list"></u-empty> <u-empty text="暂无活动" mode="list"></u-empty>
</div> </div>
@ -32,7 +17,9 @@
<script> <script>
import { getBargainList } from "@/api/promotions"; import { getBargainList } from "@/api/promotions";
import goodsTemplate from '@/components/m-goods-list/promotion'
export default { export default {
components:{goodsTemplate},
data() { data() {
return { return {
background: { background: {
@ -91,7 +78,7 @@ page {
background: url("https://lili-system.oss-cn-beijing.aliyuncs.com/kanjia.png"); background: url("https://lili-system.oss-cn-beijing.aliyuncs.com/kanjia.png");
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
height: 600rpx; height: 506rpx;
width: 100%; width: 100%;
} }
@ -99,7 +86,7 @@ page {
background: #fff; background: #fff;
border-radius: 20rpx; border-radius: 20rpx;
position: relative; position: relative;
top: 650rpx; top: 560rpx;
width: 94%; width: 94%;
margin: 0 auto; margin: 0 auto;
> .bargain { > .bargain {

View File

@ -1,155 +1,133 @@
<template> <template>
<view class="wrapper"> <view class="wrapper">
<u-navbar :border-bottom="false" :title="title">
<!-- 中间 -->
<view class="slot-wrap container-wrap">
<view v-if="search">
<u-search @search="searchFun()" @custom="searchFun()" v-model="params.goodsName"></u-search>
</view>
</view>
<!-- 右侧 -->
<view slot="right">
<view style="margin-right: 24rpx;" @click="searchFlag()">
<view v-if="search"></view>
<u-icon v-if="!search" size="44rpx" name="search"></u-icon>
</view>
</view>
</u-navbar>
<!-- 顶部栏 -->
<div class='header-wraper'>
<image src="/static/join-buy.png"></image>
</div>
<!-- 商品栏 -->
<div class="swiper">
<goodsTemplate v-if="goodsList.length" :res="goodsList" />
<u-empty v-else style="margin-top:20%" text="暂无拼团活动" mode="data"></u-empty>
</div>
<u-navbar :border-bottom="false" :background="background" class="unavbar" :title="title"> </view>
<!-- 中间 -->
<view class="slot-wrap container-wrap">
<view v-if="search">
<u-search @search="searchFun()" @custom="searchFun()" v-model="params.goodsName"></u-search>
</view>
</view>
<!-- 右侧 -->
<view slot="right">
<view style="margin-right: 24rpx;" @click="searchFlag()">
<view v-if="search"></view>
<u-icon v-if="!search" size="44rpx" name="search"></u-icon>
</view>
</view>
</u-navbar>
<!-- 顶部栏 -->
<!-- 商品栏 -->
<div class="swiper">
<div v-if="groupBuy.length !=0">
<view class="view-item" v-for="(groupItem, groupIndex) in groupBuy" :key="groupIndex">
<view class="view-left">
<u-image border-radius="10" shape="square" :src="groupItem.thumbnail" width="186rpx" height="186rpx">
<view slot="error" style="font-size: 24rpx;">加载失败</view>
</u-image>
</view>
<view class="view-content">
<view class="view-content-name">
{{ groupItem.goodsName }}
</view>
<view class="view-content-bottom">
<view>
<view class="view-content-price">
<!-- {{groupItem.sales_price | unitPrice }} <span v-if="groupItem.point">+{{groupItem.point}}</span> -->
{{groupItem.price | unitPrice }}
</view>
<view class="view-content-original_price">
{{ groupItem.originalPrice | unitPrice }}
</view>
</view>
<view>
<view class="btn-group" @click="toHref(groupItem)"> </view>
<view class="buy-content">已售{{groupItem.num || 0}}</view>
</view>
</view>
</view>
</view>
<u-loadmore bg-color='#f8f8f8' :status="status" />
</div>
<u-empty v-else style="margin-top:20%" text="暂无拼团活动" mode="data"></u-empty>
</div>
</view>
</template> </template>
<script> <script>
import * as API_Promotions from "@/api/promotions"; import * as API_Promotions from "@/api/promotions";
import * as API_Goods from "@/api/goods"; import * as API_Goods from "@/api/goods";
export default { import goodsTemplate from '@/components/m-goods-list/promotion.vue'
components: {}, export default {
data() { components: {
return { goodsTemplate
status: "loadmore", },
is_empty: false, data() {
search: false, return {
title: "拼团活动", is_empty: false,
background: { search: false,
backgroundColor: "#fff", title: "拼团活动",
},
empty: false,
params: {
pageNumber: 1,
pageSize: 10,
categoryPath: "",
goodsName: "",
},
groupBuy: [],
};
},
mounted() {},
watch: {
search(val) {
val ? (this.title = "") : (this.title = "拼团活动");
},
},
onReachBottom() {
this.loadMore();
},
//
onNavigationBarButtonTap(e) {
this.popupFlag = !this.popupFlag;
},
async onLoad() {
this.GET_AssembleGoods();
},
methods: { empty: false,
loadMore() { params: {
this.params.pageNumber++; pageNumber: 1,
this.GET_AssembleGoods(); pageSize: 10,
}, categoryPath: "",
searchFlag() { goodsName: "",
this.search = !this.search; },
}, goodsList: [],
};
},
mounted() {},
watch: {
search(val) {
val ? (this.title = "") : (this.title = "拼团活动");
},
},
onReachBottom() {
this.loadMore();
},
//
onNavigationBarButtonTap(e) {
this.popupFlag = !this.popupFlag;
},
async onLoad() {
this.GET_AssembleGoods();
},
toHref(goods) { methods: {
uni.navigateTo({ loadMore() {
url: `/pages/product/goods?id=${goods.skuId}&goodsId=${goods.goodsId}`, this.params.pageNumber++;
}); this.GET_AssembleGoods();
}, },
searchFun() { searchFlag() {
this.groupBuy = []; this.search = !this.search;
this.GET_AssembleGoods(); },
},
//
GET_AssembleGoods() {
this.status = "loading";
const params = JSON.parse(JSON.stringify(this.params));
if (params.category_id === 0) delete params.category_id;
API_Promotions.getAssembleList(params) toHref(goods) {
.then((response) => { uni.navigateTo({
const data = response.data.result.records; url: `/pages/product/goods?id=${goods.skuId}&goodsId=${goods.goodsId}`,
});
},
searchFun() {
this.goodsList = [];
this.GET_AssembleGoods();
},
//
GET_AssembleGoods() {
if (!data || !data.length) { const params = JSON.parse(JSON.stringify(this.params));
this.is_empty = true; if (params.category_id === 0) delete params.category_id;
this.status = "nomore";
} else { API_Promotions.getAssembleList(params)
if (data.length <= this.params.pageSize) { .then((response) => {
this.status = "nomore"; const data = response.data.result.records;
} else {
this.status = "loadmore"; if (!data || !data.length) {
} this.is_empty = true;
this.is_empty = false;
this.groupBuy.push(...(data || [])); } else {
} if (data.length <= this.params.pageSize) {
})
.catch(() => {}); } else {
},
}, }
}; this.is_empty = false;
this.goodsList.push(...(data || []));
}
})
.catch(() => {});
},
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./style.scss"; .header-wraper {
background: url('/static/bg.png');
height: 200rpx;
display: flex;
align-items: center;
justify-content: center;
>image{
width: 188rpx;
height: 60rpx;
}
}
</style> </style>

View File

@ -23,8 +23,8 @@
<u-loading slot="loading"></u-loading> <u-loading slot="loading"></u-loading>
</u-image> </u-image>
<view class="index-item-title">{{ item.goodsName }}</view> <view class="index-item-title">{{ item.goodsName }}</view>
<view class="index-item-price"> <view class="index-item-price flex flex-a-c flex-j-sb">
{{ item.points }}积分 <div class="point"><span>{{ item.points }}</span>积分</div>
<span class="tipsMkt">¥{{ item.originalPrice | unitPrice }}</span> <span class="tipsMkt">¥{{ item.originalPrice | unitPrice }}</span>
</view> </view>
</view> </view>
@ -194,46 +194,12 @@ page {
height: 100%; height: 100%;
} }
.tipsMkt { .tipsMkt {
float: right;
color: #c0c4cc; color: #c0c4cc;
font-size: 24rpx; font-size: 24rpx !important;
text-decoration: line-through; text-decoration: line-through;
margin-right: 20rpx; margin-right: 20rpx !important;
} }
.header {
background: $light-color;
position: relative;
color: #fff;
display: flex;
height: 80rpx;
align-items: center;
justify-content: center;
font-size: 26rpx;
font-size: 34rpx;
.left,
.right {
position: absolute;
width: max-content;
height: max-content;
top: 0;
bottom: 0;
margin: auto;
}
.left {
float: left;
top: 0;
bottom: 0;
left: 20rpx;
}
.right {
float: right;
right: 20rpx;
}
}
.index { .index {
height: 100vh; height: 100vh;
@ -341,15 +307,19 @@ page {
overflow: hidden; overflow: hidden;
} }
.index-item-title-desc {
font-size: 25rpx;
color: #999999;
margin-top: 10rpx;
}
.index-item-price { .index-item-price {
font-size: 28rpx; font-size: 28rpx;
color: #ff5a10; overflow: hidden;
color: $main-color;
padding: 20rpx 0 0 20rpx; padding: 20rpx 0 0 20rpx;
>.point{
>span{
font-size: 42rpx;
font-weight: bold;
margin-right:10rpx;
}
}
} }
</style> </style>

View File

@ -1,7 +1,8 @@
<template> <template>
<view class="sale"> <view class="sale">
<view class="sale-head"> <u-navbar title='限时抢购'></u-navbar>
<image src="@/pages/promotion/static/head-sample.png"></image> <view class="header-wraper">
<image mode="widthFix" src="/static/seckill.png"></image>
</view> </view>
<scroll-view scroll-x> <scroll-view scroll-x>
<view class="index-navs"> <view class="index-navs">
@ -14,10 +15,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="trailer" v-if="timeLine[nav] && times">
{{ timeLine[nav].distanceStartTime === 0 ? (onlyOne ? '距结束' : '距下一轮') : '距开始' }}
{{ times.hours == '00' ? '0' : times.hours }}小时{{ times.minutes }}{{ times.seconds }}
</view>
</scroll-view> </scroll-view>
<view class="sale-items" v-if="goodsList.length > 0"> <view class="sale-items" v-if="goodsList.length > 0">
<goodsTemplate :res="goodsList" /> <goodsTemplate :res="goodsList" />
@ -39,7 +37,7 @@
getSeckillTimeGoods getSeckillTimeGoods
} from "@/api/promotions.js"; } from "@/api/promotions.js";
import Foundation from "@/utils/Foundation.js"; import Foundation from "@/utils/Foundation.js";
import goodsTemplate from '@/components/m-goods-list/seckill.vue' import goodsTemplate from '@/components/m-goods-list/promotion.vue'
export default { export default {
components: { components: {
goodsTemplate goodsTemplate
@ -184,10 +182,15 @@
} }
} }
.sale-head { .header-wraper {
image { background: url('/static/bg.png');
width: 100%; height: 200rpx;
height: 280rpx; display: flex;
align-items: center;
justify-content: center;
>image{
width: 300rpx;
height: 100rpx;
} }
} }
@ -195,22 +198,8 @@
padding-top: 20rpx; padding-top: 20rpx;
} }
.trailer {
height: 100rpx;
background: #ffffff;
display: -webkit-box;
display: -webkit-flex;
display: flex;
justify-content: center;
align-items: center;
font-size: 22rpx;
color: #666666;
box-sizing: border-box;
position: relative;
z-index: 0;
}
.index-navs { .index-navs {
background: #fff;
background-color: #f7f7f7; background-color: #f7f7f7;
display: -webkit-box; display: -webkit-box;
display: -webkit-flex; display: -webkit-flex;
@ -241,17 +230,19 @@
height: 115rpx; height: 115rpx;
line-height: 1em; line-height: 1em;
position: relative; position: relative;
font-size: 32rpx;
font-weight: bold;
&-active { &-active {
background-image: url(/static/seckill/active.png); color: $main-color;
background-size: 100% 115rpx;
background-repeat: no-repeat;
color: #ffffff;
position: relative; position: relative;
z-index: 30; z-index: 30;
.index-nav-desc { .index-nav-desc {
color: #ffffff; color: #fff;
font-weight: bold;
background: $main-color;
padding: 6rpx 16rpx;
border-radius: 50px;
} }
} }
} }

View File

@ -111,8 +111,8 @@
预估到手价 <span>{{ formatPrice(skuItem.priceDetailDTO.flowPrice)[0]}}</span> 预估到手价 <span>{{ formatPrice(skuItem.priceDetailDTO.flowPrice)[0]}}</span>
<span>.{{ formatPrice(skuItem.priceDetailDTO.flowPrice)[1] }} </span> <span>.{{ formatPrice(skuItem.priceDetailDTO.flowPrice)[1] }} </span>
</div> </div>
<div style='margin-left: 20rpx;' v-if="!skuItem.checked && skuItem.errorMessage"> <div style='margin-left: 20rpx;' v-if="!skuItem.checked && skuItem.errorMessage">
{{skuItem.errorMessage}} {{skuItem.errorMessage}}
</div> </div>
</view> </view>
</view> </view>

View File

@ -24,7 +24,9 @@
{{ item.title }} {{ item.title }}
</div> </div>
<div class="goods-bottom"> <div class="goods-bottom">
<div class="goods-price">{{ item.price | unitPrice }}</div> <div class="goods-price"> ¥<span>{{ formatPrice(item.price )[0] }} </span>.{{
formatPrice(item.price )[1]
}}</div>
</div> </div>
</div> </div>
</div> </div>
@ -56,6 +58,13 @@ export default {
}, },
mounted() {}, mounted() {},
methods: { methods: {
// 1999 --> [1999,00]
formatPrice(val) {
if (typeof val == "undefined") {
return val;
}
return val.toFixed(2).split(".");
},
handleClick(item) { handleClick(item) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`, url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`,
@ -163,13 +172,11 @@ $w_94: 94%;
> .goods-price { > .goods-price {
line-height: 2; line-height: 2;
color: $main-color; color: $main-color;
>span{
font-size: 42rpx;
}
} }
} }
} }
.goods-icon {
right: 10rpx;
top: 10rpx;
position: absolute;
}
</style> </style>

View File

@ -129,10 +129,10 @@ export default {
} }
}); });
}, },
// //
isConnected(val) { isConnected(val){
val ? this.init() : ""; val ? this.init() : ''
}, },
/** /**
* TODO 扫码功能后续还会后续增加 * TODO 扫码功能后续还会后续增加

View File

@ -854,7 +854,8 @@ function downloadPopup(data, callback, cancelCallback, rebootCallback) {
export default function (isPrompt = false) { export default function (isPrompt = false) {
getCurrentNo((version) => { getCurrentNo((version) => {
getServerNo((res) => { getServerNo((res) => {
if (res.versionCode.replace(/\./g, "") <= version.version.replace(/\./g, "") ) {
if (res.versionCode.replace(/\./g, "") <= version.version.replace(/\./g, "")) {
return false; return false;
} }

BIN
static/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
static/bg1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
static/join-buy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
static/seckill.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 692 B

View File

@ -149,6 +149,9 @@ $font-weight: 400;
} }
.flex-a-c{ .flex-a-c{
align-items: center; align-items: center;
}
.flex-j-sb{
justify-content: space-between;
} }
.relative { .relative {
position: relative; position: relative;

View File

@ -1,5 +1,7 @@
import Foundation from "./Foundation.js"; import Foundation from "./Foundation.js";
import storage from "@/utils/storage.js"; import storage from "@/utils/storage.js";
import { getUserInfo } from '@/api/members';
import Vue from "vue";
/** /**
* 金钱单位置换 2999 --> 2,999.00 * 金钱单位置换 2999 --> 2,999.00
* @param val * @param val
@ -99,12 +101,46 @@ export function clearStrComma(str) {
export function isLogin(val) { export function isLogin(val) {
let userInfo = storage.getUserInfo(); let userInfo = storage.getUserInfo();
if (val == "auth") { if (val == "auth") {
return userInfo.id ? true : false; return userInfo && userInfo.id ? true : false;
} else { } else {
return storage.getUserInfo(); return storage.getUserInfo();
} }
} }
export function tipsToLogin(){
if(!isLogin('auth')){
uni.showModal({
title: "提示",
content: "当前用户未登录是否登录?",
confirmText: "确定",
cancelText: "取消",
confirmColor:Vue.prototype.$mainColor,
success: res => {
if (res.confirm) {
navigateToLogin()
} else if (res.cancel) {
uni.navigateBack()
}
},
})
return
}
}
/**
* 获取用户信息并重新添加到缓存里面
*/
export async function userInfo(){
let res = await getUserInfo();
if(res.data.success){
storage.setUserInfo(res.data.result);
return res.data.result
}
}
/** /**
* 验证是否登录如果没登录则去登录 * 验证是否登录如果没登录则去登录
* @param {*} val * @param {*} val
@ -113,7 +149,7 @@ export function isLogin(val) {
export function forceLogin() { export function forceLogin() {
let userInfo = storage.getUserInfo(); let userInfo = storage.getUserInfo();
if (!userInfo.id) { if (!userInfo || !userInfo.id) {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
uni.navigateTo({ uni.navigateTo({

View File

@ -1,7 +1,11 @@
import Request from "@/lib/request/index.js"; import Request from "@/lib/request/index.js";
import { refreshTokenFn } from "@/api/login.js"; import {
refreshTokenFn
} from "@/api/login.js";
import storage from "@/utils/storage.js"; import storage from "@/utils/storage.js";
import { md5 } from "@/utils/md5.js"; import {
md5
} from "@/utils/md5.js";
import Foundation from "@/utils/Foundation.js"; import Foundation from "@/utils/Foundation.js";
import api from "@/config/api.js"; import api from "@/config/api.js";
@ -11,90 +15,93 @@ import uuid from "@/utils/uuid.modified.js";
let isNavigateTo = false let isNavigateTo = false
function cleanStorage() { function cleanStorage() {
uni.showToast({ uni.showToast({
title: "你的登录状态已过期,请重新登录", title: "你的登录状态已过期,请重新登录",
icon: "none", icon: "none",
duration: 1500, duration: 1500,
}); });
if (uni.showLoading()) { if (uni.showLoading()) {
uni.hideLoading(); uni.hideLoading();
} }
storage.setHasLogin(false); storage.setHasLogin(false);
storage.setAccessToken(""); storage.setAccessToken("");
storage.setRefreshToken(""); storage.setRefreshToken("");
console.log("清空token"); console.log("清空token");
storage.setUuid(""); storage.setUuid("");
storage.setUserInfo({}); storage.setUserInfo({});
if (!isNavigateTo) { if (!isNavigateTo) {
isNavigateTo = true isNavigateTo = true
// 防抖处理跳转 // 防抖处理跳转
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
uni.navigateTo({ uni.navigateTo({
url: "/pages/passport/wechatMPLogin", url: "/pages/passport/wechatMPLogin",
}); });
// #endif // #endif
// #ifndef MP-WEIXIN // #ifndef MP-WEIXIN
uni.navigateTo({ uni.navigateTo({
url: "/pages/passport/login", url: "/pages/passport/login",
}); });
// #endif // #endif
} }
} }
let http = new Request(); let http = new Request();
http.setConfig((config) => { http.setConfig((config) => {
// 没有uuid创建 // 没有uuid创建
if (!storage.getUuid()) { if (!storage.getUuid()) {
storage.setUuid(uuid.v1()); storage.setUuid(uuid.v1());
} }
/* 设置全局配置 */ /* 设置全局配置 */
config.baseURL = api.buyer; config.baseURL = api.buyer;
config.header = { config.header = {
...config.header, ...config.header,
}; };
config.validateStatus = (statusCode) => { config.validateStatus = (statusCode) => {
// 不论什么状态,统一在正确中处理 // 不论什么状态,统一在正确中处理
return true; return true;
}; };
return config; return config;
}); });
http.interceptors.request.use( http.interceptors.request.use(
(config) => { (config) => {
/* 请求之前拦截器。可以使用async await 做异步操作 */ /* 请求之前拦截器。可以使用async await 做异步操作 */
let accessToken = storage.getAccessToken(); let accessToken = storage.getAccessToken();
if (accessToken) { if (accessToken) {
const nonce = Foundation.randomString(6); const nonce = Foundation.randomString(6);
const timestamp = parseInt(new Date().getTime() / 1000); const timestamp = parseInt(new Date().getTime() / 1000);
const sign = md5(nonce + timestamp + accessToken); const sign = md5(nonce + timestamp + accessToken);
const _params = { const _params = {
nonce, nonce,
timestamp, timestamp,
sign, sign,
}; };
let params = config.params || {}; let params = config.params || {};
params = { ...params, ..._params }; params = {
...params,
..._params
};
config.params = params; config.params = params;
config.header.accessToken = accessToken; config.header.accessToken = accessToken;
} }
config.header = { config.header = {
...config.header, ...config.header,
uuid: storage.getUuid() || uuid.v1(), uuid: storage.getUuid() || uuid.v1(),
}; };
return config; return config;
}, },
(config) => { (config) => {
return Promise.reject(config); return Promise.reject(config);
} }
); );
@ -104,90 +111,96 @@ let isRefreshing = false;
let requests = []; let requests = [];
// 必须使用异步函数,注意 // 必须使用异步函数,注意
http.interceptors.response.use( http.interceptors.response.use(
async (response) => { async (response) => {
isNavigateTo = false isNavigateTo = false
/* 请求之后拦截器。可以使用async await 做异步操作 */ /* 请求之后拦截器。可以使用async await 做异步操作 */
// token存在并且token过期 // token存在并且token过期
// if (isRefreshing && response.statusCode === 403) { // if (isRefreshing && response.statusCode === 403) {
// cleanStorage(); // cleanStorage();
// isRefreshing = false; // isRefreshing = false;
// } // }
console.log(response)
let token = storage.getAccessToken();
if (
(token && response.statusCode === 403) ||
response.data.status === 403
) {
if (!isRefreshing) {
console.log('旧token',token)
isRefreshing = true;
storage.setAccessToken('')
let oldRefreshToken = storage.getRefreshToken();
//调用刷新token的接口
return refreshTokenFn(oldRefreshToken)
.then((res) => {
let { accessToken, refreshToken } = res.data.result;
storage.setAccessToken(accessToken);
storage.setRefreshToken(refreshToken);
response.header.accessToken = `${accessToken}`; let token = storage.getAccessToken();
// token 刷新后将数组的方法重新执行 if (
console.log('接口队列',requests,'新token',accessToken) (token && response.statusCode === 403) ||
requests.forEach((cb) => cb(accessToken)); response.data.status === 403
requests = []; // 重新请求完清空 ) {
return http.request(response.config); if (!isRefreshing) {
}) console.log('旧token', token)
.catch((err) => { isRefreshing = true;
console.log('刷新token报错'+oldRefreshToken,err) storage.setAccessToken('')
cleanStorage(); let oldRefreshToken = storage.getRefreshToken();
return Promise.reject(err); //调用刷新token的接口
}) return refreshTokenFn(oldRefreshToken)
.finally(() => { .then((res) => {
isRefreshing = false; let {
}); accessToken,
} else { refreshToken
// 返回未执行 resolve 的 Promise } = res.data.result;
return new Promise((resolve) => { storage.setAccessToken(accessToken);
// 用函数形式将 resolve 存入,等待刷新后再执行 storage.setRefreshToken(refreshToken);
requests.push((token) => {
response.header.accessToken = `${token}`;
resolve(http.request(response.config));
});
});
}
// 如果当前返回没登录
} else if (
(!token && !storage.getRefreshToken() && response.statusCode === 403) ||
response.data.code === 403
) {
console.log('没有token 以及刷新token 内容',token,storage.getRefreshToken())
cleanStorage();
// 如果当前状态码为正常但是success为不正常时 response.header.accessToken = `${accessToken}`;
} else if ( // token 刷新后将数组的方法重新执行
(response.statusCode == 200 && !response.data.success) || console.log('接口队列', requests, '新token', accessToken)
response.statusCode == 400 requests.forEach((cb) => cb(accessToken));
) { requests = []; // 重新请求完清空
if (response.data.message) { return http.request(response.config);
uni.showToast({ })
title: response.data.message, .catch((err) => {
icon: "none", console.log('刷新token报错' + oldRefreshToken, err)
duration: 1500, cleanStorage();
}); return Promise.reject(err);
} })
} .finally(() => {
return response; isRefreshing = false;
}, });
(error) => { } else {
return error; // 返回未执行 resolve 的 Promise
} return new Promise((resolve) => {
// 用函数形式将 resolve 存入,等待刷新后再执行
requests.push((token) => {
response.header.accessToken = `${token}`;
resolve(http.request(response.config));
});
});
}
// 如果当前返回没登录
} else if (
(!token && !storage.getRefreshToken() && response.statusCode === 403) ||
response.data.code === 403
) {
console.log('没有token 以及刷新token 内容', token, storage.getRefreshToken())
cleanStorage();
// 如果当前状态码为正常但是success为不正常时
} else if (
(response.statusCode == 200 && !response.data.success) ||
response.statusCode == 400
) {
if (response.data.message) {
uni.showToast({
title: response.data.message,
icon: "none",
duration: 1500,
});
}
}
return response;
},
(error) => {
return error;
}
); );
export { http }; export {
http
};
export const Method = { export const Method = {
GET: "GET", GET: "GET",
POST: "POST", POST: "POST",
PUT: "PUT", PUT: "PUT",
DELETE: "DELETE", DELETE: "DELETE",
}; };