Gao xiaosong
4 years ago
10 changed files with 863 additions and 904 deletions
@ -1,448 +1,438 @@ |
|||||||
<template> |
<template> |
||||||
<view class="index"> |
<view class="index"> |
||||||
<view v-for="(item,index) in homeData" :key="index"> |
<view v-for="(item, index) in homeData" :key="index"> |
||||||
<view class="head_box" v-if="item.type=='header'" :style="{ background: bgcolor }" :class="{ active: bgcolor }"> |
<view class="head_box" v-if="item.type == 'header'" :style="{ background: bgcolor }" :class="{ active: bgcolor }"> |
||||||
<cu-custom :isBack="true" :bgColor="bgcolor"> |
<cu-custom :isBack="true" :bgColor="bgcolor"> |
||||||
<block slot="backText"> |
<block slot="backText"> |
||||||
<text class="nav-title shopro-selector-rect">{{ item.componentContent.title }}</text> |
<text class="nav-title shopro-selector-rect">{{ item.componentContent.title }}</text> |
||||||
</block> |
</block> |
||||||
</cu-custom> |
</cu-custom> |
||||||
</view> |
</view> |
||||||
<view class="header header-search acea-row row-center-wrapper" v-if="item.type=='search'" :style="{ background: bgcolor }"> |
<view class="header header-search acea-row row-center-wrapper" v-if="item.type == 'search'" :style="{ background: bgcolor }"> |
||||||
<view @click="goGoodSearch()" class="search acea-row row-middle"> |
<view @click="goGoodSearch()" class="search acea-row row-middle"> |
||||||
<text class="iconfont icon-xiazai5"></text> |
<text class="iconfont icon-xiazai5"></text> |
||||||
搜索商品 |
搜索商品 |
||||||
</view> |
</view> |
||||||
<view class="qr" @click="startQr()"> |
<!-- #ifndef H5 --> |
||||||
<image :src="`${$VUE_APP_RESOURCES_URL}/images/qr.png`" /> |
<view class="qr" @click="startQr()" v-if="$deviceType !== 'weixin'"> |
||||||
</view> |
<image :src="`${$VUE_APP_RESOURCES_URL}/images/qr.png`" /> |
||||||
</view> |
</view> |
||||||
<Banner v-if="item.type=='banner'" :detail="item.componentContent.bannerData" @getbgcolor="getbgcolor"></Banner> |
<!-- #endif --> |
||||||
<uni-notice-bar v-if="item.type=='noticeBar'" scrollable="true" @click="goRoll(item.componentContent.roll[0])" |
</view> |
||||||
single="true" :speed="10" showIcon="true" :text="item.componentContent.roll[0].info"></uni-notice-bar> |
<Banner v-if="item.type == 'banner'" :detail="item.componentContent.bannerData" @getbgcolor="getbgcolor"></Banner> |
||||||
<view class="content_box home_content_box" v-if="item.type=='menu'&&item.componentContent.menus"> |
<uni-notice-bar v-if="item.type == 'noticeBar'" scrollable="true" @click="goRoll(item.componentContent.roll[0])" single="true" :speed="10" showIcon="true" :text="item.componentContent.roll[0].info"></uni-notice-bar> |
||||||
<!-- 菜单 --> |
<view class="content_box home_content_box" v-if="item.type == 'menu' && item.componentContent.menus"> |
||||||
<Menu :list="item.componentContent.menus" ></Menu> |
<!-- 菜单 --> |
||||||
</view> |
<Menu :list="item.componentContent.menus"></Menu> |
||||||
<!-- 滚动新闻 --> |
</view> |
||||||
<!-- 广告 --> |
<!-- 滚动新闻 --> |
||||||
<Adv v-if="item.type=='adv'&&item.componentContent.detail" :detail="item.componentContent.detail" /> |
<!-- 广告 --> |
||||||
<!-- 热门榜单 --> |
<Adv v-if="item.type == 'adv' && item.componentContent.detail" :detail="item.componentContent.detail" /> |
||||||
<HotCommodity v-if="item.type=='hotCommodity'" :detail="likeInfo"></HotCommodity> |
<!-- 热门榜单 --> |
||||||
<!-- 超值拼团 --> |
<HotCommodity v-if="item.type == 'hotCommodity'" :detail="likeInfo"></HotCommodity> |
||||||
<Groupon v-if="item.type=='groupon'" :detail="combinationList" /> |
<!-- 超值拼团 --> |
||||||
<!-- 首发新品->秒杀 --> |
<Groupon v-if="item.type == 'groupon'" :detail="combinationList" /> |
||||||
<FirstNewProduct v-if="item.type=='firstNewProduct'" :detail="firstList"></FirstNewProduct> |
<!-- 首发新品->秒杀 --> |
||||||
<!-- 精品推荐 --> |
<FirstNewProduct v-if="item.type == 'firstNewProduct'" :detail="firstList"></FirstNewProduct> |
||||||
<ProductsRecommended v-if="item.type=='productsRecommended'" :detail="bastList"></ProductsRecommended> |
<!-- 精品推荐 --> |
||||||
<!-- 促销单品 --> |
<ProductsRecommended v-if="item.type == 'productsRecommended'" :detail="bastList"></ProductsRecommended> |
||||||
<PromoteProduct v-if="item.type=='promoteProduct'" :detail="benefit"></PromoteProduct> |
<!-- 促销单品 --> |
||||||
<!-- 直播 --> |
<PromoteProduct v-if="item.type == 'promoteProduct'" :detail="benefit"></PromoteProduct> |
||||||
<!-- #ifdef MP-WEIXIN --> |
<!-- 直播 --> |
||||||
<Live v-if="item.type=='live'" :detail="live"></Live> |
<!-- #ifdef MP-WEIXIN --> |
||||||
<!-- #endif --> |
<Live v-if="item.type == 'live'" :detail="live"></Live> |
||||||
<!-- 为您推荐 --> |
<!-- #endif --> |
||||||
<PromotionGood v-if="item.type=='promotionGood'" :benefit="benefit"></PromotionGood> |
<!-- 为您推荐 --> |
||||||
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose"> |
<PromotionGood v-if="item.type == 'promotionGood'" :benefit="benefit"></PromotionGood> |
||||||
</Coupon-window> |
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose"> </Coupon-window> |
||||||
</view> |
</view> |
||||||
</view> |
</view> |
||||||
</template> |
</template> |
||||||
<script> |
<script> |
||||||
import { |
import { mapState, mapMutations, mapActions } from 'vuex' |
||||||
mapState, |
import GoodList from '@/components/GoodList' |
||||||
mapMutations, |
import PromotionGood from '@/components/PromotionGood' |
||||||
mapActions |
import CouponWindow from '@/components/CouponWindow' |
||||||
} from "vuex"; |
import Menu from '@/components/Menu' |
||||||
import GoodList from "@/components/GoodList"; |
import UniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar' |
||||||
import PromotionGood from "@/components/PromotionGood"; |
import Adv from '@/components/sh-adv' |
||||||
import CouponWindow from "@/components/CouponWindow"; |
import Groupon from '@/components/sh-groupon.vue' |
||||||
import Menu from "@/components/Menu"; |
|
||||||
import UniNoticeBar from "@/components/uni-notice-bar/uni-notice-bar"; |
|
||||||
import Adv from "@/components/sh-adv"; |
|
||||||
import Groupon from "@/components/sh-groupon.vue"; |
|
||||||
|
|
||||||
import Banner from "./components/Banner"; |
import Banner from './components/Banner' |
||||||
import HotCommodity from "./components/HotCommodity"; |
import HotCommodity from './components/HotCommodity' |
||||||
import FirstNewProduct from "./components/FirstNewProduct"; |
import FirstNewProduct from './components/FirstNewProduct' |
||||||
import ProductsRecommended from "./components/ProductsRecommended"; |
import ProductsRecommended from './components/ProductsRecommended' |
||||||
import Live from "./components/Live"; |
import Live from './components/Live' |
||||||
|
|
||||||
import { |
import { getHomeData, getShare, getCanvas } from '@/api/public' |
||||||
getHomeData, |
import cookie from '@/utils/store/cookie' |
||||||
getShare, |
import { isWeixin, handleUrlParam } from '@/utils/index' |
||||||
getCanvas |
|
||||||
} from "@/api/public"; |
|
||||||
import cookie from "@/utils/store/cookie"; |
|
||||||
import { |
|
||||||
isWeixin, |
|
||||||
handleUrlParam |
|
||||||
} from "@/utils/index"; |
|
||||||
|
|
||||||
import { |
import { openShareAll } from '@/libs/wechat' |
||||||
openShareAll, |
|
||||||
} from '@/libs/wechat' |
|
||||||
|
|
||||||
const HAS_COUPON_WINDOW = "has_coupon_window"; |
const HAS_COUPON_WINDOW = 'has_coupon_window' |
||||||
|
|
||||||
export default { |
export default { |
||||||
name: "Index", |
name: 'Index', |
||||||
components: { |
components: { |
||||||
// swiper, |
// swiper, |
||||||
// swiperSlide, |
// swiperSlide, |
||||||
UniNoticeBar, |
UniNoticeBar, |
||||||
GoodList, |
GoodList, |
||||||
PromotionGood, |
PromotionGood, |
||||||
CouponWindow, |
CouponWindow, |
||||||
Menu, |
Menu, |
||||||
Adv, |
Adv, |
||||||
Groupon, |
Groupon, |
||||||
Banner, |
Banner, |
||||||
HotCommodity, |
HotCommodity, |
||||||
FirstNewProduct, |
FirstNewProduct, |
||||||
ProductsRecommended, |
ProductsRecommended, |
||||||
Live, |
Live, |
||||||
}, |
}, |
||||||
props: {}, |
props: {}, |
||||||
data: function() { |
data: function() { |
||||||
return { |
return { |
||||||
homeData: [], |
homeData: [], |
||||||
CustomBar: this.CustomBar, |
CustomBar: this.CustomBar, |
||||||
StatusBar: this.StatusBar, |
StatusBar: this.StatusBar, |
||||||
formatMenus: [], |
formatMenus: [], |
||||||
categoryCurrent: 0, |
categoryCurrent: 0, |
||||||
menuNum: 4, |
menuNum: 4, |
||||||
bgcolor: "", |
bgcolor: '', |
||||||
bgColor: "", |
bgColor: '', |
||||||
swiperCurrent: 0, //轮播下标 |
swiperCurrent: 0, //轮播下标 |
||||||
webviewId: 0, |
webviewId: 0, |
||||||
showCoupon: false, |
showCoupon: false, |
||||||
logoUrl: "", |
logoUrl: '', |
||||||
banner: [], |
banner: [], |
||||||
menus: [], |
menus: [], |
||||||
combinationList: [], |
combinationList: [], |
||||||
roll: [], |
roll: [], |
||||||
activity: [], |
activity: [], |
||||||
activityOne: {}, |
activityOne: {}, |
||||||
bastList: [], |
bastList: [], |
||||||
firstList: [], |
firstList: [], |
||||||
info: { |
info: { |
||||||
fastList: [], |
fastList: [], |
||||||
bastBanner: [], |
bastBanner: [], |
||||||
|
|
||||||
bastList: [], |
bastList: [], |
||||||
}, |
}, |
||||||
likeInfo: [], |
likeInfo: [], |
||||||
live: [], |
live: [], |
||||||
lovely: [], |
lovely: [], |
||||||
benefit: [], |
benefit: [], |
||||||
couponList: [], |
couponList: [], |
||||||
swiperOption: { |
swiperOption: { |
||||||
pagination: { |
pagination: { |
||||||
el: ".swiper-pagination", |
el: '.swiper-pagination', |
||||||
clickable: true, |
clickable: true, |
||||||
}, |
}, |
||||||
autoplay: { |
autoplay: { |
||||||
disableOnInteraction: false, |
disableOnInteraction: false, |
||||||
delay: 2000, |
delay: 2000, |
||||||
}, |
}, |
||||||
loop: true, |
loop: true, |
||||||
speed: 1000, |
speed: 1000, |
||||||
observer: true, |
observer: true, |
||||||
observeParents: true, |
observeParents: true, |
||||||
}, |
}, |
||||||
swiperRoll: { |
swiperRoll: { |
||||||
direction: "vertical", |
direction: 'vertical', |
||||||
autoplay: { |
autoplay: { |
||||||
disableOnInteraction: false, |
disableOnInteraction: false, |
||||||
delay: 2000, |
delay: 2000, |
||||||
}, |
}, |
||||||
loop: true, |
loop: true, |
||||||
speed: 1000, |
speed: 1000, |
||||||
observer: true, |
observer: true, |
||||||
observeParents: true, |
observeParents: true, |
||||||
}, |
}, |
||||||
swiperScroll: { |
swiperScroll: { |
||||||
freeMode: true, |
freeMode: true, |
||||||
freeModeMomentum: false, |
freeModeMomentum: false, |
||||||
slidesPerView: "auto", |
slidesPerView: 'auto', |
||||||
observer: true, |
observer: true, |
||||||
observeParents: true, |
observeParents: true, |
||||||
}, |
}, |
||||||
swiperBoutique: { |
swiperBoutique: { |
||||||
pagination: { |
pagination: { |
||||||
el: ".swiper-pagination", |
el: '.swiper-pagination', |
||||||
clickable: true, |
clickable: true, |
||||||
}, |
}, |
||||||
autoplay: { |
autoplay: { |
||||||
disableOnInteraction: false, |
disableOnInteraction: false, |
||||||
delay: 2000, |
delay: 2000, |
||||||
}, |
}, |
||||||
loop: true, |
loop: true, |
||||||
speed: 1000, |
speed: 1000, |
||||||
observer: true, |
observer: true, |
||||||
observeParents: true, |
observeParents: true, |
||||||
}, |
}, |
||||||
swiperProducts: { |
swiperProducts: { |
||||||
freeMode: true, |
freeMode: true, |
||||||
freeModeMomentum: false, |
freeModeMomentum: false, |
||||||
slidesPerView: "auto", |
slidesPerView: 'auto', |
||||||
observer: true, |
observer: true, |
||||||
observeParents: true, |
observeParents: true, |
||||||
}, |
}, |
||||||
bgImage: "", |
bgImage: '', |
||||||
}; |
} |
||||||
}, |
}, |
||||||
computed: { |
computed: { |
||||||
singNew() { |
singNew() { |
||||||
return this.roll.length > 0 ? this.roll[0] : "你还没添加通知哦!"; |
return this.roll.length > 0 ? this.roll[0] : '你还没添加通知哦!' |
||||||
}, |
}, |
||||||
customStyle() { |
customStyle() { |
||||||
var bgImage = this.bgImage; |
var bgImage = this.bgImage |
||||||
// var style = `height:${this.CustomBar}px;padding-top:${0}px;background: ${this.bgcolor}`; |
// var style = `height:${this.CustomBar}px;padding-top:${0}px;background: ${this.bgcolor}`; |
||||||
var style = `height:${this.CustomBar}px;padding-top:${this.StatusBar}px;background: ${this.bgcolor}`; |
var style = `height:${this.CustomBar}px;padding-top:${this.StatusBar}px;background: ${this.bgcolor}` |
||||||
if (this.bgImage) { |
if (this.bgImage) { |
||||||
style = `${style}background-image:url(${bgImage});`; |
style = `${style}background-image:url(${bgImage});` |
||||||
} |
} |
||||||
return style; |
return style |
||||||
}, |
}, |
||||||
}, |
}, |
||||||
onLoad: function() { |
onLoad: function() { |
||||||
this.getLocation(); |
this.getLocation() |
||||||
let that = this; |
let that = this |
||||||
// uni.showLoading({ |
// uni.showLoading({ |
||||||
// title: "加载中", |
// title: "加载中", |
||||||
// }); |
// }); |
||||||
getCanvas().then(res => {}).catch(error => { |
getCanvas() |
||||||
this.homeData = JSON.parse(error.data.json) |
.then(res => {}) |
||||||
console.log(this.homeData) |
.catch(error => { |
||||||
console.log(222) |
this.homeData = JSON.parse(error.data.json) |
||||||
}) |
console.log(this.homeData) |
||||||
getHomeData().then((res) => { |
console.log(222) |
||||||
that.logoUrl = res.data.logoUrl; |
}) |
||||||
res.data.banner.map((item) => (item.bgcolor = item.color || "")); |
getHomeData().then(res => { |
||||||
that.$set(that, "info", res.data.info); |
that.logoUrl = res.data.logoUrl |
||||||
that.$set(that, "firstList", res.data.firstList); |
res.data.banner.map(item => (item.bgcolor = item.color || '')) |
||||||
that.$set(that, "bastList", res.data.bastList); |
that.$set(that, 'info', res.data.info) |
||||||
that.$set(that, "likeInfo", res.data.likeInfo); |
that.$set(that, 'firstList', res.data.firstList) |
||||||
that.$set(that, "live", res.data.liveList); |
that.$set(that, 'bastList', res.data.bastList) |
||||||
that.$set(that, "lovely", res.data.lovely); |
that.$set(that, 'likeInfo', res.data.likeInfo) |
||||||
that.$set(that, "benefit", res.data.benefit); |
that.$set(that, 'live', res.data.liveList) |
||||||
that.$set(that, "couponList", res.data.couponList); |
that.$set(that, 'lovely', res.data.lovely) |
||||||
that.$set(that, "combinationList", res.data.combinationList); |
that.$set(that, 'benefit', res.data.benefit) |
||||||
uni.hideLoading(); |
that.$set(that, 'couponList', res.data.couponList) |
||||||
that.setOpenShare(); |
that.$set(that, 'combinationList', res.data.combinationList) |
||||||
// that.doColorThief() |
uni.hideLoading() |
||||||
}); |
that.setOpenShare() |
||||||
}, |
// that.doColorThief() |
||||||
methods: { |
}) |
||||||
...mapActions(["getLocation"]), |
}, |
||||||
onShareTimeline: function() { |
methods: { |
||||||
return { |
...mapActions(['getLocation']), |
||||||
title: this.miniHomeRemark, |
onShareTimeline: function() { |
||||||
imageUrl: this.miniHomeImg, |
return { |
||||||
path: "pages/home/index?spread=" + uni.getStorageSync("uid"), |
title: this.miniHomeRemark, |
||||||
}; |
imageUrl: this.miniHomeImg, |
||||||
}, |
path: 'pages/home/index?spread=' + uni.getStorageSync('uid'), |
||||||
onShareAppMessage: function() { |
} |
||||||
return { |
}, |
||||||
title: this.miniHomeRemark, |
onShareAppMessage: function() { |
||||||
imageUrl: this.miniHomeImg, |
return { |
||||||
path: "pages/home/index?spread=" + uni.getStorageSync("uid"), |
title: this.miniHomeRemark, |
||||||
}; |
imageUrl: this.miniHomeImg, |
||||||
}, |
path: 'pages/home/index?spread=' + uni.getStorageSync('uid'), |
||||||
goRoll(item) { |
} |
||||||
if (item.uniapp_url) { |
}, |
||||||
this.$yrouter.push(item.uniapp_url); |
goRoll(item) { |
||||||
} |
if (item.uniapp_url) { |
||||||
}, |
this.$yrouter.push(item.uniapp_url) |
||||||
goGoodSearch() { |
} |
||||||
// this.$yrouter.push('/pages/shop/GoodsEvaluate/index'); |
}, |
||||||
this.$yrouter.push("/pages/shop/GoodSearch/index"); |
goGoodSearch() { |
||||||
}, |
// this.$yrouter.push('/pages/shop/GoodsEvaluate/index'); |
||||||
goWxappUrl(item) { |
this.$yrouter.push('/pages/shop/GoodSearch/index') |
||||||
this.$yrouter.push(item.uniapp_url); |
}, |
||||||
}, |
goWxappUrl(item) { |
||||||
goHotNewGoods(type) { |
this.$yrouter.push(item.uniapp_url) |
||||||
this.$yrouter.push({ |
}, |
||||||
path: "/pages/shop/HotNewGoods/index", |
goHotNewGoods(type) { |
||||||
query: { |
this.$yrouter.push({ |
||||||
type, |
path: '/pages/shop/HotNewGoods/index', |
||||||
}, |
query: { |
||||||
}); |
type, |
||||||
}, |
}, |
||||||
goGoodsCon(item) { |
}) |
||||||
this.$yrouter.push({ |
}, |
||||||
path: "/pages/shop/GoodsCon/index", |
goGoodsCon(item) { |
||||||
query: { |
this.$yrouter.push({ |
||||||
id: item.id, |
path: '/pages/shop/GoodsCon/index', |
||||||
}, |
query: { |
||||||
}); |
id: item.id, |
||||||
}, |
}, |
||||||
goGoodsPromotion() { |
}) |
||||||
this.$yrouter.push("/pages/shop/GoodsPromotion/index"); |
}, |
||||||
}, |
goGoodsPromotion() { |
||||||
setOpenShare: function() { |
this.$yrouter.push('/pages/shop/GoodsPromotion/index') |
||||||
if (this.$deviceType == "weixin") { |
}, |
||||||
getShare().then((res) => { |
setOpenShare: function() { |
||||||
var data = res.data.data; |
if (this.$deviceType == 'weixin') { |
||||||
var configAppMessage = { |
getShare().then(res => { |
||||||
desc: data.synopsis, |
var data = res.data.data |
||||||
title: data.title, |
var configAppMessage = { |
||||||
link: location.href, |
desc: data.synopsis, |
||||||
imgUrl: data.img, |
title: data.title, |
||||||
}; |
link: location.href, |
||||||
openShareAll(configAppMessage); |
imgUrl: data.img, |
||||||
}); |
} |
||||||
} |
openShareAll(configAppMessage) |
||||||
}, |
}) |
||||||
startQr: function() { |
} |
||||||
uni.scanCode({ |
}, |
||||||
success: (res) => { |
startQr: function() { |
||||||
let option = handleUrlParam(res.result); |
uni.scanCode({ |
||||||
switch (option.pageType) { |
success: res => { |
||||||
case "good": |
let option = handleUrlParam(res.result) |
||||||
// 跳转商品详情 |
switch (option.pageType) { |
||||||
this.$yrouter.push({ |
case 'good': |
||||||
path: "/pages/shop/GoodsCon/index", |
// 跳转商品详情 |
||||||
query: { |
this.$yrouter.push({ |
||||||
q: res.result, |
path: '/pages/shop/GoodsCon/index', |
||||||
}, |
query: { |
||||||
}); |
q: res.result, |
||||||
break; |
}, |
||||||
case "group": |
}) |
||||||
// 跳转团购 |
break |
||||||
this.$yrouter.push({ |
case 'group': |
||||||
path: "/pages/activity/GroupRule/index", |
// 跳转团购 |
||||||
query: { |
this.$yrouter.push({ |
||||||
q: res.result, |
path: '/pages/activity/GroupRule/index', |
||||||
}, |
query: { |
||||||
}); |
q: res.result, |
||||||
break; |
}, |
||||||
case "dargain": |
}) |
||||||
// 跳转砍价 |
break |
||||||
this.$yrouter.push({ |
case 'dargain': |
||||||
path: "/pages/activity/DargainDetails/index", |
// 跳转砍价 |
||||||
query: { |
this.$yrouter.push({ |
||||||
q: res.result, |
path: '/pages/activity/DargainDetails/index', |
||||||
}, |
query: { |
||||||
}); |
q: res.result, |
||||||
break; |
}, |
||||||
default: |
}) |
||||||
// 跳转分销 |
break |
||||||
this.$yrouter.push({ |
default: |
||||||
path: "/pages/Loading/index", |
// 跳转分销 |
||||||
query: {}, |
this.$yrouter.push({ |
||||||
}); |
path: '/pages/Loading/index', |
||||||
break; |
query: {}, |
||||||
} |
}) |
||||||
}, |
break |
||||||
}); |
} |
||||||
}, |
}, |
||||||
getbgcolor(e) { |
}) |
||||||
this.bgcolor = e; |
}, |
||||||
}, |
getbgcolor(e) { |
||||||
}, |
this.bgcolor = e |
||||||
created: async function() { |
}, |
||||||
// await this.doColorThief(); |
}, |
||||||
}, |
created: async function() { |
||||||
}; |
// await this.doColorThief(); |
||||||
|
}, |
||||||
|
} |
||||||
</script> |
</script> |
||||||
<style scoped lang="less"> |
<style scoped lang="less"> |
||||||
.content_box { |
.content_box { |
||||||
background: #f6f6f6; |
background: #f6f6f6; |
||||||
} |
} |
||||||
|
|
||||||
.index { |
.index { |
||||||
background-color: #f6f6f6; |
background-color: #f6f6f6; |
||||||
} |
} |
||||||
|
|
||||||
.swiper-item { |
.swiper-item { |
||||||
height: 100%; |
height: 100%; |
||||||
} |
} |
||||||
|
|
||||||
.fixed-header { |
.fixed-header { |
||||||
position: fixed; |
position: fixed; |
||||||
z-index: 99; |
z-index: 99; |
||||||
// #ifdef H5 |
// #ifdef H5 |
||||||
top: 88rpx; |
top: 88rpx; |
||||||
// #endif |
// #endif |
||||||
|
|
||||||
// #ifndef H5 |
// #ifndef H5 |
||||||
top: 0; |
top: 0; |
||||||
// #endif |
// #endif |
||||||
left: 0; |
left: 0; |
||||||
right: 0; |
right: 0; |
||||||
background: #fff; |
background: #fff; |
||||||
box-shadow: 0 0 20rpx -10rpx #aaa; |
box-shadow: 0 0 20rpx -10rpx #aaa; |
||||||
|
|
||||||
&+.fixed-header-box { |
& + .fixed-header-box { |
||||||
height: 98rpx; |
height: 98rpx; |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
.head_box { |
.head_box { |
||||||
width: 750rpx; |
width: 750rpx; |
||||||
// background: #fff; |
// background: #fff; |
||||||
transition: all linear 0.3s; |
transition: all linear 0.3s; |
||||||
|
|
||||||
/deep/.cuIcon-back { |
/deep/.cuIcon-back { |
||||||
display: none; |
display: none; |
||||||
} |
} |
||||||
|
|
||||||
.nav-title { |
.nav-title { |
||||||
font-size: 38rpx; |
font-size: 38rpx; |
||||||
font-family: PingFang SC; |
font-family: PingFang SC; |
||||||
font-weight: 500; |
font-weight: 500; |
||||||
color: #fff; |
color: #fff; |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
.cu-bar.fixed { |
.cu-bar.fixed { |
||||||
position: fixed; |
position: fixed; |
||||||
width: 100%; |
width: 100%; |
||||||
top: 0; |
top: 0; |
||||||
z-index: 1024; |
z-index: 1024; |
||||||
// box-shadow: 0 1upx 6upx rgba(0, 0, 0, 0.1); |
// box-shadow: 0 1upx 6upx rgba(0, 0, 0, 0.1); |
||||||
} |
} |
||||||
|
|
||||||
.cu-bar { |
.cu-bar { |
||||||
box-sizing: border-box; |
box-sizing: border-box; |
||||||
|
|
||||||
.index .header { |
.index .header { |
||||||
height: 64rpx; |
height: 64rpx; |
||||||
// width: 100%; |
// width: 100%; |
||||||
// padding: 0 30rpx; |
// padding: 0 30rpx; |
||||||
// box-sizing: border-box; |
// box-sizing: border-box; |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
.header-search { |
.header-search { |
||||||
transition: all linear 0.3s; |
transition: all linear 0.3s; |
||||||
} |
} |
||||||
|
|
||||||
.cu-bar .action { |
.cu-bar .action { |
||||||
display: -webkit-box; |
display: -webkit-box; |
||||||
display: -webkit-flex; |
display: -webkit-flex; |
||||||
display: flex; |
display: flex; |
||||||
align-items: center; |
align-items: center; |
||||||
height: 100%; |
height: 100%; |
||||||
max-height: 100%; |
max-height: 100%; |
||||||
|
|
||||||
&:first-child { |
&:first-child { |
||||||
margin-left: 15px; |
margin-left: 15px; |
||||||
font-size: 15px; |
font-size: 15px; |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
.home_content_box { |
.home_content_box { |
||||||
margin-top: -20rpx; |
margin-top: -20rpx; |
||||||
} |
} |
||||||
|
|
||||||
.head_box {} |
.head_box { |
||||||
|
} |
||||||
|
|
||||||
.nav-title { |
.nav-title { |
||||||
margin-left: 20rpx; |
margin-left: 20rpx; |
||||||
line-height: 40px; |
line-height: 40px; |
||||||
} |
} |
||||||
</style> |
</style> |
||||||
|
@ -1,200 +1,193 @@ |
|||||||
<template> |
<template> |
||||||
<view class="OrderCancellation"> |
<view class="OrderCancellation"> |
||||||
<view class="header"> |
<view class="header"> |
||||||
<image mode="aspectFit" :src="`${$VUE_APP_RESOURCES_URL}/images/writeOffBg.jpg`" @click="openQRCode" /> |
<image mode="aspectFit" :src="`${$VUE_APP_RESOURCES_URL}/images/writeOffBg.jpg`" @click="openQRCode" /> |
||||||
</view> |
</view> |
||||||
<view class="whiteBg"> |
<view class="whiteBg"> |
||||||
<view class="input"> |
<view class="input"> |
||||||
<input type="number" placeholder="0" v-model="verify_code" /> |
<input type="number" placeholder="0" v-model="verify_code" /> |
||||||
</view> |
</view> |
||||||
<view class="bnt" @click="storeCancellation">立即核销</view> |
<view class="bnt" @click="storeCancellation">立即核销</view> |
||||||
<view class="bnt" @click="openQRCode">扫码核销</view> |
<view class="bnt" v-if="$deviceType !== 'weixin'" @click="openQRCode">扫码核销</view> |
||||||
</view> |
</view> |
||||||
<!-- #ifndef H5 --> |
<!-- #ifndef H5 --> |
||||||
<!-- <view class="scan" v-if="iswechat"> |
<!-- <view class="scan" v-if="iswechat"> |
||||||
<image :src="`${$VUE_APP_RESOURCES_URL}/images/scan.gif`" @click="openQRCode" /> |
<image :src="`${$VUE_APP_RESOURCES_URL}/images/scan.gif`" @click="openQRCode" /> |
||||||
</view> --> |
</view> --> |
||||||
<!-- #endif --> |
<!-- #endif --> |
||||||
<WriteOff :iShidden="iShidden" :orderInfo="orderInfo" @cancel="cancel" @confirm="confirm"></WriteOff> |
<WriteOff :iShidden="iShidden" :orderInfo="orderInfo" @cancel="cancel" @confirm="confirm"></WriteOff> |
||||||
</view> |
</view> |
||||||
</template> |
</template> |
||||||
|
|
||||||
<script> |
<script> |
||||||
import WriteOff from "@/components/WriteOff"; |
import WriteOff from '@/components/WriteOff' |
||||||
import { |
import { isWeixin } from '@/utils' |
||||||
isWeixin |
// import { wechatEvevt } from "@/libs/wechat"; |
||||||
} from "@/utils"; |
import { orderVerific } from '@/api/order' |
||||||
// import { wechatEvevt } from "@/libs/wechat"; |
const NAME = 'OrderCancellation' |
||||||
import { |
|
||||||
orderVerific |
|
||||||
} from "@/api/order"; |
|
||||||
const NAME = "OrderCancellation"; |
|
||||||
|
|
||||||
export default { |
export default { |
||||||
name: NAME, |
name: NAME, |
||||||
components: { |
components: { |
||||||
WriteOff |
WriteOff, |
||||||
}, |
}, |
||||||
props: {}, |
props: {}, |
||||||
data: function() { |
data: function() { |
||||||
return { |
return { |
||||||
iShidden: true, |
iShidden: true, |
||||||
orderInfo: {}, |
orderInfo: {}, |
||||||
verify_code: "" |
verify_code: '', |
||||||
}; |
} |
||||||
}, |
}, |
||||||
mounted: function() {}, |
mounted: function() {}, |
||||||
methods: { |
methods: { |
||||||
cancel: function(res) { |
cancel: function(res) { |
||||||
this.iShidden = res; |
this.iShidden = res |
||||||
}, |
}, |
||||||
confirm: function() { |
confirm: function() { |
||||||
orderVerific(this.verify_code, 1) |
orderVerific(this.verify_code, 1) |
||||||
.then(res => { |
.then(res => { |
||||||
this.iShidden = true; |
this.iShidden = true |
||||||
this.verify_code = ""; |
this.verify_code = '' |
||||||
uni.showToast({ |
uni.showToast({ |
||||||
title: res.msg, |
title: res.msg, |
||||||
icon: "none", |
icon: 'none', |
||||||
duration: 2000 |
duration: 2000, |
||||||
}); |
}) |
||||||
}) |
}) |
||||||
.catch(err => { |
.catch(err => { |
||||||
uni.showToast({ |
uni.showToast({ |
||||||
title: err.msg || err.response.data.msg || err.response.data.message, |
title: err.msg || err.response.data.msg || err.response.data.message, |
||||||
icon: "none", |
icon: 'none', |
||||||
duration: 2000 |
duration: 2000, |
||||||
}); |
}) |
||||||
}); |
}) |
||||||
}, |
}, |
||||||
storeCancellation: function() { |
storeCancellation: function() { |
||||||
let ref = /[0-9]{12}/; |
let ref = /[0-9]{12}/ |
||||||
if (!this.verify_code) { |
if (!this.verify_code) { |
||||||
uni.showToast({ |
uni.showToast({ |
||||||
title: "请输入核销码", |
title: '请输入核销码', |
||||||
icon: "none", |
icon: 'none', |
||||||
duration: 2000 |
duration: 2000, |
||||||
}); |
}) |
||||||
return; |
return |
||||||
} |
} |
||||||
if (!ref.test(this.verify_code)) { |
if (!ref.test(this.verify_code)) { |
||||||
uni.showToast({ |
uni.showToast({ |
||||||
title: "请输入正确的核销码", |
title: '请输入正确的核销码', |
||||||
icon: "none", |
icon: 'none', |
||||||
duration: 2000 |
duration: 2000, |
||||||
}); |
}) |
||||||
return; |
return |
||||||
} |
} |
||||||
uni.showLoading({ |
uni.showLoading({ |
||||||
title: "查询中" |
title: '查询中', |
||||||
}); |
}) |
||||||
orderVerific(this.verify_code, 0) |
orderVerific(this.verify_code, 0) |
||||||
.then(res => { |
.then(res => { |
||||||
uni.hideLoading(); |
uni.hideLoading() |
||||||
this.orderInfo = res.data; |
this.orderInfo = res.data |
||||||
this.iShidden = false; |
this.iShidden = false |
||||||
uni.showToast({ |
uni.showToast({ |
||||||
title: res.msg, |
title: res.msg, |
||||||
icon: "success", |
icon: 'success', |
||||||
duration: 2000 |
duration: 2000, |
||||||
}); |
}) |
||||||
}) |
}) |
||||||
.catch(error => { |
.catch(error => { |
||||||
uni.hideLoading(); |
uni.hideLoading() |
||||||
uni.showToast({ |
uni.showToast({ |
||||||
title: error.msg || |
title: error.msg || error.response.data.msg || error.response.data.message, |
||||||
error.response.data.msg || |
icon: 'none', |
||||||
error.response.data.message, |
duration: 2000, |
||||||
icon: "none", |
}) |
||||||
duration: 2000 |
}) |
||||||
}); |
}, |
||||||
}); |
openQRCode: function() { |
||||||
}, |
let that = this |
||||||
openQRCode: function() { |
// 这里需要调用扫码功能 |
||||||
let that = this; |
uni.scanCode({ |
||||||
// 这里需要调用扫码功能 |
success: res => { |
||||||
uni.scanCode({ |
var result = res.result |
||||||
success: (res) => { |
if (result) { |
||||||
var result = res.result; |
that.verify_code = res.result |
||||||
if (result) { |
that.storeCancellation() |
||||||
that.verify_code = res.result; |
} else { |
||||||
that.storeCancellation(); |
uni.showToast({ |
||||||
} else { |
title: '没有扫描到什么!', |
||||||
uni.showToast({ |
icon: 'none', |
||||||
title: '没有扫描到什么!', |
duration: 2000, |
||||||
icon: "none", |
}) |
||||||
duration: 2000 |
} |
||||||
}); |
}, |
||||||
} |
}) |
||||||
} |
}, |
||||||
}) |
}, |
||||||
|
} |
||||||
} |
|
||||||
} |
|
||||||
}; |
|
||||||
</script> |
</script> |
||||||
|
|
||||||
<style scoped lang="less"> |
<style scoped lang="less"> |
||||||
.OrderCancellation .header { |
.OrderCancellation .header { |
||||||
width: 100%; |
width: 100%; |
||||||
height: 3 * 100rpx; |
height: 3 * 100rpx; |
||||||
background-size: 100% 100%; |
background-size: 100% 100%; |
||||||
|
|
||||||
image { |
image { |
||||||
width: 100%; |
width: 100%; |
||||||
height: 3 * 100rpx; |
height: 3 * 100rpx; |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
.OrderCancellation .whiteBg { |
.OrderCancellation .whiteBg { |
||||||
width: 6.9 * 100rpx; |
width: 6.9 * 100rpx; |
||||||
background-color: #fff; |
background-color: #fff; |
||||||
margin: -0.93 * 100rpx auto 0 auto; |
margin: -0.93 * 100rpx auto 0 auto; |
||||||
padding-top: 0.8 * 100rpx; |
padding-top: 0.8 * 100rpx; |
||||||
padding-bottom: 30rpx; |
padding-bottom: 30rpx; |
||||||
z-index: 20; |
z-index: 20; |
||||||
position: relative; |
position: relative; |
||||||
border-radius: 0.06 * 100rpx 0.06 * 100rpx 0 0; |
border-radius: 0.06 * 100rpx 0.06 * 100rpx 0 0; |
||||||
} |
} |
||||||
|
|
||||||
.OrderCancellation .whiteBg .input { |
.OrderCancellation .whiteBg .input { |
||||||
width: 5.8 * 100rpx; |
width: 5.8 * 100rpx; |
||||||
margin: 0 auto; |
margin: 0 auto; |
||||||
border-bottom: 0.01 * 100rpx solid #eee; |
border-bottom: 0.01 * 100rpx solid #eee; |
||||||
} |
} |
||||||
|
|
||||||
.OrderCancellation .whiteBg .input input { |
.OrderCancellation .whiteBg .input input { |
||||||
padding-bottom: 0.25 * 100rpx; |
padding-bottom: 0.25 * 100rpx; |
||||||
font-size: 0.6 * 100rpx; |
font-size: 0.6 * 100rpx; |
||||||
height: auto; |
height: auto; |
||||||
color: #282828; |
color: #282828; |
||||||
width: 100%; |
width: 100%; |
||||||
text-align: center; |
text-align: center; |
||||||
} |
} |
||||||
|
|
||||||
.OrderCancellation .whiteBg .bnt { |
.OrderCancellation .whiteBg .bnt { |
||||||
font-size: 0.32 * 100rpx; |
font-size: 0.32 * 100rpx; |
||||||
color: #fff; |
color: #fff; |
||||||
width: 5.8 * 100rpx; |
width: 5.8 * 100rpx; |
||||||
height: 0.86 * 100rpx; |
height: 0.86 * 100rpx; |
||||||
border-radius: 0.43 * 100rpx; |
border-radius: 0.43 * 100rpx; |
||||||
background-image: linear-gradient(to right, #eb3729 0%, #eb3729 100%); |
background-image: linear-gradient(to right, #eb3729 0%, #eb3729 100%); |
||||||
background-image: -webkit-linear-gradient(to right, #eb3729 0%, #eb3729 100%); |
background-image: -webkit-linear-gradient(to right, #eb3729 0%, #eb3729 100%); |
||||||
background-image: -moz-linear-gradient(to right, #eb3729 0%, #eb3729 100%); |
background-image: -moz-linear-gradient(to right, #eb3729 0%, #eb3729 100%); |
||||||
text-align: center; |
text-align: center; |
||||||
line-height: 0.86 * 100rpx; |
line-height: 0.86 * 100rpx; |
||||||
margin: 0.55 * 100rpx auto 0 auto; |
margin: 0.55 * 100rpx auto 0 auto; |
||||||
} |
} |
||||||
|
|
||||||
.OrderCancellation .scan { |
.OrderCancellation .scan { |
||||||
width: 3 * 100rpx; |
width: 3 * 100rpx; |
||||||
height: 3 * 100rpx; |
height: 3 * 100rpx; |
||||||
margin: 1.1 * 100rpx auto 0 auto; |
margin: 1.1 * 100rpx auto 0 auto; |
||||||
} |
} |
||||||
|
|
||||||
.OrderCancellation .scan image { |
.OrderCancellation .scan image { |
||||||
width: 100%; |
width: 100%; |
||||||
height: 100%; |
height: 100%; |
||||||
display: block; |
display: block; |
||||||
} |
} |
||||||
</style> |
</style> |
||||||
|
Loading…
Reference in new issue