Commit d69e5f3a authored by 贾慧斌's avatar 贾慧斌

fix: uniapp 转换脚本开发

parent a8684eeb
...@@ -21,3 +21,4 @@ yarn-error.log* ...@@ -21,3 +21,4 @@ yarn-error.log*
*.njsproj *.njsproj
*.sln *.sln
*.sw* *.sw*
/source
<template>
<div id="app" ref="rootApp">
<cr-nav-bar v-if="header" :title="title" left-text="" @click-left="backFun" />
<div class="app">
<keep-alive :max="15" :include="keepAliveMap">
<router-view />
</keep-alive>
</div>
<cr-tabbar
v-if="tabBar"
v-model="router"
inactive-color="#000"
class="tab-bar"
@change="handleTabBar"
>
<cr-tabbar-item :icon="homeIcon">精选</cr-tabbar-item>
<cr-tabbar-item :icon="memberIcon">会员</cr-tabbar-item>
<cr-tabbar-item :badge="cartCount || undefined" :icon="cartIcon">购物车</cr-tabbar-item>
<cr-tabbar-item :icon="userIcon">我的</cr-tabbar-item>
</cr-tabbar>
<div v-if="loading" class="loading-container">
<cr-loading class="loading" size="24px">加载中...</cr-loading>
</div>
<net-error />
<LoginAuthorize />
</div>
</template>
<script> <script>
import { mapGetters } from 'vuex'; /**
import NetError from '@/components/NetError'; * vuex管理登陆状态,具体可以参考官方登陆模板示例
import LoginAuthorize from '@/components/loginAuthorize/index.vue'; */
import localStorage from '@/service/localStorage.service'; import { mapMutations, mapActions } from "vuex";
import TMDConfig from '@/customize/tmd-config'; import request from "./utils/request";
import { import SMSdk from "./utils/shumei";
mapGetters as ShopCartMapGetters, import { onLaunchSubmit } from "@/utils/subscribe";
mapActions as ShopCartMapActions import cfg from "@/config/index";
} from '@/views/shopCart/shopCartModules.js'; import appIdMap from "@/config/appId.config";
import config from "@/config/config.json";
const homeSelected = 'https://img.lkbang.net/home-cur.47903e4ae9d08c4e.47903e4a.png'; import { saTrackEvent } from "@/utils/sa.js";
const homeIcon = 'https://img.lkbang.net/home.7d4f65b0d01fba.7d4f65b0.png'; import { param2Obj } from "@/utils/index";
const cartSelected = 'https://img.lkbang.net/cart-cur.08b92b167a8592.08b92b16.png'; import { uploadSMDeviceID } from "@/api/home.api";
const cartIcon = 'https://img.lkbang.net/cart.4040b7d6f3c3a5a.4040b7d6.png';
const userSelected = 'https://img.lkbang.net/user-cur.e46c0ec5a4b27d16a.e46c0ec5.png';
const userIcon = 'https://img.lkbang.net/user.27bd25d441abd27.27bd25d4.png';
const memberIconSelected = 'https://img.lkbang.net/member_incon_selected.a48af1f5.png';
const memberIcon = 'https://img.lkbang.net/member_icon.b566de02.png';
export default { export default {
name: 'App', globalData: {
components: { ...config
NetError,
LoginAuthorize
},
data() {
return {
router: 0,
configTmd: ''
};
}, },
computed: { methods: {
...ShopCartMapGetters(['cartCount']), ...mapMutations(["login"]),
...mapGetters(['title', 'header', 'loading', 'tabBar', 'routeIdx', 'keepAliveMap']), ...mapActions({
homeIcon() { setGDTVID: "setGDTVID"
return this.routeIdx === 0 ? homeSelected : homeIcon; })
},
memberIcon() {
return this.routeIdx === 1 ? memberIconSelected : memberIcon;
},
cartIcon() {
return this.routeIdx === 2 ? cartSelected : cartIcon;
},
userIcon() {
return this.routeIdx === 3 ? userSelected : userIcon;
}
}, },
watch: { SMSdk,
header: { onLaunch: async function() {
immediate: true, let appId;
handler(val, oldVal) { const smDeviceId = await SMSdk.SMSdk.getDeviceId();
if (val !== oldVal) { console.log("smDeviceId = ", smDeviceId);
document.body.className = val ? 'has-header' : ''; uni.setStorageSync("smDeviceId", smDeviceId || "");
} if (smDeviceId) {
} const [shumeiKey] = await uploadSMDeviceID({
}, shumeiDeviceId: smDeviceId
routeIdx: { });
immediate: true, console.log("shumeiKey after kdsp redis = ", shumeiKey);
handler(val) { if (shumeiKey) {
console.log('val====', val); uni.setStorageSync("shumeiKey", shumeiKey);
this.router = val;
} }
}, }
tabBar: { // #ifdef MP-ALIPAY
immediate: true, appId = uni.getAppIdSync().appId;
handler(val, oldVal) { // #endif
if (val !== oldVal) {
document.body.className = val ? 'has-tab-bar' : ''; // #ifndef MP-ALIPAY
const accountInfo = uni.getAccountInfoSync();
appId = accountInfo.miniProgram.appId;
// #endif
const tenantBasicInfo = appIdMap[appId] || {};
uni.setStorageSync("appId", appId);
uni.setStorageSync("tenantId", tenantBasicInfo.tenantId || 560761);
uni.setStorageSync("tenantBasicInfo", tenantBasicInfo);
tenantBasicInfo.vccChannel && uni.setStorageSync("vccChannel", tenantBasicInfo.vccChannel);
this.$ry?.init(cfg.REYUN_APP_KEY);
// todo
if (appId === "wxe16bf9293671506c" && process.env.NODE_ENV === "production") {
//wxe16bf9293671506c 测试环境appid
let [data] = await request.get("https://talos.xyqb.com/api/kdsp/miniapp/getData");
uni.setStorageSync("url", data);
} else {
uni.removeStorageSync("url");
}
let userInfo = uni.getStorageSync("userInfo") || "";
if (userInfo?.id) {
//更新登陆状态
uni.getStorage({
key: "userInfo",
success: res => {
this.login(res.data);
} }
} });
} }
// #ifdef MP-WEIXIN
onLaunchSubmit();
// #endif
}, },
created() { onShow: function(option) {
const config = new TMDConfig(); // #ifdef MP-WEIXIN
this.configTmd = config; // 存储腾讯广告id
}, const { query } = option;
async mounted() { if (query && query.gdt_vid) {
if (localStorage.get('vccToken') && location.pathname !== '/login') { // store存储gdt_vid以便后续登录拿到openid后使用
this.queryCartCount(); this.setGDTVID(query.gdt_vid);
} }
if (localStorage.get('vccChannel') == 161085) { //新版本更新
this.$nextTick(() => { if (uni.canIUse("getUpdateManager")) {
// document.getElementById('#app').innerHTML = ''; //判断当前微信版本是否支持版本更新
this.$refs.rootApp.innerHTML = const updateManager = uni.getUpdateManager();
'<div class="cr-image" style="width: 100%; height: 100%;"><img src="https://img.lkbang.net/error.19ace11d.png" style="display: block; margin: 0 auto; width: 80%; height: auto; margin-top: 20px;" class="cr-image--img" ></div>'; updateManager.onCheckForUpdate(function(res) {
if (res.hasUpdate) {
// 请求完新版本信息的回调
updateManager.onUpdateReady(function() {
uni.showModal({
title: "更新提示",
content: "新版本已经准备好,是否重启应用?",
success: function(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
}
});
});
updateManager.onUpdateFailed(function() {
uni.showModal({
// 新的版本下载失败
title: "已经有新版本了哟~",
content: "新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~"
});
});
}
});
} else {
uni.showModal({
// 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
title: "提示",
content: "当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。"
}); });
} }
}, // #endif
methods: { uni.onAppShow(obj => {
...ShopCartMapActions(['queryCartCount']), const TPL_TITLE = "tplTitle";
backFun() { const tplTitle = param2Obj(obj.path)[TPL_TITLE] || obj.query[TPL_TITLE];
this.$router.go(-1); if ((obj.scene === 1014 || obj.scene === 1107) && tplTitle) {
}, saTrackEvent("MINI_SubscribeMessageCardBtnClick", {
handleTabBar(idx) { cards_name: tplTitle
console.log('idx', idx); });
const channelId = localStorage.get('vccChannel');
// console.log(location.href,"location.href",location.origin)
switch (idx) {
case 0:
this.$router.replace({ name: 'Home' });
break;
case 1:
this.$router.replace({ name: 'Member' });
// window.location.href = 'https://www.baidu.com';
break;
case 2:
if (channelId == this.configTmd.channelId.id && localStorage.get('vccPhone')) {
// console.log('jinlaile');
// 第三方进来
localStorage.get('vccToken')
? this.$router.replace({ name: 'Cart' })
: this.$router.replace({ name: 'LoginMiddle', query: { backUrl: location.href } });
} else {
// 之前逻辑
localStorage.get('vccToken')
? this.$router.replace({ name: 'Cart' })
: this.$router.replace({ name: 'Login', query: { backUrl: location.href } });
}
break;
case 3:
if (channelId == this.configTmd.channelId.id && localStorage.get('vccPhone')) {
// 第三方进来
localStorage.get('vccToken')
? this.$router.replace({ name: 'User' })
: this.$router.replace({ name: 'LoginMiddle', query: { backUrl: location.href } });
} else {
// 之前逻辑
this.$router.replace({ name: 'User' });
}
break;
} }
} });
},
onHide: function() {
console.log("App Hide");
} }
}; };
</script> </script>
<style lang="less">
@import './style/index'; <style lang="scss">
.app { @import "@/style/icon.scss";
user-select: none; @import "@/style/uni-ui.scss";
page {
background: $page-color-base;
height: 100%; height: 100%;
min-height: 100%;
position: relative; /* #ifdef MP-ALIPAY */
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); /* width: 100%;
}
.loading-container {
position: fixed; position: fixed;
left: 0;
right: 0;
top: 0; top: 0;
bottom: 0; bottom: 0; */
z-index: 999; /* #endif */
display: flex;
justify-content: center;
align-items: center;
.loading {
padding: 6px;
border-radius: 6px;
background-color: rgba(0, 0, 0, 0.5);
color: #fff;
@{deep} .cr-loading--text {
color: #fff;
}
}
} }
.tab-bar {
position: relative; view,
padding-top: 10px !important; scroll-view,
swiper,
swiper-item,
cover-view,
cover-image,
icon,
text,
rich-text,
progress,
button,
checkbox,
form,
input,
label,
radio,
slider,
switch,
textarea,
navigator,
audio,
camera,
image,
video {
box-sizing: border-box; box-sizing: border-box;
z-index: 11; }
height: calc(@tab-bar-height + constant(safe-area-inset-bottom)); /* 骨架屏替代方案 */
height: calc(@tab-bar-height + env(safe-area-inset-bottom)); .Skeleton {
align-items: flex-start !important; background: #f3f3f3;
.cr-icon { padding: 20rpx 0;
display: block; border-radius: 8rpx;
height: 24px; }
}
.cr-info--badge { /* 图片载入替代方案 */
padding: 0 4px; .image-wrapper {
} font-size: 0;
&:before { background: #f3f3f3;
content: ''; border-radius: 4px;
position: absolute;
left: 0; image {
top: 0;
width: 100%; width: 100%;
height: 1px; height: 100%;
-webkit-transform: scaleY(0.5); transition: 0.6s;
transform: scaleY(0.5); opacity: 0;
background-color: rgba(0, 0, 0, 0.33);
&.loaded {
opacity: 1;
}
}
}
.clamp {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: block;
}
.common-hover {
background: #f5f5f5;
}
/*边框*/
.b-b:after,
.b-t:after {
position: absolute;
z-index: 3;
left: 0;
right: 0;
height: 0;
content: "";
transform: scaleY(0.5);
border-bottom: 1px solid $border-color-base;
}
.b-b:after {
bottom: 0;
}
.b-t:after {
top: 0;
}
/* button样式改写 */
uni-button,
button {
height: 80rpx;
line-height: 80rpx;
font-size: $font-lg + 2rpx;
font-weight: normal;
&.no-border:before,
&.no-border:after {
border: 0;
} }
} }
uni-button[type="default"],
button[type="default"] {
color: $font-color-dark;
}
/* input 样式 */
.placeholder {
font-size: 28rpx;
line-height: 40rpx;
color: #999999;
}
button::after {
display: none;
}
/* requestRevokeTest test */
</style> </style>
...@@ -19,7 +19,7 @@ export const actAndCpn = data => { ...@@ -19,7 +19,7 @@ export const actAndCpn = data => {
return http.post(`${yxmGwHost}/api/kdsp/sku-info/detail/actAndCpn`, data); return http.post(`${yxmGwHost}/api/kdsp/sku-info/detail/actAndCpn`, data);
}; };
// 详情图片, 通过 // 详情图片
export const getDetailPic = url => { export const getDetailPic = url => {
return http.get(url, { strategy: 'default', hideLoading: 1, skip: 1, hideToast: 1 }); return http.get(url, { strategy: 'default', hideLoading: 1, skip: 1, hideToast: 1 });
}; };
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<div v-if="headerType === 'center'" class="Hl-header-center">{{ title }}</div> <div v-if="headerType === 'center'" class="Hl-header-center">{{ title }}</div>
<cr-image <cr-image
v-if="headerType === 'image'" v-if="headerType === 'image'"
src="https://img.lkbang.net/icon-recommend.465d832f185840eaa.465d832f.png" :src="'https://img.lkbang.net/icon-recommend.465d832f185840eaa.465d832f.png' | imogr"
width="4.53rem" width="4.53rem"
height="0.96rem" height="0.96rem"
class="Hl-header-image" class="Hl-header-image"
...@@ -23,9 +23,8 @@ ...@@ -23,9 +23,8 @@
> >
<div class="Hl-container-item-img"> <div class="Hl-container-item-img">
<cr-image <cr-image
v-imogr
class="Hlc-item-img" class="Hlc-item-img"
:src="item.goods.goodsImage | Img2Thumb" :src="item.goods.goodsOrgImage | imogr({ w: 173, h: 173 })"
lazy-load lazy-load
fit="contain" fit="contain"
/> />
...@@ -53,7 +52,7 @@ ...@@ -53,7 +52,7 @@
}" }"
{{ item.goods.discountShow.discountPrice }}</span {{ item.goods.discountShow.discountPrice }}</span
> >
<img :src="item.goods.discountShow.icon" /> <img :src="item.goods.discountShow.icon | imogr" />
</div> </div>
</div> </div>
<!-- 加入购物车 --> <!-- 加入购物车 -->
...@@ -348,9 +347,9 @@ export default { ...@@ -348,9 +347,9 @@ export default {
border: 1px solid @border-red; border: 1px solid @border-red;
font-size: 10px; font-size: 10px;
color: @red; color: @red;
border-radius: 5px; border-radius: 3px;
padding: 2px 5px; padding: 2px 5px;
margin: 2px 2px 2px 0; margin-right: 3px;
} }
} }
} }
......
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
> >
<img :src="item.goods.discountShow.icon" /> <img :src="item.goods.discountShow.icon" />
</div> </div>
<!-- <span v-if="item.goods.goodsPrice">¥{{ item.goods.goodsPrice }}</span> -->
</div> </div>
<div class="goods-item-info-count-left-bottom"> <div class="goods-item-info-count-left-bottom">
<span>已售{{ item.goods.saleCount }}</span> <span>已售{{ item.goods.saleCount }}</span>
...@@ -229,7 +228,7 @@ export default { ...@@ -229,7 +228,7 @@ export default {
} }
} }
&-info { &-info {
height: 100%; min-height: 116px;
padding: 0 5px 5px; padding: 0 5px 5px;
box-sizing: border-box; box-sizing: border-box;
width: calc(100% - 110px); width: calc(100% - 110px);
...@@ -271,7 +270,7 @@ export default { ...@@ -271,7 +270,7 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
border: 1px solid @border-red; border: 1px solid @border-red;
font-size: 8px; font-size: 12px;
color: @red; color: @red;
border-radius: 3px; border-radius: 3px;
padding: 1px 3px; padding: 1px 3px;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
closeable closeable
position="bottom" position="bottom"
> >
<img v-imogr src="https://img.lkbang.net/tenant/yxm-logo.5h67.png" alt="" class="img" /> <img :src="'https://img.lkbang.net/tenant/yxm-logo.5h67.png' | imogr" alt="" class="img" />
<p class="yxm">羊小咩</p> <p class="yxm">羊小咩</p>
<div class="checkbox-content"> <div class="checkbox-content">
<cr-checkbox v-model="checked" icon-size="14px" shape="round" class="agreement"> <cr-checkbox v-model="checked" icon-size="14px" shape="round" class="agreement">
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Description: * @Description:
* @Date: 2021-03-31 19:59:12 * @Date: 2021-03-31 19:59:12
* @LastEditors: gzw * @LastEditors: gzw
* @LastEditTime: 2023-05-06 20:05:02 * @LastEditTime: 2023-05-09 11:33:27
*/ */
const envName = 'yxm'; const envName = 'yxm';
const protocol = window.location.protocol; const protocol = window.location.protocol;
...@@ -15,7 +15,7 @@ const kdspHost = `https://kdsp-api-${envName}.liangkebang.net`; ...@@ -15,7 +15,7 @@ const kdspHost = `https://kdsp-api-${envName}.liangkebang.net`;
const kdspOpHost = `https://kdsp-operation-${envName}.liangkebang.net`; const kdspOpHost = `https://kdsp-operation-${envName}.liangkebang.net`;
const VCC_CHANNEL = ''; const VCC_CHANNEL = '';
const TERMINAL = 'H5'; const TERMINAL = 'H5';
const VERSION = '8.9.40'; const VERSION = '8.9.80';
const SOBOT_URL = const SOBOT_URL =
'https://kdspstatic.91xr.cn/kdsp/mine/service/customer-service/customer-service-prod.html'; 'https://kdspstatic.91xr.cn/kdsp/mine/service/customer-service/customer-service-prod.html';
const nectarHost = `https://nectar-${envName}.liangkebang.net/`; const nectarHost = `https://nectar-${envName}.liangkebang.net/`;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Description: 根据图片来源匹配压缩 * @Description: 根据图片来源匹配压缩
* @Date: 2021-04-26 17:47:15 * @Date: 2021-04-26 17:47:15
* @LastEditors: gzw * @LastEditors: gzw
* @LastEditTime: 2023-05-06 17:59:13 * @LastEditTime: 2023-05-08 19:54:55
*/ */
import localStorage from '@/service/localStorage.service'; import localStorage from '@/service/localStorage.service';
const CAN_USE_WEBP = 'checkWebp'; const CAN_USE_WEBP = 'checkWebp';
......
// 3 main.js导入router.js并挂载 import Vue from 'vue';
import {router,RouterMount} from './router/index'; import { init as sentryInit } from '@sentry/vue';
import App from './App.vue';
import router from './router';
import store from './store';
import Bridge from '@qg/js-bridge';
// import '@/service/svg.service';
import { shuMeiInit, getSmDeviceId } from '@/service/shumei.service';
import '@/service/cherryUI.service';
import './style/index.less';
import '@/assets/svg/index';
import './style/operator.less';
import saService from '@/service/sa.service';
import lazyload from '@qg/cherry-ui/src/lazyload/index';
import { getToKen } from '@/service/userInfo.service';
import { imgMogrVue, checkWebp } from '@/filters/img2Thumb.filter';
import { replaceFavicon } from '@/service/utils.service';
import { getPublicConfig } from '@/customize';
const publicConfig = getPublicConfig();
// #ifdef H5 Vue.prototype.$track = saService;
RouterMount(app,router,'#app') Vue.prototype.$config = publicConfig;
// #endif Vue.prototype.$bridge = new Bridge();
Vue.use(lazyload);
Vue.use(imgMogrVue);
// #ifndef H5 getToKen();
app.$mount(); //为了兼容小程序及app端必须这样写才有效果
// #endif Vue.config.productionTip = false;
\ No newline at end of file
replaceFavicon(publicConfig.faviconPath);
// eslint-disable-next-line prettier/prettier
(async () => {
await checkWebp();
shuMeiInit();
getSmDeviceId();
// console.log(getSmDeviceId);
})();
if (process.env.SENTRY_ENV !== 'test' && process.env.NODE_ENV === 'production') {
sentryInit({
Vue,
attachProps: true, // 允许Sentry上报Vue组件Props
logErrors: true, // 引入Sentry SDK后,默认不会将报错打印到控制台,将logErrors设为true强制将报错打印到控制台
dsn: 'https://0810381ba85d4b2788ddafa29078851c@sentry.q-gp.com/4',
release: 'bmall-ui@1.0.0',
tracesSampleRate: 0.5, // 上报频率, 1最大, 0最小, 建议验证设置为1, 项目运行根据情况降低频率
environment: process.env.NODE_ENV
});
}
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app');
...@@ -52,8 +52,9 @@ export default { ...@@ -52,8 +52,9 @@ export default {
openNewUrl(data) { openNewUrl(data) {
locationHrefPatch(data.newUrl, this.$router); locationHrefPatch(data.newUrl, this.$router);
}, },
shopCarAddGoodsNotification() { shopCarAddGoodsNotification(data) {
this.queryCartCount(); // this.queryCartCount();
this.$store.dispatch('shopCart/saveCartCount', data.count);
}, },
getShuMeiId() {} getShuMeiId() {}
} }
......
{ {
"pages": [
{
"path": "pages/home",
"style": {
"navigationBarTitleText": "",
"mp-alipay": {
"allowsBounceVertical": "NO"
}
}
}
],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "", "navigationBarTitleText": "",
......
...@@ -45,8 +45,7 @@ ...@@ -45,8 +45,7 @@
@click="handleToDetailsTrack(item, 'CategoryBrandClick', i)" @click="handleToDetailsTrack(item, 'CategoryBrandClick', i)"
> >
<cr-image <cr-image
v-imogr="{ w: 48, h: 48 }" :src="item.img | imogr({ w: 48, h: 48 })"
:src="item.img | Img2Thumb"
fit="contain" fit="contain"
class="category-box--brands--item__img" class="category-box--brands--item__img"
/> />
......
...@@ -51,7 +51,8 @@ ...@@ -51,7 +51,8 @@
</cr-swipe-item> </cr-swipe-item>
</cr-swipe> </cr-swipe>
<LoginPopup /> <LoginPopup />
<loginGuide v-if="!userInfo.phoneNumber" />
<loginGuide v-if="!hasLogin" />
<transition name="fade"> <transition name="fade">
<Skeleton v-if="skeletonStatus" /> <Skeleton v-if="skeletonStatus" />
</transition> </transition>
...@@ -67,6 +68,7 @@ import historyRecordMixins from '@/mixins/historyRecord.mixins'; ...@@ -67,6 +68,7 @@ import historyRecordMixins from '@/mixins/historyRecord.mixins';
import mxBll from './mixin/mxBll'; import mxBll from './mixin/mxBll';
import { Img2Thumb } from '@/filters/img2Thumb.filter'; import { Img2Thumb } from '@/filters/img2Thumb.filter';
import Skeleton from './components/Skeleton.vue'; import Skeleton from './components/Skeleton.vue';
import { mapGetters as homeMapGetters } from 'vuex';
export default { export default {
name: 'Home', name: 'Home',
...@@ -94,6 +96,7 @@ export default { ...@@ -94,6 +96,7 @@ export default {
}; };
}, },
computed: { computed: {
...homeMapGetters(['hasLogin']),
specialCol() { specialCol() {
return this.$refs.specialCol; return this.$refs.specialCol;
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="container"> <div class="container">
<div class="loginContent"> <div class="loginContent">
<div class="login-title" /> <div class="login-title" />
<img v-imogr src="https://img.lkbang.net/tenant/yxm-logo.5h67.png" alt="" class="img" /> <img :src="'https://img.lkbang.net/tenant/yxm-logo.5h67.png' | imogr" alt="" class="img" />
<p class="yxm">羊小咩</p> <p class="yxm">羊小咩</p>
<p class="life">美好生活更从容</p> <p class="life">美好生活更从容</p>
<div class="login"> <div class="login">
......
...@@ -67,28 +67,7 @@ export default { ...@@ -67,28 +67,7 @@ export default {
return { return {
show: false, show: false,
reasonType: '', reasonType: '',
reasonList: [ reasonList: [],
// {
// cancelReasonType: 1,
// cancelReason: '收货地址填错了'
// },
// {
// cancelReasonType: 2,
// cancelReason: '忘记支付密码/余额不足'
// },
// {
// cancelReasonType: 3,
// cancelReason: '无法正常支付'
// },
// {
// cancelReasonType: 4,
// cancelReason: '不想买了'
// },
// {
// cancelReasonType: 5,
// cancelReason: '其他原因'
// }
],
iconAndTips: { iconAndTips: {
imageUrl: refundImageUrl, imageUrl: refundImageUrl,
amount: 222, amount: 222,
...@@ -115,9 +94,6 @@ export default { ...@@ -115,9 +94,6 @@ export default {
this.$emit(EVENT_INPUT, val); this.$emit(EVENT_INPUT, val);
} }
}, },
mounted() {
// this.getReasonList();
},
methods: { methods: {
handleConfirm() { handleConfirm() {
this.$emit(EVENT_INPUT, false); this.$emit(EVENT_INPUT, false);
...@@ -153,20 +129,8 @@ export default { ...@@ -153,20 +129,8 @@ export default {
agreeContract: true agreeContract: true
}); });
if (res) { if (res) {
// if (this.orderInfo.skuList[0].skuSource === 2) {
// this.$router.push({
// path: '/refundKepler',
// query: { orderNo: this.orderInfo.orderNo, refundAmount: this.orderInfo.totalFee }
// });
// } else {
// this.$toast('已取消');
// }
this.isSuccess = true; this.isSuccess = true;
this.iconAndTips = res.iconAndTips; this.iconAndTips = res.iconAndTips;
// this.$toast('已取消');
// this.$emit(EVENT_INPUT, false);
// this.$emit(EVENT_COMPLETE);
// this.$emit('refresh');
} }
}, },
// 未付款 用户订单取消接口【未付款】 // 未付款 用户订单取消接口【未付款】
...@@ -268,12 +232,12 @@ export default { ...@@ -268,12 +232,12 @@ export default {
} }
.yuan_detail { .yuan_detail {
font-size: 16px; font-size: 16px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500; font-weight: 500;
color: #323233; color: #323233;
line-height: 20px; line-height: 24px;
margin-top: 12px; margin-top: 12px;
white-space: pre-line; white-space: pre-line;
margin-bottom: 24px;
} }
.Cp__button { .Cp__button {
......
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
" "
> >
<cr-image <cr-image
v-imogr :src="it.imageUrl | replaceUrl | imogr({ w: 85, h: 85 })"
:src="it.imageUrl | replaceUrl"
width="2.266667rem" width="2.266667rem"
height="2.266667rem" height="2.266667rem"
class="Ol__body-img" class="Ol__body-img"
......
<template> <template>
<div v-if="item.skuId" class="confirm-goods" :class="className"> <div v-if="item.skuId" class="confirm-goods" :class="className">
<cr-image <cr-image
v-imogr="{ w: 85, h: 85 }"
class="confirm-goods__left" class="confirm-goods__left"
:src="item.skuImg | imogr({ w: 85, h: 85 })" :src="item.skuImg | imogr({ w: 85, h: 85 })"
width="85px" width="85px"
...@@ -23,8 +22,8 @@ ...@@ -23,8 +22,8 @@
</div> </div>
<div class="Cg-middle__stepper"> <div class="Cg-middle__stepper">
<div v-if="item.activityCanBuyCount || item.commonLimitCount" class="Cg-middle__warn"> <div v-if="item.activityCanBuyCount || item.commonLimitCount" class="Cg-middle__warn">
<img v-if="item.newComersLabel" :src="item.newComersLabel.icon" /> <img v-if="item.newComersLabel" :src="item.newComersLabel.icon | imogr" />
<img v-if="showActivityIcon" :src="showActivityIcon" /> <img v-if="showActivityIcon" :src="showActivityIcon | imogr" />
<span>限购{{ item.activityCanBuyCount || item.commonLimitCount }}件</span> <span>限购{{ item.activityCanBuyCount || item.commonLimitCount }}件</span>
</div> </div>
......
...@@ -28,11 +28,10 @@ ...@@ -28,11 +28,10 @@
> >
<template #thumb> <template #thumb>
<cr-image <cr-image
v-imogr="{ w: 30, h: 30 }"
round round
height="0.8rem" height="0.8rem"
width="0.8rem" width="0.8rem"
:src="`${item.userImageUrl}`" :src="item.userImageUrl | imogr({ w: 30, h: 30 })"
alt="" alt=""
class="user-info__thumb" class="user-info__thumb"
/> />
...@@ -87,8 +86,7 @@ ...@@ -87,8 +86,7 @@
{{ item.images.length }}<cr-icon type="arrow" size="15px" /> {{ item.images.length }}<cr-icon type="arrow" size="15px" />
</span> </span>
<img <img
v-imogr="{ w: 105, h: 105 }" :src="changeUrl(img) | imogr({ w: 105, h: 105 })"
:src="changeUrl(img)"
width="100%" width="100%"
height="100%" height="100%"
/> />
...@@ -175,7 +173,6 @@ export default { ...@@ -175,7 +173,6 @@ export default {
this.pageNo = 1; this.pageNo = 1;
this.finished = false; this.finished = false;
this.orderList = []; this.orderList = [];
this.getOrderInfo(true);
}, },
beforeRead(index, file) { beforeRead(index, file) {
this.orderList[index].resourceList.push(file); this.orderList[index].resourceList.push(file);
......
...@@ -20,16 +20,16 @@ ...@@ -20,16 +20,16 @@
</span> </span>
<cr-image <cr-image
v-if="activityInfo.priceIcon" v-if="activityInfo.priceIcon"
v-imogr :src="activityInfo.priceIcon | imogr"
:src="activityInfo.priceIcon" height="14px"
height="0.373rem" :width="calImgSizeByRatio(14, activityInfo.priceIconRate) + 'px'"
width="auto" fit="contain"
/> />
<cr-icon <cr-icon
v-if="activityInfo.priceIcon && activityInfo.actDesc" v-if="activityInfo.priceIcon && activityInfo.actDesc"
type="info-o" type="info-o"
size="0.426rem" size="0.426rem"
color="#999" color="rgba(255,255,255,0.65)"
@click="showPopup" @click="showPopup"
/> />
</div> </div>
...@@ -40,12 +40,17 @@ ...@@ -40,12 +40,17 @@
<div v-else class="priceInfo__activity"> <div v-else class="priceInfo__activity">
<div class="priceInfo__activity__icon"> <div class="priceInfo__activity__icon">
<cr-image <cr-image
v-imogr :src="activityInfo.actIcon | imogr"
:src="activityInfo.actIcon" :height="activityIconSize.height"
:height="activityInfo.activityType === 9 ? '0.96rem' : '0.5867rem'" :width="activityIconSize.width"
width="auto" fit="contain"
/>
<cr-icon
v-if="activityInfo.actDesc"
type="info-o"
color="rgba(255,255,255,0.65)"
@click="showPopup"
/> />
<cr-icon v-if="activityInfo.actDesc" type="info-o" color="#999" @click="showPopup" />
</div> </div>
<div v-if="showCountDown" class="priceInfo__activity__info counter"> <div v-if="showCountDown" class="priceInfo__activity__info counter">
<svg-icon icon-class="shijian" /> <svg-icon icon-class="shijian" />
...@@ -86,10 +91,17 @@ export default { ...@@ -86,10 +91,17 @@ export default {
} }
return style; return style;
}, },
activityIconSize() {
const h = this.activityInfo.activityType === 9 ? '36' : '22';
return {
height: `${h}px`,
width: `${this.calImgSizeByRatio(h, this.activityInfo.actIconRate)}px`
};
},
showCountDown() { showCountDown() {
return ( return (
this.activityInfo.activityType === 11 && this.activityInfo.activityTimeInfo.endTime - this.activityInfo.activityTimeInfo.startTime <
this.activityInfo.activityTimeInfo.endTime < 86400000 86400000
); );
}, },
countTime() { countTime() {
...@@ -118,6 +130,13 @@ export default { ...@@ -118,6 +130,13 @@ export default {
...mapActions(['setPopupState']), ...mapActions(['setPopupState']),
showPopup() { showPopup() {
this.setPopupState({ type: 'rule', title: '活动规则' }); this.setPopupState({ type: 'rule', title: '活动规则' });
},
calImgSizeByRatio(size, aspectRatio, calH) {
if (calH) {
return size / aspectRatio;
} else {
return size * aspectRatio;
}
} }
} }
}; };
...@@ -178,7 +197,7 @@ export default { ...@@ -178,7 +197,7 @@ export default {
} }
&__discountPrice { &__discountPrice {
display: flex; display: flex;
align-items: baseline; align-items: center;
span { span {
color: #ed7d08; color: #ed7d08;
font-weight: 500; font-weight: 500;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@click="toDetail(item.goods, index)" @click="toDetail(item.goods, index)"
> >
<div class="Hl-container-item-img"> <div class="Hl-container-item-img">
<cr-image v-imogr class="Hlc-item-img" :src="item.goods.goodsImage" /> <cr-image class="Hlc-item-img" :src="item.goods.goodsImage | imogr({ w: 173, h: 173 })" />
</div> </div>
<div class="Hlc-item-title"> <div class="Hlc-item-title">
<span>{{ item.goods.goodsName }}</span> <span>{{ item.goods.goodsName }}</span>
......
...@@ -19,8 +19,7 @@ ...@@ -19,8 +19,7 @@
> >
<div class="comment__user"> <div class="comment__user">
<cr-image <cr-image
v-imogr :src="item.userImageUrl | imogr"
:src="item.userImageUrl"
round round
width="0.8rem" width="0.8rem"
height="0.8rem" height="0.8rem"
...@@ -36,10 +35,9 @@ ...@@ -36,10 +35,9 @@
<cr-image <cr-image
v-for="(it, k) in item.images" v-for="(it, k) in item.images"
:key="k" :key="k"
v-imogr="{ w: 80, h: 80 }"
width="2.13rem" width="2.13rem"
height="2.13rem" height="2.13rem"
:src="it" :src="it | imogr({ w: 80, h: 80 })"
/> />
</div> </div>
</div> </div>
......
...@@ -41,11 +41,10 @@ ...@@ -41,11 +41,10 @@
</cr-popup> </cr-popup>
<cr-image <cr-image
v-if="selectedSku.imageUrl" v-if="selectedSku.imageUrl"
v-imogr="{ w: 150, h: 150 }"
class="add-cart-img" class="add-cart-img"
:class="{ animate: startAnimate }" :class="{ animate: startAnimate }"
round round
:src="selectedSku.imageUrl" :src="selectedSku.imageUrl | imogr({ w: 150, h: 150 })"
width="4rem" width="4rem"
height="4rem" height="4rem"
/> />
......
...@@ -4,12 +4,11 @@ ...@@ -4,12 +4,11 @@
<cr-image <cr-image
v-for="(item, index) in detailImgList" v-for="(item, index) in detailImgList"
:key="index" :key="index"
v-imogr="{ w: 396 }"
lazy-load lazy-load
class="good__detailImg__img" class="good__detailImg__img"
width="100%" width="100%"
height="auto" height="auto"
:src="item | imageMogr4Operation" :src="item | imogr({ w: 375 })"
/> />
</div> </div>
</template> </template>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</div> </div>
<div class="discountBar__right"> <div class="discountBar__right">
<span>{{ discountBarInfo.rightTitle }}</span> <span>{{ discountBarInfo.rightTitle }}</span>
<cr-icon type="arrow" color="#fff" size="0.213rem" /> <svg-icon icon-class="arrow-linear-gradient" />
</div> </div>
</div> </div>
</template> </template>
...@@ -80,20 +80,18 @@ export default { ...@@ -80,20 +80,18 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
background: linear-gradient(270deg, fade(#ff5d00, 10%) 0%, fade(#ff1900, 10%) 100%); background: linear-gradient(270deg, fade(#ff5d00, 10%) 0%, fade(#ff1900, 10%) 100%);
.text-size(12px); padding: 4px 3px 3px;
padding: 1px @padding-unit;
border-radius: @border-radius-max; border-radius: @border-radius-max;
color: @red; color: @red;
.cr-icon { span {
border-radius: @border-radius-max; font-size: 12px;
background: linear-gradient(270deg, #ff5d00 0%, #ff1900 100%); font-weight: 500;
}
.svg-icon {
font-size: 12px;
margin-left: 2px; margin-left: 2px;
text-align: center; margin-top: -1px;
font-size: 8px !important; transform: scale(0.8);
width: 20px !important;
height: 20px !important;
line-height: 20px;
transform: scale(0.7);
} }
} }
} }
......
...@@ -17,18 +17,19 @@ ...@@ -17,18 +17,19 @@
fit="contain" fit="contain"
/> --> /> -->
<cr-swipe v-if="renderSwipe" class="good__swiper" @change="onChange"> <cr-swipe class="good__swiper" @change="onChange">
<cr-swipe-item v-for="(item, index) in swiperImgList" :key="index" class="good__swiper__item"> <cr-swipe-item v-for="(item, index) in swiperImgList" :key="index" class="good__swiper__item">
<cr-image <cr-image
v-imogr="{ w: 375, h: 375 }" :src="item | imogr({ w: 375, h: 375 })"
:src="item"
width="10rem" width="10rem"
height="10rem" height="10rem"
fit="contain" fit="contain"
/> />
</cr-swipe-item> </cr-swipe-item>
<template #indicator> <template #indicator>
<div class="good__swiper__indicator">{{ current }} / {{ swiperImgList.length }}</div> <div v-if="swiperImgList.length > 1" class="good__swiper__indicator">
{{ current }} / {{ swiperImgList.length }}
</div>
</template> </template>
</cr-swipe> </cr-swipe>
</div> </div>
...@@ -40,26 +41,12 @@ export default { ...@@ -40,26 +41,12 @@ export default {
name: 'GoodSwiper', name: 'GoodSwiper',
data() { data() {
return { return {
current: 1, current: 1
renderSwipe: false
}; };
}, },
computed: { computed: {
...mapGetters(['swiperImgList']) ...mapGetters(['swiperImgList'])
}, },
watch: {
swiperImgList: {
handler(val, oldVal) {
if (val[0] !== oldVal[0]) {
const imgFirst = new Image();
imgFirst.src = val[0];
imgFirst.onload = () => {
this.renderSwipe = true;
};
}
}
}
},
methods: { methods: {
onChange(index) { onChange(index) {
this.current = index + 1; this.current = index + 1;
......
<template> <template>
<div class="Hl-container-item"> <div class="Hl-container-item">
<div class="Hlc-item-img"> <div class="Hlc-item-img">
<cr-image v-imogr="{ w: 120, h: 120 }" :src="goods.goodsImage" /> <cr-image :src="goods.goodsImage | imogr({ w: 120, h: 120 })" />
</div> </div>
<div class="Hlc-item-info"> <div class="Hlc-item-info">
<div class="Hlc-item-info-title"> <div class="Hlc-item-info-title">
...@@ -32,7 +32,7 @@ export default { ...@@ -32,7 +32,7 @@ export default {
width: 120px; width: 120px;
height: 120px; height: 120px;
border-radius: 6px; border-radius: 6px;
margin-right: 5px; margin-right: 8px;
opacity: 0.5; opacity: 0.5;
} }
.Hlc-item-info { .Hlc-item-info {
...@@ -63,11 +63,9 @@ export default { ...@@ -63,11 +63,9 @@ export default {
&-bottom { &-bottom {
position: absolute; position: absolute;
bottom: 5px; bottom: 5px;
display: flex;
width: 100%; width: 100%;
&-des { &-des {
.text-size(13); .text-size(13);
width: 90%;
color: @black; color: @black;
// overflow: hidden; // overflow: hidden;
// text-overflow: ellipsis; // text-overflow: ellipsis;
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
<div v-if="maxMemberInfo.title" class="good__maxMemberInfo"> <div v-if="maxMemberInfo.title" class="good__maxMemberInfo">
<div class="maxMemberInfo__container" :style="style"> <div class="maxMemberInfo__container" :style="style">
<cr-image <cr-image
v-imogr="{ h: 16 }" :src="maxMemberInfo.icon | imogr({ h: 16 })"
:src="maxMemberInfo.icon"
width="auto" width="auto"
height="0.426rem" height="0.426rem"
class="maxMemberInfo__icon" class="maxMemberInfo__icon"
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
> >
<div class="popPromotion__head"> <div class="popPromotion__head">
<div class="popPromotion__title">可领优惠券</div> <div class="popPromotion__title">可领优惠券</div>
<div class="popPromotion__right" @click="batchPick">一键领取</div> <div v-if="canBatchPick" class="popPromotion__right" @click="batchPick">一键领取</div>
</div> </div>
<div class="popPromotion__list"> <div class="popPromotion__list">
<coupon-card :coupon-list="activityAndCoupon.coupons" @pickupCoupon="pickup" /> <coupon-card :coupon-list="activityAndCoupon.coupons" @pickupCoupon="pickup" />
...@@ -52,7 +52,10 @@ export default { ...@@ -52,7 +52,10 @@ export default {
userInfo: state => { userInfo: state => {
return (state && state.pay.userInfo) || {}; return (state && state.pay.userInfo) || {};
} }
}) }),
canBatchPick() {
return this.activityAndCoupon.coupons.some(item => !item.pickupAble);
}
}, },
methods: { methods: {
...mapActions(['pickupCoupon']), ...mapActions(['pickupCoupon']),
......
<template> <template>
<div class="goods-popup-selected"> <div class="goods-popup-selected">
<cr-image v-imogr="{ w: 100, h: 100 }" :src="info.imageUrl" width="2.67rem" height="2.67rem" /> <cr-image :src="info.imageUrl | imogr({ w: 100, h: 100 })" width="2.67rem" height="2.67rem" />
<div class="Gp-selected-right"> <div class="Gp-selected-right">
<div class="Gps-right-header"> <div class="Gps-right-header">
<div class="Gpsr-header-price"> <div class="Gpsr-header-price">
......
<template> <template>
<div class="skeleton"> <div class="skeleton">
<cr-image
v-imogr="{ w: 375, h: 375 }"
class="skeleton__img"
:src="query.goodsOrgImage"
width="10rem"
height="10rem"
error-icon="photo-o"
/>
<div class="skeleton__body"> <div class="skeleton__body">
<div class="skeleton__base"> <div class="skeleton__base">
<cr-row> <cr-row>
...@@ -88,12 +80,12 @@ export default { ...@@ -88,12 +80,12 @@ export default {
border-radius: 4px; border-radius: 4px;
} }
.skeleton { .skeleton {
position: absolute; position: relative;
z-index: 999; z-index: 999;
top: 0; // top: 0;
left: 0; // left: 0;
right: 0; // right: 0;
bottom: 0; // bottom: 0;
height: 100%; height: 100%;
width: 100%; width: 100%;
background-color: #f7f8fa; background-color: #f7f8fa;
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
<h4 @touchstart="touchstart" @touchend="touchend"> <h4 @touchstart="touchstart" @touchend="touchend">
<cr-image <cr-image
v-if="title.skuIcon" v-if="title.skuIcon"
v-imogr="{ h: 27 }" :src="title.skuIcon | imogr({ h: 27 })"
:src="title.skuIcon"
width="auto" width="auto"
height="0.426rem" height="0.426rem"
/> />
......
<template> <template>
<div class="good" :class="{ stopScroll: goodsStatus === 0 }"> <div class="good" :class="{ stopScroll: goodsStatus === 0 }">
<template v-if="goodsStatus !== 41"> <template v-if="goodsStatus !== 41">
<good-nav /> <!-- <good-nav /> -->
<good-swiper /> <good-swiper />
<div class="good__body"> <template v-if="goodsStatus !== 0">
<div class="good__base"> <div class="good__body">
<template v-if="!hidePrice"> <div class="good__base">
<activity-price /> <template v-if="!hidePrice">
<discount-bar /> <activity-price />
<subscribe-bar /> <discount-bar />
<max-member-bar /> <subscribe-bar />
</template> <max-member-bar />
<good-title /> </template>
<good-title />
</div>
<div v-if="!hidePrice" class="good__base">
<good-cell-group />
</div>
<div v-if="!hidePrice" class="good__base">
<comment-lite />
</div>
<div class="good__base">
<detail-img />
<price-desc />
</div>
</div> </div>
<div v-if="!hidePrice" class="good__base"> <common-popup />
<good-cell-group /> <goods-action v-if="!hidePrice" />
</div> </template>
<div v-if="!hidePrice" class="good__base"> <transition name="fade">
<comment-lite /> <skeleton v-if="goodsStatus === 0" />
</div> </transition>
<div class="good__base">
<detail-img />
<price-desc />
</div>
</div>
<common-popup />
<goods-action v-if="!hidePrice" />
</template> </template>
<div class="good__body"> <div class="good__body">
<div class="good__base"><empty-good v-if="goodsStatus === 41" /></div> <div class="good__base"><empty-good v-if="goodsStatus === 41" /></div>
...@@ -35,15 +40,15 @@ ...@@ -35,15 +40,15 @@
header-type="image" header-type="image"
/> />
</div> </div>
<transition name="fade"> <!-- <transition name="fade"> -->
<skeleton v-if="goodsStatus === 0" /> <!-- <skeleton v-if="goodsStatus === 0" /> -->
</transition> <!-- </transition> -->
</div> </div>
</template> </template>
<script> <script>
import { mapActions, mapGetters, mapState } from './store'; import { mapActions, mapGetters, mapState } from './store';
import { jumpTargetPlatformPage } from '@/service/yxmLogin.service'; import { jumpTargetPlatformPage } from '@/service/yxmLogin.service';
import goodNav from './components/goodNav.vue'; // import goodNav from './components/goodNav.vue';
import goodSwiper from './components/goodSwiper.vue'; import goodSwiper from './components/goodSwiper.vue';
import activityPrice from './components/activityPrice.vue'; import activityPrice from './components/activityPrice.vue';
import discountBar from './components/discountBar.vue'; import discountBar from './components/discountBar.vue';
...@@ -64,7 +69,7 @@ export default { ...@@ -64,7 +69,7 @@ export default {
// eslint-disable-next-line vue/name-property-casing // eslint-disable-next-line vue/name-property-casing
name: 'goodDetail', name: 'goodDetail',
components: { components: {
goodNav, // goodNav,
goodSwiper, goodSwiper,
activityPrice, activityPrice,
discountBar, discountBar,
...@@ -144,7 +149,7 @@ export default { ...@@ -144,7 +149,7 @@ export default {
.good { .good {
position: relative; position: relative;
padding-bottom: 60px; padding-bottom: 60px;
&.stopscroll { &.stopScroll {
height: 100vh; height: 100vh;
overflow: hidden; overflow: hidden;
padding-bottom: 0; padding-bottom: 0;
......
...@@ -52,7 +52,15 @@ export const state = { ...@@ -52,7 +52,15 @@ export const state = {
}; };
export const getters = { export const getters = {
swiperImgList: state => state.detail.imageList || [], swiperImgList: state => {
if (state.detail.imageList) {
return state.detail.imageList;
}
if (state.query.goodsOrgImage) {
return [state.query.goodsOrgImage];
}
return [];
},
priceInfo: state => { priceInfo: state => {
const { salePrice, saleCount } = state.detail || {}; const { salePrice, saleCount } = state.detail || {};
return { salePrice, saleCount }; return { salePrice, saleCount };
...@@ -168,25 +176,25 @@ export const actions = { ...@@ -168,25 +176,25 @@ export const actions = {
console.log(error); console.log(error);
} }
}, },
async pickupCoupon({ state, dispatch }, index) { async pickupCoupon({ state, commit }, index) {
let couponPickupList = []; let couponPickupList = [];
const coupons = state.activityAndCoupon?.coupons || []; const coupons = state.activityAndCoupon?.coupons || [];
if (!index && index !== 0) { if (!index && index !== 0) {
couponPickupList = coupons.map(item => { couponPickupList = coupons.map(item => {
const { id, couponCategory, receiverLimitCount } = item; const { id, couponCategory } = item;
return { return {
couponId: id, couponId: id,
couponType: couponCategory, couponType: couponCategory,
pickupNum: receiverLimitCount pickupNum: 1
}; };
}); });
} else { } else {
const { id, couponCategory, receiverLimitCount } = coupons[index]; const { id, couponCategory } = coupons[index];
couponPickupList = [ couponPickupList = [
{ {
couponId: id, couponId: id,
couponType: couponCategory, couponType: couponCategory,
pickupNum: receiverLimitCount pickupNum: 1
} }
]; ];
} }
...@@ -200,7 +208,12 @@ export const actions = { ...@@ -200,7 +208,12 @@ export const actions = {
systemSendCoupon: true systemSendCoupon: true
}); });
if (res) { if (res) {
dispatch('getActivityAndCoupon'); state.activityAndCoupon.coupons = coupons.map(item => {
item.pickupAble = true;
return item;
});
commit('SET_ACT_AND_CPN', state.activityAndCoupon);
// dispatch('getActivityAndCoupon');
Vue.prototype.$toast('领取成功!'); Vue.prototype.$toast('领取成功!');
} }
}, },
...@@ -323,6 +336,9 @@ export const mutations = { ...@@ -323,6 +336,9 @@ export const mutations = {
Vue.set(state, 'skuNum', skuNum); Vue.set(state, 'skuNum', skuNum);
}, },
SET_SIMILARITY_LIST(state, list) { SET_SIMILARITY_LIST(state, list) {
if (list.length % 2 !== 0) {
list.length = list.length - 1;
}
Vue.set(state, 'similarityList', list); Vue.set(state, 'similarityList', list);
} }
}; };
...@@ -91,11 +91,12 @@ export default { ...@@ -91,11 +91,12 @@ export default {
this.layoutType = type; this.layoutType = type;
this.$emit(CHANGE_LIST_TYPE, type); this.$emit(CHANGE_LIST_TYPE, type);
}, },
// 清空数据
clearInputText() { clearInputText() {
this.keyWords = ''; this.keyWords = '';
}, },
resetSearch() { resetSearch() {
this.clearInputText(); // this.clearInputText();
this.$emit(CLEAR_EVENT); this.$emit(CLEAR_EVENT);
}, },
searchEnterEvent() { searchEnterEvent() {
......
...@@ -39,6 +39,7 @@ export default { ...@@ -39,6 +39,7 @@ export default {
height: 60px; height: 60px;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
left: 0;
z-index: 2; z-index: 2;
align-items: center; align-items: center;
background-color: #fff; background-color: #fff;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<span class="empty-text">购物车空空如也~</span> <span class="empty-text">购物车空空如也~</span>
</div> </div>
</template> </template>
<style lang="less"> <style lang="less" scoped>
.empty { .empty {
text-align: center; text-align: center;
height: 211px; height: 211px;
......
...@@ -29,7 +29,7 @@ export default { ...@@ -29,7 +29,7 @@ export default {
} }
}; };
</script> </script>
<style lang="less"> <style lang="less" scoped>
.activity { .activity {
display: flex; display: flex;
font-size: 12px; font-size: 12px;
......
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
<div class="good-radio-click" @click="changeSelectStatus" /> <div class="good-radio-click" @click="changeSelectStatus" />
<div class="good-image"> <div class="good-image">
<cr-image <cr-image
v-imogr="{ w: 208, h: 208 }" :src="value.skuImg | imogr({ w: 208, h: 208 })"
:src="value.skuImg"
lazy-load lazy-load
width="104" width="104"
height="104" height="104"
...@@ -95,10 +94,11 @@ export default { ...@@ -95,10 +94,11 @@ export default {
this.$emit('getPosition', this.idx, this.index); this.$emit('getPosition', this.idx, this.index);
}, },
stopPropagation() { stopPropagation() {
if (this.count === this.value.commonLimitCount) { return;
this.$toast(`您当前购买的商品限购${this.value.commonLimitCount}件`); // if (this.count === this.value.commonLimitCount) {
return; // this.$toast(`您当前购买的商品限购${this.value.commonLimitCount}件`);
} // return;
// }
}, },
...mapActions({ ...mapActions({
selectCartGood: 'select_cart_good', selectCartGood: 'select_cart_good',
...@@ -187,11 +187,11 @@ export default { ...@@ -187,11 +187,11 @@ export default {
bottom: 0; bottom: 0;
left: 0; left: 0;
font-size: 10px; font-size: 10px;
width: 100px; width: 100%;
text-align: center; text-align: center;
background: rgba(0, 0, 0, 0.6); background: rgba(0, 0, 0, 0.6);
padding: 4px 0; padding: 4px 0;
border-radius: 0px 0px 8px 8px; // border-radius: 0px 0px 8px 8px;
color: #fff; color: #fff;
} }
} }
......
...@@ -103,6 +103,10 @@ export default { ...@@ -103,6 +103,10 @@ export default {
value = this.max * scale; value = this.max * scale;
} }
} else if (type === 'plus') { } else if (type === 'plus') {
if (value >= this.max) {
this.$toast(`您当前购买的商品限购${this.max}件`);
return;
}
this.changeType = 'ADD_NUM'; this.changeType = 'ADD_NUM';
value += step; value += step;
if (value > this.max * scale) { if (value > this.max * scale) {
......
...@@ -27,7 +27,7 @@ export default { ...@@ -27,7 +27,7 @@ export default {
} }
}; };
</script> </script>
<style lang="less"> <style lang="less" scoped>
.tagList { .tagList {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
......
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
} }
}; };
</script> </script>
<style lang="less"> <style lang="less" scoped>
.good-title { .good-title {
width: 100%; width: 100%;
font-size: 13px; font-size: 13px;
......
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
} }
}; };
</script> </script>
<style lang="less"> <style lang="less" scoped>
.manage { .manage {
width: 100%; width: 100%;
height: 100%; height: 100%;
......
...@@ -148,7 +148,7 @@ export default { ...@@ -148,7 +148,7 @@ export default {
let haveNewUserProduct = false; let haveNewUserProduct = false;
const arr = this.selectedList; const arr = this.selectedList;
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
if (arr[i].product && arr[i].product.activityType && arr[i].product.activityType == 8) { if (arr[i].product && arr[i].product.userType && arr[i].product.userType == 9) {
haveNewUserProduct = true; haveNewUserProduct = true;
break; break;
} else { } else {
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
v-if="goodsList.length" v-if="goodsList.length"
header-type="image" header-type="image"
class="shopping-list--goods" class="shopping-list--goods"
:class="{ noLogin: !isLogin }"
:goods-list.sync="goodsList" :goods-list.sync="goodsList"
/> />
</cr-pull-refresh> </cr-pull-refresh>
...@@ -67,6 +68,7 @@ import localStorage from '@/service/localStorage.service'; ...@@ -67,6 +68,7 @@ import localStorage from '@/service/localStorage.service';
import ScrollView from '@/components/scrollView'; import ScrollView from '@/components/scrollView';
import PageWrapper from '../../components/base/PageWrapper.vue'; import PageWrapper from '../../components/base/PageWrapper.vue';
import historyRecordMixins from '@/mixins/historyRecord.mixins'; import historyRecordMixins from '@/mixins/historyRecord.mixins';
export default { export default {
name: 'Cart', name: 'Cart',
provide() { provide() {
...@@ -122,6 +124,9 @@ export default { ...@@ -122,6 +124,9 @@ export default {
...mapState(['activityInfo']), ...mapState(['activityInfo']),
validCount() { validCount() {
return this.cartList.length; return this.cartList.length;
},
isLogin: function() {
return localStorage.get('vccToken');
} }
}, },
watch: { watch: {
...@@ -139,6 +144,8 @@ export default { ...@@ -139,6 +144,8 @@ export default {
}, },
mounted() { mounted() {
this.loadData(); this.loadData();
},
activated() {
this.initMethods(); this.initMethods();
}, },
deactivated() { deactivated() {
...@@ -242,6 +249,12 @@ export default { ...@@ -242,6 +249,12 @@ export default {
::v-deep .cr-pull-refresh { ::v-deep .cr-pull-refresh {
height: auto; height: auto;
} }
::v-deep .cr-pull-refresh__head {
color: #333333;
}
::v-deep .cr-pull-refresh__head .cr-loading {
margin-right: 4px;
}
.shopping { .shopping {
width: 100%; width: 100%;
height: 100%; height: 100%;
...@@ -318,4 +331,7 @@ export default { ...@@ -318,4 +331,7 @@ export default {
top: 75px; top: 75px;
} }
} }
.onLogin {
padding-bottom: calc(56px + env(safe-area-inset-bottom));
}
</style> </style>
...@@ -77,7 +77,7 @@ const mutations = { ...@@ -77,7 +77,7 @@ const mutations = {
localStorage.set('userInfo', provider); localStorage.set('userInfo', provider);
}, },
[types.CHANGE_TOKEN](state, token) { [types.CHANGE_TOKEN](state, token) {
state.hasLogin = true; state.hasLogin = !!token;
state.vccToken = token; state.vccToken = token;
localStorage.set('vccToken', token); localStorage.set('vccToken', token);
}, },
......
...@@ -124,8 +124,9 @@ const shopCart = { ...@@ -124,8 +124,9 @@ const shopCart = {
}, },
update_cart_list({ commit, dispatch }, data) { update_cart_list({ commit, dispatch }, data) {
let goods = []; let goods = [];
if (data && data.cartInfoList) { if (data && (data.cartInfoList || data.addCartMore30CartInfoList)) {
goods = [...goods, ...data.cartInfoList]; goods = data.cartInfoList && [...goods, ...data.cartInfoList];
goods = data.addCartMore30CartInfoList && [...goods, ...data.addCartMore30CartInfoList];
console.log(goods, 'goods'); console.log(goods, 'goods');
const timeArray = goods.map(item => { const timeArray = goods.map(item => {
return item.skus.map(it => { return item.skus.map(it => {
...@@ -182,12 +183,16 @@ const shopCart = { ...@@ -182,12 +183,16 @@ const shopCart = {
dispatch('good_fee'); dispatch('good_fee');
} }
}, },
count_down({ state, commit }) { count_down({ state, commit, dispatch }) {
const timer = setInterval(() => { const timer = setInterval(() => {
const timeArray = state.timeArray.map(it => { const timeArray = state.timeArray.map(it => {
return it.map(i => { return it.map(i => {
if (i > 0) { if (i > 0) {
i = i - 1000; i = i - 1000 >= 0 ? i - 1000 : 0;
if (i === 0) {
dispatch('clear_timer');
dispatch('query_cart_list');
}
} }
return i; return i;
}); });
...@@ -368,7 +373,7 @@ const shopCart = { ...@@ -368,7 +373,7 @@ const shopCart = {
skuName: item.skuName, skuName: item.skuName,
commonLimitCount: item.commonLimitCount, commonLimitCount: item.commonLimitCount,
count: item.count, count: item.count,
activityType: item.activityType userType: item.activityShowInfo?.userType || null
} }
}; };
selectedGoods.push(good); selectedGoods.push(good);
......
<template>
<jhb id="app" ref="rootApp">
<cr-nav-bar v-if="header" :title="title" left-text="" @click-left="backFun" />
<jhb class="app">
<keep-alive :max="15" :include="keepAliveMap">
<router-view />
</keep-alive>
</jhb>
<cr-tabbar
v-if="tabBar"
v-model="router"
inactive-color="#000"
class="tab-bar"
@change="handleTabBar"
>
<cr-tabbar-item :icon="homeIcon">精选</cr-tabbar-item>
<cr-tabbar-item :icon="memberIcon">会员</cr-tabbar-item>
<cr-tabbar-item :badge="cartCount || undefined" :icon="cartIcon">购物车</cr-tabbar-item>
<cr-tabbar-item :icon="userIcon">我的</cr-tabbar-item>
</cr-tabbar>
<jhb v-if="loading" class="loading-container">
<cr-loading class="loading" size="24px">加载中...</cr-loading>
</jhb>
<net-error />
<LoginAuthorize />
</jhb>
</template>
<script>
import { mapGetters } from 'vuex';
import NetError from '@/components/NetError';
import LoginAuthorize from '@/components/loginAuthorize/index.vue';
import localStorage from '@/service/localStorage.service';
import TMDConfig from '@/customize/tmd-config';
import {
mapGetters as ShopCartMapGetters,
mapActions as ShopCartMapActions
} from '@/views/shopCart/shopCartModules.js';
const homeSelected = 'https://img.lkbang.net/home-cur.47903e4ae9d08c4e.47903e4a.png';
const homeIcon = 'https://img.lkbang.net/home.7d4f65b0d01fba.7d4f65b0.png';
const cartSelected = 'https://img.lkbang.net/cart-cur.08b92b167a8592.08b92b16.png';
const cartIcon = 'https://img.lkbang.net/cart.4040b7d6f3c3a5a.4040b7d6.png';
const userSelected = 'https://img.lkbang.net/user-cur.e46c0ec5a4b27d16a.e46c0ec5.png';
const userIcon = 'https://img.lkbang.net/user.27bd25d441abd27.27bd25d4.png';
const memberIconSelected = 'https://img.lkbang.net/member_incon_selected.a48af1f5.png';
const memberIcon = 'https://img.lkbang.net/member_icon.b566de02.png';
export default {
name: 'App',
components: {
NetError,
LoginAuthorize
},
data() {
return {
router: 0,
configTmd: ''
};
},
computed: {
...ShopCartMapGetters(['cartCount']),
...mapGetters(['title', 'header', 'loading', 'tabBar', 'routeIdx', 'keepAliveMap']),
homeIcon() {
return this.routeIdx === 0 ? homeSelected : homeIcon;
},
memberIcon() {
return this.routeIdx === 1 ? memberIconSelected : memberIcon;
},
cartIcon() {
return this.routeIdx === 2 ? cartSelected : cartIcon;
},
userIcon() {
return this.routeIdx === 3 ? userSelected : userIcon;
}
},
watch: {
header: {
immediate: true,
handler(val, oldVal) {
if (val !== oldVal) {
document.body.className = val ? 'has-header' : '';
}
}
},
routeIdx: {
immediate: true,
handler(val) {
console.log('val====', val);
this.router = val;
}
},
tabBar: {
immediate: true,
handler(val, oldVal) {
if (val !== oldVal) {
document.body.className = val ? 'has-tab-bar' : '';
}
}
}
},
created() {
const config = new TMDConfig();
this.configTmd = config;
},
async mounted() {
if (localStorage.get('vccToken') && location.pathname !== '/login') {
this.queryCartCount();
}
if (localStorage.get('vccChannel') == 161085) {
this.$nextTick(() => {
// document.getElementById('#app').innerHTML = '';
this.$refs.rootApp.innerHTML =
'<jhb class="cr-image" style="width: 100%; height: 100%;"><img src="https://img.lkbang.net/error.19ace11d.png" style="display: block; margin: 0 auto; width: 80%; height: auto; margin-top: 20px;" class="cr-image--img" ></jhb>';
});
}
},
methods: {
...ShopCartMapActions(['queryCartCount']),
backFun() {
this.$router.go(-1);
},
handleTabBar(idx) {
console.log('idx', idx);
const channelId = localStorage.get('vccChannel');
// console.log(location.href,"location.href",location.origin)
switch (idx) {
case 0:
this.$router.replace({ name: 'Home' });
break;
case 1:
this.$router.replace({ name: 'Member' });
// window.location.href = 'https://www.baidu.com';
break;
case 2:
if (channelId == this.configTmd.channelId.id && localStorage.get('vccPhone')) {
// console.log('jinlaile');
// 第三方进来
localStorage.get('vccToken')
? this.$router.replace({ name: 'Cart' })
: this.$router.replace({ name: 'LoginMiddle', query: { backUrl: location.href } });
} else {
// 之前逻辑
localStorage.get('vccToken')
? this.$router.replace({ name: 'Cart' })
: this.$router.replace({ name: 'Login', query: { backUrl: location.href } });
}
break;
case 3:
if (channelId == this.configTmd.channelId.id && localStorage.get('vccPhone')) {
// 第三方进来
localStorage.get('vccToken')
? this.$router.replace({ name: 'User' })
: this.$router.replace({ name: 'LoginMiddle', query: { backUrl: location.href } });
} else {
// 之前逻辑
this.$router.replace({ name: 'User' });
}
break;
}
}
}
};
</script>
<style lang="less">
@import './style/index';
.app {
user-select: none;
height: 100%;
min-height: 100%;
position: relative;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.loading-container {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 999;
display: flex;
justify-content: center;
align-items: center;
.loading {
padding: 6px;
border-radius: 6px;
background-color: rgba(0, 0, 0, 0.5);
color: #fff;
@{deep} .cr-loading--text {
color: #fff;
}
}
}
.tab-bar {
position: relative;
padding-top: 10px !important;
box-sizing: border-box;
z-index: 11;
height: calc(@tab-bar-height + constant(safe-area-inset-bottom));
height: calc(@tab-bar-height + env(safe-area-inset-bottom));
align-items: flex-start !important;
.cr-icon {
display: block;
height: 24px;
}
.cr-info--badge {
padding: 0 4px;
}
&:before {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 1px;
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
background-color: rgba(0, 0, 0, 0.33);
}
}
</style>
...@@ -130,23 +130,11 @@ async function renameFolder(oldName, newName) { ...@@ -130,23 +130,11 @@ async function renameFolder(oldName, newName) {
return makeDir(tempPath); return makeDir(tempPath);
}) })
// 复制 source 下所有文件到 temp // 复制 source 下所有文件到 temp
await copyDir(sourcePath, tempPath); await copyDir(sourcePath, tempPath,{ exclude: 'App.vue' });
// 调整pages 目录 // 调整pages 目录
await renameFolder(tempPath+'/views', tempPath+'/pages') await renameFolder(tempPath+'/views', tempPath+'/pages')
// await copyDir(sourcePath+'/views/', tempPath, { // copy temp 文件到 src
// prefix:'pages' await copyDir(tempPath, './src');
// }); // 删除 temp 目录
await deleteFolder(tempPath);
// await copyFolder(sourcePath, tempPath+"/", '', ['views'])
//
// await copyFolder(sourcePath+'/views', tempPath, 'pages')
// await copyFolder(sourcePath, tempPath);
// // 替换 temp 下所有文件的文本
// await replaceFiles(tempPath, map);
// // 复制 temp 文件夹到 src
// await copyTempToSrc(tempPath, sourcePath);
// // 删除 temp 目录
// await deleteFolder(tempPath);
})(); })();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment