chore(组件): 组件尽量使用异步导入模式

This commit is contained in:
2026-01-04 14:40:00 +08:00
parent 4da852944e
commit 9415f397d2
172 changed files with 11520 additions and 10979 deletions

View File

@@ -357,13 +357,12 @@
</view>
</template>
<script>
import nsLoading from '@/components/ns-loading/ns-loading.vue'
import aiService from '@/common/js/ai-service.js'
export default {
name: 'ai-chat-message',
components: {
nsLoading
nsLoading: () => import('@/components/ns-loading/ns-loading.vue'),
},
props: {
// 初始消息列表

View File

@@ -636,28 +636,19 @@
<script>
import payment from './payment.js';
import nsSelectTime from '@/components/ns-select-time/ns-select-time.vue';
import MescrollUni from "@/components/mescroll/my-list-mescroll.vue";
import nsLogin from '@/components/ns-login/ns-login.vue';
import loadingCover from '@/components/loading-cover/loading-cover.vue';
import nsEmpty from '@/components/ns-empty/ns-empty.vue';
// #ifdef MP-WEIXIN
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
// #endif
export default {
name: 'common-payment',
data() {
return {};
},
components: {
nsSelectTime,
nsLogin,
MescrollUni,
loadingCover,
nsEmpty,
nsSelectTime: () => import('@/components/ns-select-time/ns-select-time.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
nsEmpty: () => import('@/components/ns-empty/ns-empty.vue'),
// #ifdef MP-WEIXIN
privacyPopup
privacyPopup: () => import('@/components/wx-privacy-popup/privacy-popup.vue'),
// #endif
},
props: {

View File

@@ -1,4 +1,4 @@
import htmlParser from '@/common/js/html-parser';
import htmlParser from '@/common/js/html-parser.js';
export default {
options: {

View File

@@ -420,12 +420,7 @@
<script>
// 商品详情视图
import uniPopup from '@/components/uni-popup/uni-popup.vue';
import nsGoodsRecommend from '@/components/ns-goods-recommend/ns-goods-recommend.vue';
import pengpaiFadeinOut from '@/components/pengpai-fadein-out/pengpai-fadein-out.vue';
import xiaoStarComponent from '@/components/xiao-star-component/xiao-star-component.vue';
import scroll from '@/common/js/scroll-view.js';
import toTop from '@/components/toTop/toTop.vue';
import detail from './detail.js';
export default {
@@ -439,11 +434,11 @@
}
},
components: {
uniPopup,
nsGoodsRecommend,
pengpaiFadeinOut,
toTop,
xiaoStarComponent
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
nsGoodsRecommend: () => import('@/components/ns-goods-recommend/ns-goods-recommend.vue'),
pengpaiFadeinOut: () => import('@/components/pengpai-fadein-out/pengpai-fadein-out.vue'),
toTop: () => import('@/components/toTop/toTop.vue'),
xiaoStarComponent: () => import('@/components/xiao-star-component/xiao-star-component.vue'),
},
mixins: [scroll, detail]
};

View File

@@ -46,15 +46,11 @@
import MeScroll from './mescroll-uni.js';
// 引入全局配置
import GlobalOption from './mescroll-uni-option.js';
// 引入空布局组件
import MescrollEmpty from './components/mescroll-empty.vue';
// 引入回到顶部组件
import MescrollTop from './components/mescroll-top.vue';
export default {
components: {
MescrollEmpty,
MescrollTop
MescrollEmpty: () => import('./components/mescroll-empty.vue'),
MescrollTop: () => import('./components/mescroll-top.vue'),
},
data() {
return {

View File

@@ -57,18 +57,13 @@
import MeScroll from './mescroll-uni.js';
// 引入全局配置
import GlobalOption from './mescroll-uni-option.js';
// 引入空布局组件
import MescrollEmpty from './components/mescroll-empty.vue';
// 引入回到顶部组件
import MescrollTop from './components/mescroll-top.vue';
import nsLoading from '@/components/ns-loading/ns-loading.vue';
export default {
name: 'mescroll-uni',
components: {
MescrollEmpty,
MescrollTop
MescrollEmpty: () => import('./components/mescroll-empty.vue'),
MescrollTop: () => import('./components/mescroll-top.vue'),
nsLoading: () => import('@/components/ns-loading/ns-loading.vue'),
},
props: {
down: Object, // 下拉刷新的参数配置

View File

@@ -1,113 +1,112 @@
<template>
<!-- top="xxx"下拉布局往下偏移,防止被悬浮菜单遮住 -->
<mescroll
v-if="isInit"
:top="top"
:down="downOption"
:fixed="fixed"
:topbar="topbar"
:background="background"
:paddingBoth="paddingBoth"
@down="downCallback"
:up="upOption"
@up="upCallback"
@emptyclick="emptyClick"
@init="mescrollInit"
>
<!-- 数据列表 -->
<slot name="list"></slot>
</mescroll>
</template>
<script>
import Mescroll from './mescroll-uni.vue';
export default {
components: {
Mescroll
},
data() {
return {
mescroll: null, //mescroll实例对象
downOption: {
auto: false // 不自动加载
},
upOption: {
auto: false, // 不自动加载
page: {
num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
size: 10 // 每页数据的数量
},
noMoreSize: 2, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
empty: {
tip: '~ 空空如也 ~', // 提示
btnText: '去看看'
},
onScroll: true
},
scrollY: 0,
isInit: false
};
},
props: {
top: [String, Number],
size: [String, Number],
fixed: {
// 是否通过fixed固定mescroll的高度, 默认true
type: Boolean,
default() {
return true;
}
},
background: String,
topbar: Boolean,
paddingBoth: {
type: [String, Number],
default() {
return 0;
}
}
},
created() {
if (this.size) this.upOption.page.size = this.size;
this.isInit = true;
},
mounted() {
this.mescroll.resetUpScroll();
this.listenRefresh();
},
methods: {
// mescroll组件初始化的回调,可获取到mescroll对象
mescrollInit(mescroll) {
this.mescroll = mescroll;
},
/*下拉刷新的回调 */
downCallback() {
// 这里加载你想下拉刷新的数据, 比如刷新轮播数据
// loadSwiper();
// 下拉刷新的回调,默认重置上拉加载列表为第一页 (自动执行 mescroll.num=1, 再触发upCallback方法 )
this.mescroll.resetUpScroll();
this.listenRefresh();
},
/*上拉加载的回调: mescroll携带page的参数, 其中num:当前页 从1开始, size:每页数据条数,默认10 */
upCallback() {
//联网加载数据
this.$emit('getData', this.mescroll);
},
//点击空布局按钮的回调
emptyClick() {
this.$emit('emptytap', this.mescroll);
},
//刷新
refresh() {
this.mescroll.resetUpScroll();
this.listenRefresh();
},
myScrollTo(y, t) {
this.mescroll.myScrollTo(y, t);
},
listenRefresh() {
this.$emit('listenRefresh', true);
}
}
};
</script>
<template>
<!-- top="xxx"下拉布局往下偏移,防止被悬浮菜单遮住 -->
<mescroll
v-if="isInit"
:top="top"
:down="downOption"
:fixed="fixed"
:topbar="topbar"
:background="background"
:paddingBoth="paddingBoth"
@down="downCallback"
:up="upOption"
@up="upCallback"
@emptyclick="emptyClick"
@init="mescrollInit"
>
<!-- 数据列表 -->
<slot name="list"></slot>
</mescroll>
</template>
<script>
export default {
components: {
Mescroll: () => import('./mescroll-uni.vue'),
},
data() {
return {
mescroll: null, //mescroll实例对象
downOption: {
auto: false // 不自动加载
},
upOption: {
auto: false, // 不自动加载
page: {
num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
size: 10 // 每页数据的数量
},
noMoreSize: 2, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
empty: {
tip: '~ 空空如也 ~', // 提示
btnText: '去看看'
},
onScroll: true
},
scrollY: 0,
isInit: false
};
},
props: {
top: [String, Number],
size: [String, Number],
fixed: {
// 是否通过fixed固定mescroll的高度, 默认true
type: Boolean,
default() {
return true;
}
},
background: String,
topbar: Boolean,
paddingBoth: {
type: [String, Number],
default() {
return 0;
}
}
},
created() {
if (this.size) this.upOption.page.size = this.size;
this.isInit = true;
},
mounted() {
this.mescroll.resetUpScroll();
this.listenRefresh();
},
methods: {
// mescroll组件初始化的回调,可获取到mescroll对象
mescrollInit(mescroll) {
this.mescroll = mescroll;
},
/*下拉刷新的回调 */
downCallback() {
// 这里加载你想下拉刷新的数据, 比如刷新轮播数据
// loadSwiper();
// 下拉刷新的回调,默认重置上拉加载列表为第一页 (自动执行 mescroll.num=1, 再触发upCallback方法 )
this.mescroll.resetUpScroll();
this.listenRefresh();
},
/*上拉加载的回调: mescroll携带page的参数, 其中num:当前页 从1开始, size:每页数据条数,默认10 */
upCallback() {
//联网加载数据
this.$emit('getData', this.mescroll);
},
//点击空布局按钮的回调
emptyClick() {
this.$emit('emptytap', this.mescroll);
},
//刷新
refresh() {
this.mescroll.resetUpScroll();
this.listenRefresh();
},
myScrollTo(y, t) {
this.mescroll.myScrollTo(y, t);
},
listenRefresh() {
this.$emit('listenRefresh', true);
}
}
};
</script>

View File

@@ -1,120 +1,120 @@
<template>
<view v-if="advList.length" :class="['container-box',className]">
<swiper :indicator-dots="advList.length > 1" indicator-active-color="#ffffff" :autoplay="true" :interval="3000" :duration="1000" v-if="advList.length > 1" @change="changeSwiper" :current="currentIndex" :style="{ height: swiperHeight + 'px' }" class="item-wrap">
<swiper-item v-for="(item, index) in advList" :key="index" @click="jumppage(item.adv_url)">
<view class="image-box">
<image :src="$util.img(item.adv_image)" mode="widthFix" :id="'content-wrap' + index"/>
</view>
</swiper-item>
</swiper>
<view v-else class="container-box item-wrap">
<image :src="$util.img(advList[0]['adv_image'])" mode="widthFix" lazy-load="true" @load="imageLoad" @click="jumppage(advList[0].adv_url)"/>
</view>
</view>
</template>
<script>
export default {
name: 'ns-advert',
props: {
keyword: {
type: String
},
className: {
type: String
}
},
data() {
return {
advList: [],
isImage: false,
//滑块的高度(单位px)
swiperHeight: 150,
//当前索引
currentIndex: 0,
};
},
created() {
this.getAdvList();
},
methods: {
//获取广告位
getAdvList() {
var item = {
adv_image: '',
adv_url: ''
};
this.$api.sendRequest({
url: '/api/adv/detail',
data: {
keyword: this.keyword
},
success: res => {
if (res.code == 0) {
var data = res.data.adv_list;
for (var index in data) {
if (data[index].adv_url) data[index].adv_url = JSON.parse(data[index].adv_url);
}
this.advList = res.data.adv_list;
//动态设置swiper的高度
this.$nextTick(() => {
this.setSwiperHeight();
});
}
}
});
},
jumppage(e) {
this.$util.diyRedirectTo(e);
},
imageLoad(data) {
this.isImage = true;
},
//手动切换题目
changeSwiper(e) {
this.currentIndex = e.detail.current;
//动态设置swiper的高度使用nextTick延时设置
this.$nextTick(() => {
this.setSwiperHeight();
});
},
//动态设置swiper的高度
setSwiperHeight() {
if (this.advList.length > 1) {
setTimeout(() => {
let element = "#content-wrap" + this.currentIndex;
let query = uni.createSelectorQuery().in(this);
query.select(element).boundingClientRect();
query.exec((res) => {
if (res && res[0]) {
this.swiperHeight = res[0].height;
}
});
}, 10);
}
},
}
};
</script>
<style lang="scss">
.container-box {
width: 100%;
.item-wrap {
border-radius: 10rpx;
.image-box {
border-radius: 10rpx;
}
image {
width: 100%;
height: auto;
border-radius: 10rpx;
will-change: transform;
}
}
}
<template>
<view v-if="advList.length" :class="['container-box',className]">
<swiper :indicator-dots="advList.length > 1" indicator-active-color="#ffffff" :autoplay="true" :interval="3000" :duration="1000" v-if="advList.length > 1" @change="changeSwiper" :current="currentIndex" :style="{ height: swiperHeight + 'px' }" class="item-wrap">
<swiper-item v-for="(item, index) in advList" :key="index" @click="jumppage(item.adv_url)">
<view class="image-box">
<image :src="$util.img(item.adv_image)" mode="widthFix" :id="'content-wrap' + index"/>
</view>
</swiper-item>
</swiper>
<view v-else class="container-box item-wrap">
<image :src="$util.img(advList[0]['adv_image'])" mode="widthFix" lazy-load="true" @load="imageLoad" @click="jumppage(advList[0].adv_url)"/>
</view>
</view>
</template>
<script>
export default {
name: 'ns-advert',
props: {
keyword: {
type: String
},
className: {
type: String
}
},
data() {
return {
advList: [],
isImage: false,
//滑块的高度(单位px)
swiperHeight: 150,
//当前索引
currentIndex: 0,
};
},
created() {
this.getAdvList();
},
methods: {
//获取广告位
getAdvList() {
var item = {
adv_image: '',
adv_url: ''
};
this.$api.sendRequest({
url: '/api/adv/detail',
data: {
keyword: this.keyword
},
success: res => {
if (res.code == 0) {
var data = res.data.adv_list;
for (var index in data) {
if (data[index].adv_url) data[index].adv_url = JSON.parse(data[index].adv_url);
}
this.advList = res.data.adv_list;
//动态设置swiper的高度
this.$nextTick(() => {
this.setSwiperHeight();
});
}
}
});
},
jumppage(e) {
this.$util.diyRedirectTo(e);
},
imageLoad(data) {
this.isImage = true;
},
//手动切换题目
changeSwiper(e) {
this.currentIndex = e.detail.current;
//动态设置swiper的高度使用nextTick延时设置
this.$nextTick(() => {
this.setSwiperHeight();
});
},
//动态设置swiper的高度
setSwiperHeight() {
if (this.advList.length > 1) {
setTimeout(() => {
let element = "#content-wrap" + this.currentIndex;
let query = uni.createSelectorQuery().in(this);
query.select(element).boundingClientRect();
query.exec((res) => {
if (res && res[0]) {
this.swiperHeight = res[0].height;
}
});
}, 10);
}
},
}
};
</script>
<style lang="scss">
.container-box {
width: 100%;
.item-wrap {
border-radius: 10rpx;
.image-box {
border-radius: 10rpx;
}
image {
width: 100%;
height: auto;
border-radius: 10rpx;
will-change: transform;
}
}
}
</style>

View File

@@ -80,13 +80,12 @@
</template>
<script>
import uniPopup from '../uni-popup/uni-popup.vue';
// 注册奖励弹出层
export default {
name: 'ns-birthday-gift',
components: {
uniPopup
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
nsLoading: () => import('@/components/ns-loading/ns-loading.vue'),
},
data() {
return {
@@ -164,7 +163,7 @@
}
};
</script>
<style scoped>
<style lang="scss" scoped>
.register-box /deep/ .uni-scroll-view {
background: unset !important;
}

View File

@@ -54,6 +54,9 @@
default: ''
}
},
components: {
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
},
data() {
return {
config: null,

View File

@@ -200,11 +200,10 @@
</template>
<script>
import pickRegions from '@/components/pick-regions/pick-regions.vue';
export default {
name: 'ns-form',
components: {
pickRegions
pickRegions: () => import('@/components/pick-regions/pick-regions.vue'),
},
props: {
data: {

View File

@@ -1,96 +1,98 @@
<template>
<view class="action-buttom-wrap disabled" v-if="disabled" @click="clickEvent">{{ disabledText }}</view>
<view class="action-buttom-wrap"
:class="[backgroundClass, textPrice ? 'has-second' : '', background ? 'color-join-cart' : 'color-base-bg']"
:style="{background:backgroundColor+'!important', 'color':textColor ? textColor : '#ffffff'}" v-else
@click="clickEvent">
<text class="price-font">{{ textPrice }}</text>
<text>{{ text }}</text>
</view>
</template>
<script>
export default {
name: 'ns-goods-action-button',
props: {
// 商品底部按钮文字
text: {
type: String,
default: ''
},
// 商品底部按钮价格文字
textPrice: {
type: String,
default: ''
},
// 背景色
background: {
type: String,
default: ''
},
// 背景色样式
backgroundClass: {
type: String,
default: ''
},
//
backgroundColor: {
type: String,
default: ''
},
// 是否禁用
disabled: {
type: Boolean,
default: false
},
// 禁用文字提示
disabledText: {
type: String,
default: ''
},
// 文字颜色
textColor: {
type: String,
default: ''
},
},
computed: {},
methods: {
clickEvent() {
this.$emit('click');
}
}
};
</script>
<style lang="scss">
.action-buttom-wrap {
flex: 1;
height: 70rpx;
font-weight: 600;
font-size: 30rpx;
line-height: 70rpx;
border: none;
color: #fff;
text-align: center;
border-radius: 10rpx;
margin-right: 20rpx;
}
.action-buttom-wrap.has-second {
line-height: 50rpx;
}
.action-buttom-wrap.has-second text {
display: block;
line-height: 1.2;
}
.action-buttom-wrap:active {
opacity: 0.8;
}
.action-buttom-wrap.disabled {
background: $color-disabled;
}
<template>
<view>
<view class="action-buttom-wrap disabled" v-if="disabled" @click="clickEvent">{{ disabledText }}</view>
<view class="action-buttom-wrap"
:class="[backgroundClass, textPrice ? 'has-second' : '', background ? 'color-join-cart' : 'color-base-bg']"
:style="{background:backgroundColor+'!important', 'color':textColor ? textColor : '#ffffff'}" v-else
@click="clickEvent">
<text class="price-font">{{ textPrice }}</text>
<text>{{ text }}</text>
</view>
</view>
</template>
<script>
export default {
name: 'ns-goods-action-button',
props: {
// 商品底部按钮文字
text: {
type: String,
default: ''
},
// 商品底部按钮价格文字
textPrice: {
type: String,
default: ''
},
// 背景色
background: {
type: String,
default: ''
},
// 背景色样式
backgroundClass: {
type: String,
default: ''
},
//
backgroundColor: {
type: String,
default: ''
},
// 是否禁用
disabled: {
type: Boolean,
default: false
},
// 禁用文字提示
disabledText: {
type: String,
default: ''
},
// 文字颜色
textColor: {
type: String,
default: ''
},
},
computed: {},
methods: {
clickEvent() {
this.$emit('click');
}
}
};
</script>
<style lang="scss">
.action-buttom-wrap {
flex: 1;
height: 70rpx;
font-weight: 600;
font-size: 30rpx;
line-height: 70rpx;
border: none;
color: #fff;
text-align: center;
border-radius: 10rpx;
margin-right: 20rpx;
}
.action-buttom-wrap.has-second {
line-height: 50rpx;
}
.action-buttom-wrap.has-second text {
display: block;
line-height: 1.2;
}
.action-buttom-wrap:active {
opacity: 0.8;
}
.action-buttom-wrap.disabled {
background: $color-disabled;
}
</style>

View File

@@ -20,7 +20,6 @@
</template>
<script>
import nsContact from '@/components/ns-contact/ns-contact.vue';
export default {
name: 'ns-goods-action-icon',
props: {
@@ -73,7 +72,7 @@ export default {
}
},
components:{
nsContact
nsContact: () => import('@/components/ns-contact/ns-contact.vue'),
},
methods: {
clickEvent() {

View File

@@ -3,15 +3,12 @@
</template>
<script>
import nsLoading from '@/components/ns-loading/ns-loading.vue';
import nsGoodsSkuIndex from '@/components/ns-goods-sku/ns-goods-sku-index.vue';
// 商品推荐
export default {
name: 'ns-goods-recommend',
components: {
nsLoading,
nsGoodsSkuIndex
nsLoading: () => import('@/components/ns-loading/ns-loading.vue'),
nsGoodsSkuIndex: () => import('@/components/ns-goods-sku/ns-goods-sku-index.vue'),
},
data() {
return {

View File

@@ -82,12 +82,12 @@
</template>
<script>
import uniPopup from '@/components/uni-popup/uni-popup-sku-new.vue';
// 商品SKU
export default {
name: 'ns-goods-sku-category',
components: {
uniPopup
uniPopup: () => import('@/components/uni-popup/uni-popup-sku-new.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
},
props: {
disabled: {

View File

@@ -7,12 +7,12 @@
</template>
<script>
import nsGoodsSku from '@/components/ns-goods-sku/ns-goods-sku.vue';
// 商品SKU
export default {
name: 'ns-goods-sku-index',
components: {
nsGoodsSku
nsGoodsSku: () => import('@/components/ns-goods-sku/ns-goods-sku.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
},
data() {
return {

View File

@@ -214,12 +214,12 @@
</template>
<script>
import uniPopup from '@/components/uni-popup/uni-popup-sku.vue';
// 商品SKU
export default {
name: 'ns-goods-sku',
components: {
uniPopup
uniPopup: () => import('@/components/uni-popup/uni-popup-sku.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
},
props: {
goodsId: {

View File

@@ -97,13 +97,6 @@
</template>
<script>
import uniPopup from '@/components/uni-popup/uni-popup.vue';
import registerReward from '@/components/register-reward/register-reward.vue';
// #ifdef MP-WEIXIN
import privacyPopup from '@/components/wx-privacy-popup/privacy-popup.vue';
// #endif
import auth from '@/common/js/auth.js';
import validate from '@/common/js/validate.js';
@@ -111,10 +104,10 @@
mixins: [auth],
name: 'ns-login',
components: {
uniPopup,
registerReward,
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
registerReward: () => import('@/components/register-reward/register-reward.vue'),
// #ifdef MP-WEIXIN
privacyPopup
privacyPopup: () => import('@/components/wx-privacy-popup/privacy-popup.vue'),
// #endif
},
data() {
@@ -781,7 +774,7 @@
}
}
</style>
<style scoped>
<style lang="scss" scoped>
/deep/ .reward-popup .uni-popup__wrapper-box {
background: none !important;
max-width: unset !important;

View File

@@ -15,7 +15,7 @@
}
</script>
<style lang="scss">
<style lang="scss" scoped>
.mp-html{
/deep/ img{
width:100% !important;

View File

@@ -75,11 +75,9 @@
</template>
<script>
import uniPopup from '../uni-popup/uni-popup.vue';
export default {
components: {
uniPopup
uniPopup: () => import('../uni-popup/uni-popup.vue'),
},
data() {
return {
@@ -171,7 +169,7 @@
};
</script>
<style scoped>
<style lang="scss" scoped>
/deep/ .newgift-content uni-image {
width: 113rpx !important;
height: 24rpx !important;
@@ -193,7 +191,7 @@
}
</style>
<style lang="scss">
<style lang="scss" scoped>
.reward-wrap {
width: 85vw;
height: auto;

View File

@@ -278,12 +278,10 @@
</template>
<script>
import pickRegions from '@/components/pick-regions/pick-regions.vue'
export default {
name: 'ns-form',
components: {
pickRegions
pickRegions: () => import('@/components/pick-regions/pick-regions.vue'),
},
props: {
data: {

View File

@@ -43,9 +43,6 @@
<!-- 旧版支付组件 订单表不为order表 的订单支付时使用该组件 -->
<script>
import uniPopup from '@/components/uni-popup/uni-popup.vue';
import nsSwitch from '@/components/ns-switch/ns-switch.vue';
// #ifdef H5
import { Weixin } from 'common/js/wx-jssdk.js';
// #endif
@@ -53,8 +50,8 @@
export default {
name: 'ns-payment',
components: {
uniPopup,
nsSwitch
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
nsSwitch: () => import('@/components/ns-switch/ns-switch.vue'),
},
props: {
balanceDeduct: {
@@ -112,11 +109,12 @@
};
},
created(e) {
let url = '';
// #ifdef H5
let url = window.location.href
url = window.location.href
// #endif
// #ifndef H5
let url = getCurrentPages()[getCurrentPages().length - 1].route
url = getCurrentPages()[getCurrentPages().length - 1].route
// #endif
let list = url.match('presale/order_list/order_list')
let detail = url.match('presale/order_detail/order_detail')

View File

@@ -10,7 +10,8 @@
<view class="body">
<!-- 左侧日期选择 -->
<scroll-view :scroll-y="true" class="left">
<view class="item" :class="index == keyJudge ? 'itemDay' : ''" v-for="(item, index) in dayData" :key="index" @click="selectTime('days', index, 'yes')">
<view class="item" :class="index == keyJudge ? 'itemDay' : ''" v-for="(item, index) in dayData"
:key="index" @click="selectTime('days', index, 'yes')">
<block v-if="item.title">{{ item.title }}</block>
<block v-else>{{ item.month }}</block>
<text class="itemtext">{{ item.Day }}</text>
@@ -18,9 +19,11 @@
</scroll-view>
<!-- 右侧时间选择 -->
<scroll-view :scroll-y="true" class="right">
<view class="item" :class="key == keyJudge && index == keys ? 'itemTime' : ''" v-for="(item, index) in timeData" :key="index" @click="selectTime('time', index, 'yes')">
<view class="item" :class="key == keyJudge && index == keys ? 'itemTime' : ''"
v-for="(item, index) in timeData" :key="index" @click="selectTime('time', index, 'yes')">
{{ item }}
<text v-if="key == keyJudge && index == keys" class="iconfont icon-yuan_checked color-base-text"></text>
<text v-if="key == keyJudge && index == keys"
class="iconfont icon-yuan_checked color-base-text"></text>
</view>
</scroll-view>
</view>
@@ -30,11 +33,10 @@
</template>
<script>
import uniPopup from '@/components/uni-popup/uni-popup.vue';
export default {
name: "nsSelectTime",
components: {
uniPopup
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
},
data() {
return {
@@ -57,7 +59,7 @@ export default {
};
},
methods: {
refresh(){
refresh() {
this.key = 0;
this.keys = 0;
this.keyJudge = 0;
@@ -90,7 +92,7 @@ export default {
this.key = this.keyJudge;
let obj = this.dayData[this.key];
obj.time = this.timeData[this.keys];
let time = obj.time.replace('立即配送(','').replace('','');
let time = obj.time.replace('立即配送(', '').replace('', '');
var dateTime = new Date();
var format = time.split('-');
@@ -102,13 +104,13 @@ export default {
let date = timeData[1].split('日')[0];
// 开始时间戳
dateTime.setHours(startHours[0],startHours[1],0,0);
obj.start_time = dateTime.getTime()/1000;
dateTime.setHours(startHours[0], startHours[1], 0, 0);
obj.start_time = dateTime.getTime() / 1000;
obj.start_date = dateTime.getFullYear() + '-' + month + '-' + date + ' ' + format[0];
// 结束时间戳
dateTime.setHours(endHours[0],endHours[1],0,0);
obj.end_time = dateTime.getTime()/1000;
dateTime.setHours(endHours[0], endHours[1], 0, 0);
obj.end_time = dateTime.getTime() / 1000;
obj.end_date = dateTime.getFullYear() + '-' + month + '-' + date + ' ' + format[1];
this.$emit('selectTime', { data: obj, type: judge });
@@ -157,16 +159,16 @@ export default {
for (let i = 0; i < mostDay; i++) {
let objects = {};
let dayStr = week[ nowDay ];
let dayStr = week[nowDay];
// 判断最大可预约时间
if (this.obj.dataTime.most_day > 0 && ((startTime + num * 86400) > (startTime + this.obj.dataTime.most_day * 86400) ) ) {
if (this.obj.dataTime.most_day > 0 && ((startTime + num * 86400) > (startTime + this.obj.dataTime.most_day * 86400))) {
this.judge = true;
break;
}
//判断当天是否能够配送、自提
if (type == 0 || judge || obj.indexOf(nowDay.toString()) != -1) {
let endTime = this.obj.dataTime.delivery_time[ (this.obj.dataTime.delivery_time.length - 1) ].end_time;
endTime -= this.obj.dataTime.time_interval * 60;
let endTime = this.obj.dataTime.delivery_time[(this.obj.dataTime.delivery_time.length - 1)].end_time;
endTime -= this.obj.dataTime.time_interval * 60;
switch (num) {
case 1:
if (i == 0) {
@@ -222,7 +224,7 @@ export default {
nowDay = 0;
}
num += 1;
if (this.obj.dataTime.most_day == 0 && i == 0) {
this.judge = true;
}
@@ -242,25 +244,25 @@ export default {
}
let timeData = [];
if (!this.obj.dataTime.delivery_time) {
this.obj.dataTime.delivery_time = [ {start_time: this.obj.dataTime.start_time, end_time: this.obj.dataTime.end_time} ]
this.obj.dataTime.delivery_time = [{ start_time: this.obj.dataTime.start_time, end_time: this.obj.dataTime.end_time }]
}
//判断选中是否为当天
let remainder = 0;
//当天配送自提的话向后推迟30分钟
let newDayTime = JSON.parse(JSON.stringify(this.dayTime));
// newDayTime = Math.ceil(this.dayTime / 600) * 600 + 1800;
//判断选中是否为当天
let timeJudage = false;
if (this.dayData[this.keyJudge] && this.dayData[this.keyJudge].type && newDayTime > this.obj.dataTime.start_time) timeJudage = true;
let timeInterval = this.obj.dataTime.time_interval ? this.obj.dataTime.time_interval * 60 : 1200;
this.obj.dataTime.delivery_time.forEach(item => {
item.end_time = item.end_time ? item.end_time : 86400;
item.end_time = item.end_time ? item.end_time : 86400;
let num = parseInt((parseInt(item.end_time) - parseInt(item.start_time)) / timeInterval);
let time = timeJudage ? parseInt(newDayTime) : parseInt(item.start_time);
for (let i = 0; i < num; i++) {
@@ -271,12 +273,12 @@ export default {
if (time <= item.end_time) {
let text = '';
if (this.obj.delivery.delivery_type == 'local' && i == 0) {
text = '立即配送('+ this.$util.getTimeStr(time) + '-' + this.$util.getTimeStr(time + timeInterval) + '';
text = '立即配送(' + this.$util.getTimeStr(time) + '-' + this.$util.getTimeStr(time + timeInterval) + '';
} else {
text = this.$util.getTimeStr(time) + '-' + this.$util.getTimeStr(time + timeInterval);
}
timeData.push(text);
}
}
} else {
timeData.push(this.$util.getTimeStr(time));
}
@@ -301,6 +303,7 @@ export default {
<style lang="scss" scoped>
.box {
height: 728rpx;
.title {
padding: 0 30rpx;
box-sizing: border-box;
@@ -311,6 +314,7 @@ export default {
height: 90rpx;
line-height: 90rpx;
border-bottom: 1rpx solid #f7f4f4;
.icon-close {
font-size: 26rpx;
color: #909399;
@@ -320,15 +324,18 @@ export default {
transform: translateY(-50%);
}
}
.body {
width: 100%;
height: calc(100% - 90rpx);
display: flex;
align-items: center;
.left {
width: 230rpx;
background: #f8f8f8;
height: 100%;
.item {
width: 100%;
padding: 16rpx 30rpx;
@@ -338,15 +345,18 @@ export default {
display: flex;
align-items: center;
}
.itemDay {
background: #ffffff;
}
}
.right {
width: calc(100% - 230rpx);
height: 100%;
padding: 0 30rpx;
box-sizing: border-box;
.item {
width: 100%;
font-size: 24rpx;
@@ -355,11 +365,13 @@ export default {
align-items: center;
justify-content: space-between;
height: 72rpx;
.icon-yuan_checked {
font-size: 38rpx;
margin-right: 30rpx;
}
}
.itemTime {
color: var(--main-color);
}

View File

@@ -43,9 +43,6 @@
<!-- 新版支付组件 订单表为order表 的订单支付时使用该组件 -->
<script>
import uniPopup from '@/components/uni-popup/uni-popup.vue';
import nsSwitch from '@/components/ns-switch/ns-switch.vue';
// #ifdef H5
import {
Weixin
@@ -55,8 +52,8 @@
export default {
name: 'payment',
components: {
uniPopup,
nsSwitch
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
nsSwitch: () => import('@/components/ns-switch/ns-switch.vue'),
},
props: {
// 是否可用余额支付

View File

@@ -44,6 +44,9 @@
type: String
}
},
components: {
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
},
data() {
return {
pickerValueArray: [],

View File

@@ -78,13 +78,11 @@
</template>
<script>
import uniPopup from '@/components/uni-popup/uni-popup.vue';
// 注册奖励弹出层
export default {
name: 'register-reward',
components: {
uniPopup
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
},
data() {
return {

View File

@@ -19,11 +19,10 @@
</template>
<script>
import uniBadge from '@/components/uni-badge/uni-badge.vue';
export default {
name: 'UniGridItem',
components: {
uniBadge
uniBadge: () => import('@/components/uni-badge/uni-badge.vue'),
},
props: {
// 类型可选值dot圆点badge角标image图片

View File

@@ -79,6 +79,9 @@
default: true
}
},
components: {
uniPopup: () => import('@/components/uni-popup/uni-popup.vue'),
},
data() {
return {
wxWorkSDK: null