解决后端更新之后es中与前端不匹配bug,优化部分代码复用性

master
lemon橪 2021-09-02 16:08:35 +08:00
parent 275d76c0dd
commit 6ca01d2c71
15 changed files with 88 additions and 73 deletions

View File

@ -4,16 +4,16 @@
<div class="goods-list">
<div @click="handleClick(item)" class="goods-item" v-for="(item, item_index) in goodsList" :key="item_index">
<div class="goods-img">
<u-image :src="item.thumbnail" mode="aspectFill" height="350rpx" width="100%">
<u-image :src="item.content.thumbnail" mode="aspectFill" height="350rpx" width="100%">
<u-loading slot="loading"></u-loading>
</u-image>
</div>
<div class="goods-desc">
<div class="goods-title">
{{ item.goodsName }}
{{ item.content.goodsName }}
</div>
<div class="goods-bottom">
<div class="goods-price">{{ item.price | unitPrice }}</div>
<div class="goods-price">{{ item.content.price | unitPrice }}</div>
</div>
</div>
</div>
@ -73,13 +73,12 @@ export default {
delete submit[key];
}
});
let goodsList = await getGoodsList(submit);
this.goodsList.push(...goodsList.data.result.content);
},
handleClick(item) {
uni.navigateTo({
url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`,
url: `/pages/product/goods?id=${item.content.id}&goodsId=${item.content.goodsId}`,
});
},
},

View File

@ -1,7 +1,8 @@
const name = "lilishop";
const name = "lilishop"; //全局商城name
const schemeName = 'lilishop' //唤醒app需要的schemeName
export default {
name: name,
schemeLink: `${name}://`, //唤起app地址
schemeLink: `${schemeName}://`, //唤起app地址
downloadLink: "https://pickmall.cn/download-page/index.html", //下载地址下载app的地址
shareLink: "https://m-b2b2c.pickmall.cn", //分享地址也就是在h5中默认的复制地址
appid: "wx6f10f29075dc1b0b", //小程序唯一凭证,即 AppID可在「微信公众平台 - 设置 - 开发设置」页中获得。(需要已经成为开发者,且帐号没有异常状态)

View File

@ -85,16 +85,16 @@
<div class="goodsClass">
<u-row v-for="(item, index) in goodsList" :key="index" class="goodsRow">
<u-col :span="4" @click.native="navigateToDetailPage(item)" class="switchType1">
<u-image width="182rpx" height="200rpx" class="imgGoods" :src="item.thumbnail">
<u-image width="182rpx" height="200rpx" class="imgGoods" :src="item.content.thumbnail">
<u-loading slot="loading"></u-loading>
</u-image>
</u-col>
<u-col :span="8" @click.native="navigateToDetailPage(item)" class="switchType2">
<div class="title clamp3" style="">{{ item.goodsName }}</div>
<div class="title clamp3" style="">{{ item.content.goodsName }}</div>
<view class="price-box">
<div class="price" v-if="item.price!=undefined">
¥<span>{{ formatPrice(item.price )[0] }} </span>.{{
formatPrice(item.price )[1]
<div class="price" v-if="item.content.price!=undefined">
¥<span>{{ formatPrice(item.content.price )[0] }} </span>.{{
formatPrice(item.content.price )[1]
}}
</div>
</view>
@ -156,15 +156,15 @@
<view v-for="(item, index) in goodsList" :key="index" class="goods-item"
@click="navigateToDetailPage(item)">
<view class="image-wrapper">
<image :src="item.thumbnail" mode="aspectFill"></image>
<image :src="item.content.thumbnail" mode="aspectFill"></image>
</view>
<view class="goods-detail">
<div class="title clamp">{{ item.goodsName }}</div>
<div class="title clamp">{{ item.content.goodsName }}</div>
<view class="price-box">
<div class="price" v-if="item.price!=undefined">
<div class="price" v-if="item.content.price!=undefined">
¥<span>{{ formatPrice(item.price )[0] }} </span>.{{
formatPrice(item.price )[1]
¥<span>{{ formatPrice(item.content.price )[0] }} </span>.{{
formatPrice(item.content.price )[1]
}}
</div>
</view>
@ -538,7 +538,7 @@ export default {
},
navigateToDetailPage(item) {
uni.navigateTo({
url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`,
url: `/pages/product/goods?id=${item.content.id}&goodsId=${item.content.goodsId}`,
});
},
loadmore() {
@ -669,7 +669,7 @@ export default {
if (type == "refresh") {
this.goodsList = [];
}
//
// #TODO
let goodsList = await getGoodsList(this.params);
if (goodsList.data.result.content.length < 10) {

View File

@ -790,7 +790,7 @@ page {
.wrapper {
height: auto;
background: #ededed;
background: #f7f7f7;
padding-bottom: 200rpx;
overflow: auto !important;
}

View File

@ -48,10 +48,10 @@ span {
border-radius: 100px;
}
.logo {
margin-top: 20rpx;
width: 200rpx;
height: 200rpx;
text-align: center;
transform: scale(2.5);
}
.logo-cell {
text-align: center;

View File

@ -4,9 +4,9 @@
<view class="login-ball bg-linear-gradient small"></view>
<view class="logo-cell">
<image class="logo" src="/static/logo.png" mode="aspectFit"></image>
<image class="logo" :src="config.logo" mode="aspectFit"></image>
</view>
<view class="title">LiLi商城</view>
<view class="title">{{config.name}}</view>
<!-- 验证码登录 -->
<codeLogin @open="open" :status="value" v-if="login && loginData.code" />
@ -31,8 +31,8 @@ import { getUserInfo } from "@/api/members";
import storage from "@/utils/storage.js";
import { loginCallback } from "@/api/connect.js";
import { webConnect } from "@/api/connect.js";
import config from "@/config/config";
export default {
onShow() {
// #ifdef MP-WEIXIN
this.mpWechatLogin = false;
@ -65,7 +65,8 @@ export default {
},
data() {
return {
lightColor:this.$lightColor,
config,
lightColor: this.$lightColor,
mpWechatLogin: true, //
value: true, //
loginData: {
@ -102,7 +103,6 @@ export default {
//
stateLogin(state) {
loginCallback(state).then((res) => {
let data = res.data;
if (data.success) {
storage.setAccessToken(data.result.accessToken);

View File

@ -12,7 +12,7 @@
<view class="wx-auth-container">
<div class="box">
<view class="logo-info">
<text class="title">欢迎进入{{ projectName }}商城</text>
<text class="title">欢迎进入{{ projectName }}</text>
</view>
<view class="small-tips">
<view>为您提供优质服务,{{ projectName }}需要获取以下信息</view>
@ -33,13 +33,14 @@ import { mpAutoLogin } from "@/api/connect.js";
import { whetherNavigate } from "@/utils/Foundation"; //
import { getUserInfo } from "@/api/members";
import storage from "@/utils/storage.js";
import config from '@/config/config'
export default {
data() {
return {
//
phoneAuthPopup: false,
//
projectName: "LiLi",
projectName: config.name,
//sessionkey
code: "",
//

View File

@ -7,9 +7,11 @@
<!-- 仅h5有效 打开App -->
<!-- 分享 -->
<shares v-if="shareFlage && goodsDetail.id" :skuId="this.routerVal.id" :goodsId="this.routerVal.goodsId" :link="'/pages/product/goods?id='+this.routerVal.id+'&goodsId='+this.routerVal.goodsId"
<shares v-if="shareFlage && goodsDetail.id" :skuId="this.routerVal.id" :goodsId="this.routerVal.goodsId"
:link="'/pages/product/goods?id='+this.routerVal.id+'&goodsId='+this.routerVal.goodsId"
:thumbnail="goodsDetail.thumbnail" :goodsName="goodsDetail.goodsName" type="goods" @close="shareFlage = false" />
<popups v-model="popupsSwitch" @tapPopup="handleNavbarList" :popData="navbarListData" :x="navbarListX" :y="navbarListY" placement="top-start" />
<popups v-model="popupsSwitch" @tapPopup="handleNavbarList" :popData="navbarListData" :x="navbarListX"
:y="navbarListY" placement="top-start" />
<view class="index">
<!-- topBar -->
@ -22,7 +24,8 @@
</div>
<div class="headerList" :class="headerFlag ? 'tab-bar' : 'tab-bar scroll-hide'">
<div class="headerRow">
<div class="nav-item" v-for="header in headerList" :key="header.id" :class="{ cur: scrollId === header.id }" @click="headerTab(header.id)">
<div class="nav-item" v-for="header in headerList" :key="header.id"
:class="{ cur: scrollId === header.id }" @click="headerTab(header.id)">
{{ header.text }}
</div>
</div>
@ -30,7 +33,8 @@
</div>
</u-navbar>
<u-navbar :border-bottom="false" v-show="!headerFlag" class="header-only-back" :background="navbarOnlyBack" :is-back="false">
<u-navbar :border-bottom="false" v-show="!headerFlag" class="header-only-back" :background="navbarOnlyBack"
:is-back="false">
<div>
<div class="bg-back">
<u-icon size="40" @click="back()" name="arrow-left" class="icon-back"></u-icon>
@ -42,7 +46,8 @@
</view>
<view class="product-container" :style="{ height: productRefHeight }" ref="productRef" id="productRef">
<scroll-view scroll-anchoring enableBackToTop="true" scroll-with-animation scroll-y class="scroll-page" :scroll-top="tabScrollTop" @scroll="pageScroll">
<scroll-view scroll-anchoring enableBackToTop="true" scroll-with-animation scroll-y class="scroll-page"
:scroll-top="tabScrollTop" @scroll="pageScroll">
<view>
<!-- 轮播图 -->
<GoodsSwiper id="main1" :res="imgList" />
@ -58,7 +63,8 @@
{{ goodsDetail.goodsName || "" }}
</view>
<view class="favorite" @click="clickFavorite(goodsDetail.id)">
<u-icon size="30" :color="favorite ? '#f2270c' : '#262626'" :name="favorite ? 'heart-fill' : 'heart'"></u-icon>
<u-icon size="30" :color="favorite ? '#f2270c' : '#262626'" :name="favorite ? 'heart-fill' : 'heart'">
</u-icon>
<view :style="{ color: favorite ? '#f2270c' : '#262626' }">{{ favorite ? "已收藏" : "收藏" }}</view>
</view>
</view>
@ -88,7 +94,8 @@
<view>分享</view>
</view>
<view class="icons" @click="clickFavorite(goodsDetail.id)">
<u-icon size="30" :color="favorite ? '#f2270c' : '#262626'" :name="favorite ? 'heart-fill' : 'heart'"></u-icon>
<u-icon size="30" :color="favorite ? '#f2270c' : '#262626'"
:name="favorite ? 'heart-fill' : 'heart'"></u-icon>
<view :style="{ color: favorite ? '#f2270c' : '#262626' }">{{ favorite ? "已收藏" : "收藏" }}</view>
</view>
</view>
@ -153,7 +160,8 @@
<storeLayout id="main7" :storeDetail="storeDetail" :goodsDetail="goodsDetail" :res="recommendList" />
<!-- 宝贝详情 -->
<GoodsIntro id="main9" :res="goodsDetail" :goodsParams="goodsParams" :goodsId="goodsDetail.goodsId" v-if="goodsDetail.id" />
<GoodsIntro id="main9" :res="goodsDetail" :goodsParams="goodsParams" :goodsId="goodsDetail.goodsId"
v-if="goodsDetail.id" />
<!-- 宝贝推荐 -->
<GoodsRecommend id="main11" :res="likeGoodsList" />
@ -178,7 +186,8 @@
</view>
<!-- 正常结算页面 -->
<view class="detail-btn" v-if="!isGroup">
<view class="to-store-car to-store-btn" v-if="goodsDetail.goodsType!='VIRTUAL_GOODS'" @click="shutMask(4)"></view>
<view class="to-store-car to-store-btn" v-if="goodsDetail.goodsType!='VIRTUAL_GOODS'" @click="shutMask(4)">
加入购物车</view>
<view class="to-buy to-store-btn" @click="shutMask(4, 'buy')">立即购买</view>
<view class="to-store-car to-store-btn" v-if="startTimer"></view>
</view>
@ -215,10 +224,12 @@
</view>
<!-- 配送地址弹窗 -->
<popupAddress @closeAddress="closePopupAddress" @deliveryData="deliveryFun" v-if="goodsDetail.id" :goodsId="goodsDetail.id" :addressFlag="addressFlag" />
<popupAddress @closeAddress="closePopupAddress" @deliveryData="deliveryFun" v-if="goodsDetail.id"
:goodsId="goodsDetail.id" :addressFlag="addressFlag" />
<!-- 商品规格 商品详情以及默认参与活动的id-->
<popupGoods :addr="delivery" ref="popupGoods" @changed="changedGoods" @closeBuy="closePopupBuy" @queryCart="cartCount()" :goodsDetail="goodsDetail" :goodsSpec="goodsSpec" :id="productId"
<popupGoods :addr="delivery" ref="popupGoods" @changed="changedGoods" @closeBuy="closePopupBuy"
@queryCart="cartCount()" :goodsDetail="goodsDetail" :goodsSpec="goodsSpec" :id="productId"
v-if="goodsDetail.id " :pointDetail="pointDetail" @handleClickSku="selectSku" :buyMask="buyMask" />
</view>
</view>
@ -510,11 +521,11 @@ export default {
this.productId = id; // skuId
//
let response = await getGoods(id, goodsId);
if (!response.data.success) {
uni.navigateBack();
return false;
setTimeout(()=>{
uni.navigateBack();
},500)
}
//
if (distributionId || this.$store.state.distributionId) {
@ -719,6 +730,7 @@ export default {
/**
* 获取相似商品列表
*
*/
getOtherLikeGoods() {
getGoodsList({
@ -728,7 +740,6 @@ export default {
keyword: this.goodsDetail.name,
}).then((res) => {
this.likeGoodsList = res.data.result.content;
console.warn(this.likeGoodsList);
});
},

View File

@ -13,7 +13,7 @@
:fade="true"
duration="450"
:lazy-load="true"
:src="item.thumbnail"
:src="item.content.thumbnail"
width="330rpx"
height="330rpx"
class="like-goods-uimage"
@ -21,12 +21,12 @@
<u-loading slot="loading"></u-loading>
</u-image>
<view style="background-color: #ffffff; width: 100%">
<view class="name">{{ item.goodsName }}</view>
<view class="name">{{ item.content.goodsName }}</view>
<view class="price-sales">
<div class="item-price" v-if="item.price != undefined">
<div class="item-price" v-if="item.content.price != undefined">
<span>{{ formatPrice(item.price)[0] }}</span>
.{{formatPrice(item.price)[1]}}
<span>{{ formatPrice(item.content.price)[0] }}</span>
.{{formatPrice(item.content.price)[1]}}
<!-- <text v-if="item.point != undefined">+{{ item.point }}</text> -->
</div>
</view>
@ -44,7 +44,7 @@ export default {
//
clickGoods(val) {
uni.navigateTo({
url: `/pages/product/goods?id=${val.id}&goodsId=${val.goodsId}`
url: `/pages/product/goods?id=${val.content.id}&goodsId=${val.content.goodsId}`
});
},
// 1999 --> [1999,00]

View File

@ -63,7 +63,7 @@
<!-- 数量 -->
<view class="goods-skus-number">
<view class="view-class-title">数量</view>
<u-number-box :bg-color="numberBox.bgColor" :color="numberBox.color" :input-width="numberBox.width" :input-height="numberBox.height" :size="numberBox.size" :min="1" v-model="num">
<u-number-box :bg-color="numberBox.bgColor" :max="200" :color="numberBox.color" :input-width="numberBox.width" :input-height="numberBox.height" :size="numberBox.size" :min="1" v-model="num">
</u-number-box>
</view>
</view>

View File

@ -24,15 +24,15 @@
<view class="store-recommend-title">商品推荐</view>
<view class="recommend-list">
<view class="recommend-item" @click="clickGoods(item)" v-for="(item, index) in res" :key="index">
<u-image class="recommend-item-img" :fade="true" duration="450" :lazy-load="true" :src="item.thumbnail" height="218rpx">
<u-image class="recommend-item-img" :fade="true" duration="450" :lazy-load="true" :src="item.content.thumbnail" height="218rpx">
<u-loading slot="loading"></u-loading>
<view slot="error" style="font-size: 24rpx; ">加载失败</view>
</u-image>
<view class="recommend-item-name">
{{ item.goodsName }}
{{ item.content.goodsName }}
</view>
<view class="item-price" v-if="item.price != undefined">
<span class="item-price-blod">{{ formatPrice(item.price)[0] }}</span>.{{ formatPrice(item.price)[1] }}
<span class="item-price-blod">{{ formatPrice(item.content.price)[0] }}</span>.{{ formatPrice(item.content.price)[1] }}
</view>
</view>
</view>
@ -58,7 +58,7 @@ export default {
//
clickGoods(val) {
uni.navigateTo({
url: `/pages/product/goods?id=${val.id}&goodsId=${val.goodsId}`,
url: `/pages/product/goods?id=${val.content.id}&goodsId=${val.content.goodsId}`,
});
},

View File

@ -6,7 +6,7 @@
<div class="wrapper">
<!-- 店铺信息模块 -->
<div class="store flex">
<u-image border-radius="10" width="150" height="150" :src="storeInfo.storeLogo || '/static/logo.png'" mode="aspectFit"></u-image>
<u-image border-radius="10" width="150" height="150" :src="storeInfo.storeLogo || config.logo" mode="aspectFit"></u-image>
<div class="box">
<div class="store-name" @click="getStoreLicencePhoto">
{{ storeInfo.storeName || ''}}
@ -60,15 +60,15 @@
<div class="contant" v-if="current == 0">
<view v-if="!goodsList.length" class="empty"></view>
<view v-else class="item" v-for="(item,index) in goodsList" :key="index" @click="navigateToGoodsDetail(item)">
<u-image width="100%" height="330rpx" mode="aspectFit" :src="item.thumbnail">
<u-image width="100%" height="330rpx" mode="aspectFit" :src="item.content.thumbnail">
<u-loading slot="loading"></u-loading>
</u-image>
<div class="name">{{ item.goodsName }}</div>
<div class="name">{{ item.content.goodsName }}</div>
<div class="price">
<div>{{ item.price | unitPrice }}</div>
<div>{{ item.content.price | unitPrice }}</div>
</div>
<view class="buyCount">
<div>已售 {{ item.buyCount || "0" }}</div>
<div>已售 {{ item.content.buyCount || "0" }}</div>
</view>
</view>
</div>
@ -99,13 +99,14 @@ import {
collectionGoods,
getGoodsIsCollect,
} from "@/api/members.js";
import config from '@/config/config'
import storage from "@/utils/storage";
import { getGoodsList } from "@/api/goods.js";
import { getAllCoupons } from "@/api/promotions.js";
export default {
data() {
return {
config,
scrollTop: 0,
mainColor: this.$mainColor, //
current: 0, //tabs
@ -278,7 +279,7 @@ export default {
*/
navigateToGoodsDetail(val) {
uni.navigateTo({
url: `/pages/product/goods?id=${val.id}&goodsId=${val.goodsId}`,
url: `/pages/product/goods?id=${val.content.id}&goodsId=${val.content.goodsId}`,
});
},

View File

@ -5,12 +5,12 @@
<div class="contant">
<view v-if="!goodsList.length" class="empty"></view>
<view v-else class="item" v-for="(item,index) in goodsList" :key="index" @click="navigateToGoodsDetail(item)">
<u-image width="100%" mode="aspectFit" height="324rpx" :src="item.thumbnail">
<u-image width="100%" mode="aspectFit" height="324rpx" :src="item.content.thumbnail">
<u-loading slot="loading"></u-loading>
</u-image>
<div class="name">{{ item.goodsName }}</div>
<div class="name">{{ item.content.goodsName }}</div>
<div class="price">
<div>{{ item.price | unitPrice }}</div>
<div>{{ item.content.price | unitPrice }}</div>
</div>
<view class="buyCount">
<div>已售 {{ item.buyCount || "0" }}</div>
@ -61,11 +61,12 @@ export default {
*/
navigateToGoodsDetail(val) {
uni.navigateTo({
url: `/pages/product/goods?id=${val.id}&goodsId=${val.goodsId}`,
url: `/pages/product/goods?id=${val.content.id}&goodsId=${val.content.goodsId}`,
});
},
async getGoodsData() {
// #TODO
let goodsList = await getGoodsList(this.params);
if (goodsList.data.success) {
this.goodsList.push(...goodsList.data.result.content);

View File

@ -124,6 +124,7 @@ import {
helpBargain,
} from "@/api/promotions";
import shares from "@/components/m-share/index";
import config from "@/config/config";
export default {
components: {
shares,
@ -178,7 +179,7 @@ export default {
return {
path: this.share(),
title: `请快来帮我砍一刀${this.bargainDetail.goodsName}`,
imageUrl: this.thumbnail || require("@/static/logo.png"),
imageUrl: this.thumbnail || config.logo,
};
},
// #endif

View File

@ -13,17 +13,17 @@
<view class="scroll-con">
<view v-if="nomsg"></view>
<view v-else class="con" v-for="(item,index) in goodsList" :key="index" @click="goDetail(item)">
<image :src="item.thumbnail" mode=""></image>
<view class="nowrap">{{item.name}}</view>
<image :src="item.content.thumbnail" mode=""></image>
<view class="nowrap">{{item.content.name}}</view>
<view>
<text>{{item.price | unitPrice}}
<text>{{item.content.price | unitPrice}}
<!-- <text v-if="item.point">+{{item.point || 0}}</text> -->
</text>
<text>{{item.mktprice}}</text>
<text>{{item.content.mktprice}}</text>
</view>
<view>
<text>已售{{item.buy_count}}</text>
<text>{{item.grade}}%好评</text>
<text>已售{{item.content.buy_count}}</text>
<text>{{item.content.grade}}%好评</text>
</view>
</view>
</view>
@ -74,7 +74,7 @@
},
goDetail(item) {
uni.navigateTo({
url: '/pages/product/goods?id=' + item.id + "&goodsId=" +item.goodsId
url: '/pages/product/goods?id=' + item.content.id + "&goodsId=" +item.content.goodsId
})
},
loadData() {