This commit is contained in:
whitechiina 2025-03-28 14:06:25 +08:00
commit 361f444663
10278 changed files with 823067 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
unpackage

24
.hbuilderx/launch.json Normal file
View File

@ -0,0 +1,24 @@
{ // launch.json configurations app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtypelocalremote, localremote
"version": "0.0",
"configurations": [{
"app-plus" :
{
"launchtype" : "local"
},
"default" :
{
"launchtype" : "local"
},
"h5" :
{
"launchtype" : "local"
},
"mp-weixin" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
]
}

238
App.vue Normal file
View File

@ -0,0 +1,238 @@
<script>
let uri = require('urijs');
/**
* 用来处理从小程序拿到的参数
* */
function getUrlParams(url) {
try {
// ?
let urlStr = url.split('?')[1]
//
let obj = {};
// &
let paramsArr = urlStr.split('&')
for (let i = 0, len = paramsArr.length; i < len; i++) {
// = key:value
let arr = paramsArr[i].split('=')
obj[arr[0]] = arr[1];
}
return obj
} catch {
return false
}
}
import store from '@/store/index';
export default {
globalData: {
// FPT
urlfileName:'https://jc.agrimedia.cn/discountt',
// parameters: {
// isWechat: true,
// token: "123456",
// cityInfor:{
// city: "",
// lat: '39.093471137152775',
// lon: '117.12767279730903',
// }
// },
parameters: {}
},
onLaunch: function(parameters = {}) {
console.log(navigator.userAgent,'userAgent');
// scriptwxjs
var script = document.createElement('script');
script.src = "https://res.wx.qq.com/open/js/jweixin-1.6.0.js";
document.body.appendChild(script);
//
let basurl = uri(decodeURIComponent(window.location.href))
let querys = basurl.query(true);
console.log(querys,'querys');
if(Object.keys(querys)['length'] > 0){
if(querys?.para){
// URL
var _para = getUrlParams(window.location.href);
console.log(_para,'_para');
// ,
if(_para?.brand_id && typeof _para['brand_id'] != 'undefined' && typeof _para['brand_id'] != undefined && _para?.brand_name && typeof _para['brand_name'] != 'undefined' && typeof _para['brand_name'] != undefined){
store.commit('shopping/SETBRANDINFOR', { brand_id: _para['brand_id'], brand_name:decodeURIComponent(_para['brand_name'])});
};
//
if (typeof _para == 'object' && _para['para'] != undefined) {
console.log('存在参数');
// URL
var URLpara = decodeURIComponent(getUrlParams(window.location.href)['para']);
console.log(JSON.parse(URLpara),'*****');
try{
// URLJSON#/使JSON.parse#/
var _r = URLpara.substr(0, URLpara.lastIndexOf("#/"));
this['globalData']['parameters'] = JSON.parse(`${_r}`);
}catch(e){
this['globalData']['parameters'] = JSON.parse(URLpara);
//TODO handle the exception
}
//
console.log(this['globalData']['parameters'],'----');
//
const other = JSON.parse(JSON.stringify(_para,(key,val)=>{
if(key === 'para') return undefined;
return val;
}))
this['globalData']['parameters'] = {...this['globalData']['parameters'],...other};
} else {
console.log('没有参数')
}
console.log(JSON.stringify(this['globalData']['parameters'],null,10), 'App Launch');
}else{
for(let key in querys){
console.log(querys);
querys[key] = JSON.parse(querys[key])
};
this['globalData']['parameters'] = { ...querys['userinfor'], ...querys['query'], timestamp:querys['timestamp']}
// ,
if(this['globalData']['parameters']?.brand_id && typeof this['globalData']['parameters']['brand_id'] != 'undefined' && typeof this['globalData']['parameters']['brand_id'] != undefined && this['globalData']['parameters']?.brand_name && typeof this['globalData']['parameters']['brand_name'] != 'undefined' && typeof this['globalData']['parameters']['brand_name'] != undefined){
store.commit('shopping/SETBRANDINFOR', { brand_id: this['globalData']['parameters']['brand_id'], brand_name:decodeURIComponent(this['globalData']['parameters']['brand_name'])});
};
}
};
console.log(this['globalData']['parameters'],'测试取参');
return;
// H5
/**
* 小程序进入H5会携带从小程序中获取到的部分参数(利用encodeURIComponent函数编码,所以接收是需要decodeURIComponent函数解码)
* {
* token
* isWechat
* lat
* lon
* city
* }
*
* */
//
// if (parameters['query']?.para)
// this['globalData']['parameters'] = JSON.parse(decodeURIComponent(parameters['query']['para']));
// console.log(this['globalData']['parameters'], 'globalData');
},
onShow: function() {
console.log('App Show');
// isWechat
if (this['globalData']['parameters']?.isWechat) {
store.commit('SetcityInfor', this['globalData']['parameters']['cityInfor']);
} else {
// APPH5
/**
* @获取用户位置信息
*/
// APP,API-getLocation
// IOSSafari,SafarigetLocation
let isSafari = (/Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent));
console.log(isSafari, 'isSafari');
if (isSafari) return;
if (process.env.NODE_ENV !== 'development' && !this['globalData']['parameters']['isWechat']) {
getLocation().then(res => {
console.log(res, 'res');
store.commit('SetcityInfor', res);
});
}
}
},
onHide: function() {
console.log('App Hide')
},
}
</script>
<style lang="scss">
@import 'uview-ui/theme.scss';
@import "@/static/css/flex.css";
@import "@/static/css/themeColor.scss";
@import "@/static/css/icon/iconfont.css";
*::-webkit-scrollbar {
display: none;
}
*::-webkit-scrollbar-horizontal {
display: none;
}
/*每个页面公共css */
page {
width: 100%;
height: auto;
min-height: 100%;
position: relative;
}
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
image {
width: 100%;
height: 100%;
}
uni-button:after {
border: none !important;
}
//
.default {
margin: auto;
color: #999999;
font-size: $FONTSIZE28;
display: flex;
flex-direction: column;
align-items: center;
margin-top: 150rpx;
.img {
width: 160rpx;
height: 132rpx;
margin-bottom: 15rpx;
}
}
@keyframes move {
/* 开始状态 */
0% {
background-color: #f1f2f4;
};
50%{
background-color: #E0E0E0;
}
/* 结束状态 */
100% {
background-color: #f1f2f4;
}
}
.skeleton {
width: 200rpx;
height: 200rpx;
animation-name: move;
animation-duration: 0.5s;
}
/* 适配 iPhoneX */
@supports (bottom: constant(safe-area-inset-bottom)) or (bottom: env(safe-area-inset-bottom)) {
.mescroll-safearea {
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
}
</style>

View File

@ -0,0 +1,81 @@
<template>
<view class="banner">
<view class="swiper_wrap">
<swiper class='swiper' @change="e => currentNum = e.detail.current" :indicator-dots='false' :autoplay='true' interval='3000' duration='300' width="100%" height="350rpx"
circular="true">
<block v-for='(item,index) in imageList' :key="index">
<swiper-item>
<view class='exp__list'>
<image :lazy-load="true" class="swiper_img" :src="item"></image>
</view>
</swiper-item>
</block>
</swiper>
</view>
<view class="indicator-num">
<text class="indicator-num__text">{{imageList.length==0?'0':currentNum+1}}/{{imageList.length}}</text>
</view>
</view>
</template>
<script>
export default {
name:"Banner",
props:{
imageList:Array,
},
data() {
return {
currentNum:0
};
},
methods:{
getVal(e){
this.$emit('getVal',e)
}
}
}
</script>
<style lang="scss" scoped>
.banner{
position: relative;
// background-color: #000;
border-radius: 20rpx;
.banner_image{
width: 100%;
height: 350rpx;
}
.indicator-num{
position: absolute;
bottom:20rpx;
right: 20rpx;
.indicator-num__text{
font-size: 24rpx;
color: #fff;
padding:6rpx 20rpx;
background: rgba(0, 0, 0,0.4);
border-radius: 60rpx;
}
}
.swiper-items{
height: 350rpx;
image{
height: 350rpx;
display: block;
}
}
.swiper{
height: 350rpx;
width: 100%;
}
.swiper_img{
width: 100%;
height: 350rpx;
border-radius: 10rpx;
}
}
</style>

View File

@ -0,0 +1,121 @@
<template>
<u-popup :show="MonthDayShow" :round="10" mode="bottom" closeOnClickOverlay @close="cancel">
<view style="width: 100%;height: 500rpx;">
<view class="btn">
<view class="cancel" @click="cancel">
取消
</view>
<view class="confirm" @click="confirm">
确认
</view>
</view>
<picker-view :indicator-style="indicatorStyle" :value="value" class="picker-view"
@change="bindChange">
<picker-view-column>
<view class="item" v-for="(item,index) in months" :key="index">{{item}}</view>
</picker-view-column>
<picker-view-column>
<view class="item" v-for="(item,index) in days" :key="index">{{item}}</view>
</picker-view-column>
</picker-view>
</view>
</u-popup>
</template>
<script>
function repair(t){
if(t <= 9){
return `0${t}`
}else{
return t
}
}
export default {
name: "Month-Day-picker",
props:{
show:{
type:Boolean,
default:false,
}
},
data() {
//
const month = new Date().getMonth() + 1;
//
const months = [];
//
const day = new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0).getDate();
//
const days = [];
//
let cday = new Date().getDate();
for (let i = 1; i <= 12; i++) {
months.push(i)
}
for (let i = 1; i <= day; i++) {
days.push(i)
}
return {
month,
cday,
months,
days,
indicatorStyle: `height: 50px;`,
value:[month-1,cday-1],
valuelist:[month,cday]
};
},
computed:{
MonthDayShow(){
return this['show']
}
},
methods:{
//
cancel(){
this.$emit('cancel')
},
//
confirm(){
this['valuelist'] = [new Date().getFullYear(),repair(this['value'][0]+1),repair(this['value'][1]+1)];
this.$emit('confirm',this['valuelist'])
},
//
bindChange(value){
this['value'] = [value['detail']['value'][0],value['detail']['value'][1]];
}
}
}
</script>
<style lang="scss">
.btn {
height: 100rpx;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 24rpx;
padding: 0 32rpx;
.cancel,.confirm{
padding: 32rpx;
}
.confirm {
color: #FF4F04;
}
}
.picker-view {
width: 100%;
height: 400rpx;
margin-top: 20rpx;
}
.item {
height: 50px;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
</style>

View File

@ -0,0 +1,97 @@
<template>
<view class="OrderStatus">
<!-- 待结算 -->
<view class="un_commission_count" :class="{activation:lastCLick === uncommission?true:false}" @tap="switchClick(uncommission)">
待结算{{un_commission_count}}
</view>
<!-- 已结算 -->
<view class="commission_count" :class="{activation:lastCLick === commission?true:false}" @tap="switchClick(commission)">
已结算{{commission_count}}
</view>
</view>
</template>
<script>
/**
* 订单列表顶部筛选组件
* @param {type} uncommission //
* @param {type} commission //
* @param {type} un_commission_count //
* @param {type} commission_count //
* */
export default {
name: "OrderStatus",
props:{
un_commission_count:{
type:Number,
default:0
},
commission_count:{
type:Number,
default:0
},
uncommission:{
type:Number,
default:0
},
commission:{
type:Number,
default:1
}
},
computed:{
//
// uncommissioncount(){
// return this['un_commission_count']
// },
//
// commissioncount(){
// return this['commission_count']
// }
},
data() {
return {
// un_commission_count:0,
// commission_count:0,
//
lastCLick:'',
//
// thisCLick:'',
};
},
methods:{
//
switchClick(type){
let _type = '';
if(this['lastCLick'] !== type) _type = type;
this['lastCLick'] = _type;
this.$emit('commission',_type)
}
}
}
</script>
<style lang="scss">
.OrderStatus {
width: 100%;
margin: 32rpx 0;
display: flex;
justify-content:space-between;
.un_commission_count,.commission_count{
width: 46%;
height: 120rpx;
border: 2rpx solid rgba(253,143,59,0.2);
border-radius: 15rpx;
color: #fd8f3b;
font-size: 28rpx;
text-align: center;
line-height: 120rpx;
}
.activation{
background-color: #fd8f3b;
border: none !important;
color: #FFFFFF;
}
}
</style>

View File

@ -0,0 +1,123 @@
<template>
<view class="bm-Address" @tap="choice">
<view class="bm-Address-UserInfor">
<view class="bm-Address-UserInfor-name">
{{item['name']}}
</view>
<view class="bm-Address-UserInfor-phone">
{{setphone}}
</view>
<view class="defaults" v-if="item['is_default']">
默认
</view>
<!-- <view class="residence">
</view> -->
<!-- <view class="company">
公司
</view> -->
</view>
<view class="bm-Address-Infor">
<view class="bm-Address-Infor-Area">
{{item['region']}}-{{item['address']}}
</view>
<view class="bm-Address-Infor-edit" @tap.stop="editClick">
<image class="img" src="https://img.agrimedia.cn/chwl/diy/edit.png"></image>
</view>
</view>
</view>
</template>
<script>
export default {
name:"add-address",
props:{
item:{
type:Object,
default:()=>{}
}
},
data() {
return {
};
},
computed:{
setphone(){
let str = this['item']['mobile'];
str = str.replace(str.slice(3,7),"****")
return str;
}
},
methods:{
//
choice(){
this.$emit('choice',this['item'])
},
//
editClick(){
uni.navigateTo({
url:`/pages/diy/addposition/addposition?add_id=${this['item']['add_id']}`
})
}
}
}
</script>
<style lang="scss">
.bm-Address{
padding: 32rpx;
background-color: #ffffff;
margin-bottom: 32rpx;
&-UserInfor{
display: flex;
align-items: center;
font-size: 28rpx;
margin-bottom: 24rpx;
&-name{
min-width: 150rpx;
}
&-phone{
margin-right: 15rpx;
}
.defaults,.residence,.company{
color: #ffffff;
text-align: center;
padding: 5rpx 10rpx;
margin: 0 15rpx;
border-radius: 7rpx;
border: none;
overflow: hidden;
}
//
.defaults{
background-color: #FD8F3B;
}
//
.residence{
background-color: #3191fd;
}
//
.company{
background-color: #bde577;
}
}
&-Infor{
display: flex;
justify-content:space-between;
&-Area{
font-size: 28rpx;
max-width: 630rpx;
min-width: 630rpx;
}
&-edit{
.img{
width: 30rpx;
height: 30rpx;
}
}
}
}
</style>

View File

@ -0,0 +1,188 @@
<template>
<view class="UserInfor" v-show="GetStep">
<!-- 用户信息 -->
<u-modal :show="true" :title="title" confirmText="授权" cancelText="暂不" showCancelButton @confirm="confirm">
<template v-slot:confirmButton>
<view class="btn">
<view class="btn-item" @tap="SetStep(0)">
暂不
</view>
<view class="btn-item" v-if="GetStep == 1" @tap="getUserInfo">
同步个人信息
</view>
<view class="btn-item" v-if="GetStep == 2">
<button class="openbtn" open-type="getPhoneNumber" @getphonenumber="getUserInfo">同步手机号</button>
</view>
</view>
</template>
</u-modal>
</view>
</template>
<script>
/**
* @仿微信授权个人信息弹框
* */
import {
mapGetters,
mapMutations,
mapActions,
} from 'vuex';
export default {
name: "authorization-userinfor",
data() {
return {
};
},
methods: {
...mapMutations('api', ['SetStep']),
...mapActions('api', ['againAuth', 'alipayagainAuth', 'savePhone']),
/**
* @点击确认授权用户信息
* */
getUserInfo(e) {
let self = this;
//
if (this['GetStep'] == 1) {
//
// #ifdef MP-WEIXIN
//
uni.getUserProfile({
desc: '用于完善会员资料',
success(res) {
// code
uni.login({
provider: 'weixin',
success(loginRes) {
console.log('code', loginRes.code);
uni.showLoading({
title: '同步中...'
});
//
self.againAuth({
rawData: res.rawData,
code: loginRes.code
}).then(res => {
self.SetStep(2);
uni.hideLoading();
}).catch(res => {
uni.hideLoading();
})
}
})
},
fail(e) {
console.log(e)
self.SetStep(0);
}
});
// #endif
//
// #ifdef MP-ALIPAY
my.getAuthCode({
scopes: 'auth_user',
success: (res) => {
my.alert({
content: res.authCode,
});
self.alipayagainAuth({
auth_code: res.authCode
})
},
});
// #endif
} else {
let encryptedData = e.detail.encryptedData;
let iv = e.detail.iv;
console.log(e,'-----------------');
if (e.detail.errMsg === 'getPhoneNumber:fail user deny') return;
uni.login({
provider: 'weixin',
success: res => {
uni.showLoading({
title: '同步中...'
});
self.savePhone({
iv: iv,
encryptedData: encryptedData,
code: res.code,
}).then(res => {
uni.hideLoading();
self.SetStep(0);
}).catch(res => {
uni.hideLoading();
uni.showToast({
title:res['msg'],
icon:'none'
})
})
},
fail:()=>{
}
})
}
}
},
computed: {
...mapGetters('api', ['GetStep']),
title() {
switch (this['GetStep']) {
case 1:
return '您需要授权个人信息';
case 2:
return '您需要授权手机号';
}
}
},
}
</script>
<style lang="scss">
.UserInfor {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 99999;
}
.btn {
width: 100%;
height: 88rpx;
display: flex;
justify-content: space-between;
}
.btn-item {
text-align: center;
line-height: 88rpx;
width: 50%;
height: 100%;
font-size: 30rpx;
font-weight: 800;
position: relative;
}
.openbtn {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: transparent;
font-size: 30rpx;
&::after {
border: none !important;
}
}
</style>

View File

@ -0,0 +1,46 @@
<template>
<view class="b-Bottom-Fit" :class="[Class]"></view>
</template>
<script>
export default {
name: "b-Bottom-Fit",
data() {
return {
// Class: ''
};
},
computed:{
Class(){
//
let system = uni.getSystemInfoSync();
console.log(system.platform, '设备类型');
if (system.platform === 'android') {
return 'Android';
} else if (system.platform === 'ios') {
return 'IOS';
}
}
},
mounted() {
}
}
</script>
<style lang="scss">
.b-Bottom-Fit {
width: 100%;
}
.Android {
padding-bottom: 32rpx;
box-sizing: content-box;
}
.IOS {
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: calc(env(safe-area-inset-bottom));
box-sizing: content-box;
}
</style>

View File

@ -0,0 +1,96 @@
<template>
<view class="b-Collection">
<!-- 时间 -->
<view class="b-Collection-Date">
{{data['date']}}
</view>
<!-- 收款/应结算 -->
<view class="b-Collection-row-A">
<view class="row-Item">
<view class="row-Item-Label">
收款
</view>
<view class="row-Item-Value">
{{RetainDecimalPoint(data['total_mount'])}}
</view>
</view>
<view class="row-Item">
<view class="row-Item-Label">
应结算
</view>
<view class="row-Item-Value">
{{RetainDecimalPoint(data['total_split_amount'])}}
</view>
</view>
</view>
<!-- 未入账/已入账 -->
<view class="b-Collection-row-B">
<view class="row-Item">
<view class="row-Item-Label">
未入账
</view>
<view class="row-Item-Value">
{{RetainDecimalPoint(data['un_entry'])}}
</view>
</view>
<view class="row-Item">
<view class="row-Item-Label">
已入账
</view>
<view class="row-Item-Value">
{{RetainDecimalPoint(data['entry'])}}
</view>
</view>
</view>
</view>
</template>
<script>
import mixin from '@/static/js/mixin.js'
export default {
mixins: [mixin],
name: "b-Collection",
props: {
data: {
type: Object,
default: () => {}
}
},
data() {
return {
};
}
}
</script>
<style lang="scss">
.b-Collection {
margin-bottom: 40rpx;
&-Date {
line-height: 60rpx;
color: #666666;
font-size: 22rpx;
line-height: 60rpx;
}
.b-Collection-row-A,
.b-Collection-row-B {
display: flex;
justify-content: space-between;
.row-Item {
display: flex;
font-size: 30rpx;
&-Label {
max-width: 120rpx;
min-width: 120rpx;
}
&-Label {}
}
}
}
</style>

View File

@ -0,0 +1,108 @@
<template>
<view class="Datetime-Picker">
<view class="Choose-Input" @tap="show = true">
{{date}}
<view class="arrow"></view>
</view>
<!-- 年月选择组件 -->
<u-datetime-picker ref="datetimePicker" :minDate="GetUserInfor['store_join_time'] * 1000"
:maxDate="new Date().getTime()" @cancel="show = false" :show="show" @confirm="confirm" v-model="value"
mode="year-month">
</u-datetime-picker>
</view>
</template>
<script>
import mixin from '@/static/js/mixin.js'
export default {
mixins: [mixin],
name: "Datetime-Picker",
data() {
return {
value: Number(new Date()),
show: false,
date: ''
};
},
mounted() {
this.DataConvert(new Date().getTime());
// console.log(this['GetUserInfor']['store_join_time'], 'GetUserInfor');
},
methods: {
/**
* @日期选择点击确认时触发事件
* */
confirm(e) {
this['show'] = false;
this.DataConvert(e['value']);
},
/**
* @将时间戳转为年月
* @param {number} t 要转换的时间戳
* @param {number} bit 是否需要将十位时间戳转为13位
* */
DataConvert(t, bit = false) {
if (bit) {
// ,
t = t * 1000;
};
let d = new Date(t);
let y = d.getFullYear();
let m = d.getMonth() + 1;
this['date'] = `${y}${m}`;
// console.log(t);
this.$emit('Change', Math.ceil(t / 1000));
}
}
}
</script>
<style lang="scss">
.Datetime-Picker {
padding: 10rpx 55rpx 10rpx 32rpx;
border: 1rpx solid #DEDEDE;
box-sizing: border-box;
border-radius: 15rpx;
position: relative;
.arrow {
position: absolute;
width: 40rpx;
height: 100%;
right: 10rpx;
top: 0;
&::after {
content: '';
position: absolute;
left: 50%;
bottom: 10%;
transform: translateX(-50%);
display: block;
margin: 0 auto;
width: 0;
height: 0;
border: 10rpx solid transparent;
border-top-color: #DEDEDE;
}
&::before {
content: '';
position: absolute;
left: 50%;
top: 10%;
transform: translateX(-50%);
display: block;
margin: 0 auto;
width: 0;
height: 0;
border: 10rpx solid transparent;
border-bottom-color: #DEDEDE;
}
}
}
</style>

View File

@ -0,0 +1,76 @@
<template>
<view class="b-GroupBuy" @tap="Details">
<!-- 时间 -->
<view class="b-GroupBuy-Date">
{{data['date']}}
</view>
<!-- 单子数量 -->
<view class="b-GroupBuy-Quantity">
{{data['order_num']}}
</view>
<view class="b-GroupBuy-Amount">
{{RetainDecimalPoint(data['total_mount'])}}
<text class="icon iconfont icon-youjiantou"></text>
</view>
</view>
</template>
<script>
import mixin from '@/static/js/mixin.js'
export default {
name: "b-GroupBuy",
mixins: [mixin],
props: {
data: {
type: Object,
default: -1
}
},
data() {
return {
};
},
methods: {
Details() {
//
let t = new Date(this['data']['date']).getTime() / 1000;
uni.navigateTo({
url: `/b_client/AccountDetails/AccountDetails?date=${this['data']['date']}`
})
}
}
}
</script>
<style lang="scss">
.b-GroupBuy {
position: relative;
margin-bottom: 40rpx;
&-Date {
color: #666666;
font-size: 22rpx;
line-height: 60rpx;
}
&-Quantity {
line-height: 60rpx;
font-size: 24rpx;
}
&-Amount {
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
line-height: 60rpx;
font-size: 24rpx;
.icon {
font-size: 30rpx !important;
margin-left: 20rpx !important;
}
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,69 @@
<template>
<view class="b-Store">
<template v-for="(item,index) in storeList">
<view class="b-Store-Item" :key="index" @tap="Pagego(index,item)">
<image class="img" :src="item['img_url']"></image>
</view>
</template>
</view>
</template>
<script>
import {
GetBrandListAPI
} from '@/common/api/restaurant.js';
import { mapMutations } from 'vuex'
export default {
name: "b-Store",
data() {
return {
storeList: [],
};
},
mounted() {
this.GetList()
},
methods: {
...mapMutations({
SETBRANDINFOR:'shopping/SETBRANDINFOR'
}),
Pagego(index,item) {
if(!item['url'] || !item['brand_status']) return;
//
// this.SETBRANDINFOR(item)
uni.navigateTo({
url: `/pages${item['url']}`
})
},
/**
* @获取品牌列表
* */
GetList() {
GetBrandListAPI().then(data => {
this['storeList'] = data;
})
}
}
}
</script>
<style lang="scss">
.b-Store {
padding: 32rpx;
box-sizing: border-box;
.b-Store-Item {
width: 100%;
height: 232rpx;
border-radius: 15rpx;
color: #ffffff;
margin-bottom: 20rpx;
.img {
width: 100%;
height: 100%;
}
}
}
</style>

View File

@ -0,0 +1,166 @@
<template>
<view class="b-load" :style="[Style]" v-show="display">
<view class="b-load-content">
<view class="b-load-content-Img">
<image :src="LoadImg" mode="" :style="[ImgStyle]"></image>
</view>
<view class="b-load-content-text" :style="[TextStyle]">
{{LoadText}}
</view>
</view>
</view>
</template>
<script>
/**
* 点餐加载组件
* @property { Boolean } show 组件显示
* @property { String } position 加载组件的定位对应css中的定位属性值为absolute时组件父元素必须是relative
* @property { String } background 加载组件的背景色16进的或者rgba都可以
* @property { String } img 组件加载中图片
* @property { String } type 加载组件类型
* @property { String } color 提示文字颜色
*/
// load
// close
// orders
// store
import props from './prop.js';
import mixin from '@/static/js/mixin/mixin.js'
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js'
export default {
mixins: [props, mixin, restaurantmixins],
name: "b-load",
data() {
return {
};
},
computed: {
display() {
console.log('组件状态');
return this['show']
},
GetType() {
return this['type']
},
Style() {
let style = {};
style['position'] = this['position'];
style['background-color'] = this['background'];
//
if (typeof this['zIndex'] == 'string' && !isNaN(+this['zIndex']) || typeof this['zIndex'] == 'number') {
style['z-index'] = this['zIndex'];
};
// if(typeof this['zindex'] == 'string' && this['zindex'] == 'none'){
// }
return style;
},
ImgStyle() {
return {
width: `${this['width']}rpx`,
height: `${this['height']}rpx`
}
},
TextStyle() {
return {
color: this['color']
};
},
LoadText() {
if (this['text'] != '') {
return this['text'];
}
//
if (this['GetType'] == 'load') {
return '加载中,请稍后'
} else if (this['GetType'] == 'close') {
//
return '抱歉,该门店已打烊'
} else if (this['GetType'] == 'orders') {
//
return '您还没有小食订单 '
} else if (this['GetType'] == 'store') {
//
return '该地区暂无门店信息'
}
},
LoadImg() {
if (this['img'] != '') {
return this['img'];
}
//
if (this['GetType'] == 'load') {
if (this['BrandInfor']['brand_id'] == 1) {
return this.qnyurl('kdjload.png');
} else if (this['BrandInfor']['brand_id'] == 10) {
return this.qnyurl('load.gif', 'xbk');
} else if (this['BrandInfor']['brand_id'] == 13) {
return this.qnyurl('load.png', 'rx');
} else if (this['BrandInfor']['brand_id'] == 5) {
return this.qnyurl('load.png?', 'mdl');
} else if (this['BrandInfor']['brand_id'] == 19) {
return this.qnyurl('load.png?', 'dyp');
}else if (this['BrandInfor']['brand_id'] == 2) {
// return this.qnyurl('load.png', 'nx');
}
} else if (this['GetType'] == 'close') {
//
if (this['BrandInfor']['brand_id'] == 2) {
return this.qnyurl('closureimg.png','nx');
}
return this.qnyurl('closureimg.png', 'rx');
} else if (this['GetType'] == 'orders') {
if (this['BrandInfor']['brand_id'] == 2) {
return this.qnyurl('orderno.png','nx');
}
return this.qnyurl('orderno.png', 'rx');
//
// if (this['BrandInfor']['brand_id'] == 13) {
// return this.qnyurl('orderno.png', 'rx');
// } else if (this['BrandInfor']['brand_id'] == 13) {
// return this.qnyurl('orderno.png', 'rx');
// } else if (this['BrandInfor']['brand_id'] == 13) {
// return this.qnyurl('orderno.png', 'rx');
// } else if (this['BrandInfor']['brand_id'] == 13) {
// return this.qnyurl('orderno.png', 'rx');
// }
} else if (this['GetType'] == 'store') {
//
if (this['BrandInfor']['brand_id'] == 2) {
return this.qnyurl('closureimg.png','nx');
}
return this.qnyurl('default.png', 'rx');
}
},
}
}
</script>
<style lang="scss">
.b-load {
width: 100%;
height: 100%;
left: 0;
top: 0;
&-content {
width: 100%;
height: 100%;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
&-text {
margin-top: 34rpx;
font-size: 28rpx;
}
}
}
</style>

45
components/b-load/prop.js Normal file
View File

@ -0,0 +1,45 @@
export default {
props: {
img: {
type: String,
default: ''
},
text: {
type: String,
default: ''
},
show: {
type: Boolean,
default: false
},
position: {
type: String,
default: 'fixed'
},
background: {
type: String,
default: '#FFFFFF'
},
width: {
type: String,
default: ''
},
height: {
type: String,
default: ''
},
type: {
type: String,
default: 'load'
},
color: {
type: String,
default: '#FFFFFF'
},
zIndex: {
type:[Number,String],
default:10
}
}
}

View File

@ -0,0 +1,533 @@
<template>
<view class="b-nx-sku-popup">
<u-popup :show="show" @close="show = false" round="20" closeable zIndex="20080">
<view class="commodity-sku">
<!-- 商品图 -->
<view class="commodity-sku-cover">
<!-- 封面 -->
<image class="img" :src="skuinfor['product_img']" mode="widthFix"></image>
<!-- 名称-数量 -->
<view class="commodity-sku-cover-name">
<view class="commodity-sku-cover-name-title" :style="{color:Brand()['ThemeColor']}">
{{skuinfor['product_name']}}
</view>
<view class="commodity-sku-cover-name-cart">
<image class="img" :src="qnyurl('reduce.png','rx')" mode="" @tap="reducequantity()"></image>
<view class="num" style="color: #a7d500;">
{{skuinfor['num']}}
</view>
<image class="img" :src="qnyurl('add.png','rx')" mode="" @tap="Addquantity()"></image>
</view>
</view>
</view>
<view class="commodity-sku-option" v-if="skuinfor['details']">
<scroll-view :scroll-top="0" scroll-y="true" class="scroll-Y" style="height: 400rpx;">
<view class="commodity-sku-option-item" v-if="skuinfor['details']['accessories']['length']">
<view class="commodity-sku-option-item-label">
加料
</view>
<view class="commodity-sku-option-item-values">
<template v-for="(item,index) in skuinfor['details']['accessories']">
<view :class="{'commodity-sku-option-item-values-Disable':item['disable'],
'commodity-sku-option-item-values-activation':item['checked']}" @tap="accessoriesClick(item)"
class="commodity-sku-option-item-values-item" :key="index">
<text>{{item['name']}}</text>
<text v-if="(+item['price']) > 0 ">{{_amount(item['price'])}}</text>
</view>
</template>
</view>
</view>
<template v-for="(item,index) in skuinfor['details']['spu_specs']">
<view class="commodity-sku-option-item" :key="index" v-if="item['code']">
<view class="commodity-sku-option-item-label">
{{item['name']}}
</view>
<view class="commodity-sku-option-item-values">
<template v-for="(item2,index2) in item['values']">
<view @tap="skuClick(index,index2)"
:class="{'commodity-sku-option-item-values-activation':item2['checked']}"
class="commodity-sku-option-item-values-item" :key="index2">
<text>{{item2['name']}}</text>
<text v-if="(+item2['price']) > 0 ">{{__amount(item2['price'])}}</text>
</view>
</template>
</view>
</view>
</template>
</scroll-view>
</view>
<view class="commodity-sku-Infor">
<view class="commodity-sku-Infor-left">
<view class="commodity-sku-Infor-left-Price">
<text class="text1"></text>
<text class="text2">{{_amount(skuinfor['adj_pay'] * skuinfor['num'])}}</text>
</view>
<view class="commodity-sku-Infor-left-sku">
<view class="">
{{Infos['sku']}}
</view>
<view class="">
加料:{{Infos['accessories']}}
</view>
</view>
</view>
<!-- Addcommodity方法中不可设置形参,因为点击事件默认第一个参数就是点击事件的各种参数并不是形参中所设置的默认值 -->
<!-- 所以在点击时手动传入skuinfor参数 -->
<view class="commodity-sku-Infor-right" @tap="Addcommodity">
加入购物车
</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import {
mapGetters
} from 'vuex';
import mixin from '@/static/js/mixin/mixin.js'
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js'
export default {
mixins: [mixin, restaurantmixins],
name: "b-nx-sku-popup",
data() {
return {
// /
show: false,
//
skuinfor: {},
//
skutext: '',
// ,code
Infos: {},
//
skuInfos:[],
};
},
computed: {
...mapGetters({
GetcommodityInfor: 'shopping/GetcommodityInfor'
}),
},
watch: {
// ,便
GetcommodityInfor(value) {
this['skuinfor'] = JSON.parse(JSON.stringify(value));
this.skuInit();
},
},
mounted() {
//
// this['spuCode'] = this['skuinfor']['spu_specs'][0]['code'];
},
methods: {
/**
* @添加数量
* */
Addquantity(num = 1) {
this['skuinfor']['num'] += num;
},
/**
* @选择规格数量减
* */
reducequantity(num = 1) {
if (this['skuinfor']['num'] == 1) return;
this['skuinfor']['num'] -= num;
},
/**
* @加入购物车
* */
Addcommodity() {
let self = this;
// console.log(self['skuinfor'],'skuinfor');
// return;
uni.$u.debounce(() => {
self.ADD_CART({
commodity: self['skuinfor'],
quantity: self['skuinfor']['num']
}).then(() => {
// console.log('');
self['show'] = false;
// console.log(self['show'],'show');
});
}, 800, true)
},
/**
* @规格选择
* */
skuClick(index1, index2) {
// ,
this['skuinfor']['details']['spu_specs'][index1]['values'].map((item, index) => {
if (index2 == index) {
item['checked'] = true;
} else {
item['checked'] = false;
}
});
this.__skuintegration__();
},
/**
* 规格匹配辅助方法
* 先将可组合的辅料(sku_infos)code全部转为字符串利用字符串对比方式对比用户所选择的组合
* */
skuInit() {
for (let i = 0; i < this['skuinfor']['details']['sku_infos']['length']; i++) {
let item = this['skuinfor']['details']['sku_infos'][i];
let _KYE = "name";
//
let _SKU = item['specs'].concat([]).sort((a, b) => a[_KYE].localeCompare(b[_KYE])).map(item => item[
'spec_code']).join('_');
item['skuCode'] = _SKU;
};
/**
* 为加料选项添加是否可选用于对用户选择辅料之后加料选项是否可选做准备
* 默认不选中
* */
if(this['skuinfor']['details']['accessories']['length']){
this['skuinfor']['details']['accessories'].map(item => {
//
item['disable'] = false;
//
item['checked'] = false;
});
}
this.__skuintegration__();
},
/**
* 重点逻辑
* */
__skuintegration__() {
let self = this;
const _item = this['skuinfor']['details'];
// Promise
/**
* 将spu_specs中所有辅料合并到一个数组中并且添加新属性skuname
* 用于筛选出已经选择的(或者默认选中的)
* */
this.choice().then(_newSupItem => {
// _newSupItemchecked
this['skuInfos'] = _newSupItem.filter(item => item['checked']);
console.log(this['skuInfos'], '选择的辅料');
return self.codeSort();
}).then(skuArray=>{
console.log(skuArray, '选择的辅料在sku_infos中的数据包');
this['Infos'] = skuArray;
this.$forceUpdate();
return self.accessoriesmutex();
}).then(res=>{
console.log(res,'加料');
return this.price();
}).then(res=>{
console.log(res,'价格');
this.ExhibitionText();
})
},
//
price() {
return new Promise(resolve => {
let skupay = 0;
try{
skupay = this['skuinfor']['details']['accessories'].map(item => {
if (item['checked']) {
return +item['price']
};
return 0;
}).reduce(function(previousValue, currentValue) {
return previousValue + currentValue;
});
}catch(e){
//TODO handle the exception
}
let price = +this['Infos']['pay_price'] + skupay;
//
// this['skuinfor']['add_price'] = skupay;
//
// this['skuinfor']['adj_pay'] = price;
//
this.$set(this['skuinfor'], 'adj_pay', price);
//
this.$set(this['skuinfor'], 'add_price', skupay);
//
resolve(price);
})
},
//
accessoriesClick(t) {
if (t['disable']) return;
let index = this['skuinfor']['details']['accessories'].findIndex(item => item['code'] == t['code']);
let checked = !this['skuinfor']['details']['accessories'][index]['checked'];
this.$set(this['skuinfor']['details']['accessories'][index], 'checked', checked);
this.price().then(res=>{
this.ExhibitionText();
this.$forceUpdate();
});
// console.log(this['skuinfor']['details']['accessories']);
},
//
choice() {
return new Promise(resolve => {
const _newSupItemArr = this['skuinfor']['details']['spu_specs'].map(item => {
//
if (item['code']) {
item['values'].map(_item => {
_item['skuname'] = item['name'];
});
return item['values']
};
return [];
});
const newSupItem = _newSupItemArr.flatMap(item => item);
resolve(newSupItem)
})
},
// codecode,便
codeSort(){
return new Promise(resolve=>{
/**
* sku_infos为可组合的辅料数组,为防止用户所选择的辅料组合与可选择的辅料组合的code对比匹配出现问题,利用skuname字段对两个组合经行排序
* 保证所对比的code前后顺序一直
* 注意如果直接取出code然后转为字符串会有所不同因为spu_specs与sku_infos的规格排序不一样
* */
let _KYE = "skuname";
let _K = this['skuInfos'].concat([]).sort((a, b) => a[_KYE].localeCompare(b[_KYE]));
let _SKU = _K.map(item => item['code']).join('_');
// ,
const res = this['skuinfor']['details']['sku_infos'].find(item => item['skuCode'] == _SKU);
resolve(res);
})
},
//
accessoriesmutex(){
return new Promise(resolve=>{
//
let spuSpecsCode = [];
for (let x = 0; x < this['skuinfor']['details']['allow_rules']['length']; x++) {
let item = this['skuinfor']['details']['allow_rules'][x];
for (let l = 0; l < item['length']; l++) {
if (item[l] == this['Infos']['code']) {
spuSpecsCode = item;
}
}
};
//
let skuArray = [];
{
for (let k = 0; k < this['skuinfor']['details']['accessories']['length']; k++) {
let accItem = this['skuinfor']['details']['accessories'][k];
if (spuSpecsCode.indexOf(accItem['code']) == -1) {
accItem['disable'] = true;
accItem['checked'] = false;
continue;
};
// disable,false
accItem['disable'] = false;
skuArray.push(accItem);
};
};
console.log(this['skuinfor']['details']['accessories'],'*-*-*-');
this.$forceUpdate();
resolve(skuArray)
})
},
//
ExhibitionText(){
//
let _KYE = "skuname";
let KYE_ = "name";
let _K = this['skuInfos'].concat([]).sort((a, b) => a[_KYE].localeCompare(b[_KYE]));
let _ACC = this['skuinfor']['details']['accessories'].filter(item => { return item['checked'] });
//
const _SKUTEXT = _K.map(item => item[KYE_]).join('/');
const _ACCTEXT = _ACC.map(item => item['name']).join('/');
// CODE
const _ACCCODE = _ACC.map(item => item['code']).join(',');
//
this.$set(this['Infos'],'sku',_SKUTEXT);
this.$set(this['Infos'],'accessories',_ACCTEXT);
let skustr_ = `${this['Infos']['sku']}/${this['Infos']['accessories']}`;
// /
if(skustr_[skustr_.length-1] == '/'){
skustr_ = skustr_.substr(0,skustr_['length']-1)
};
//
this.$set(this['skuinfor'],'sku',`${this['Infos']['sku']}/${this['Infos']['accessories']}`);
this.$set(this['skuinfor'],'sku_code',`${this['Infos']['code']}|${_ACCCODE}`);
},
}
}
</script>
<style lang="scss">
//
.commodity-sku {
&-cover {
// height: 560rpx;
height: auto;
position: relative;
.img {
width: 100%;
}
&-title {
color: #333333;
font-size: 34rpx;
}
&-name {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
color: #ffffff;
padding: 10rpx 32rpx;
background-color: rgba(255, 255, 255, 0.5);
&-cart {
flex: 1;
height: 60rpx;
display: flex;
justify-content: flex-end;
font-size: 36rpx;
align-items: center;
.num {
max-width: 100rpx;
min-width: 100rpx;
text-align: center;
color: #000000;
}
.img {
width: 42rpx;
height: 42rpx;
}
}
}
}
&-option {
padding: 32rpx;
&-item {
width: 100%;
// height: 70rpx;
font-size: 26rpx;
margin-bottom: 32rpx;
// display: flex;
// justify-content: flex-start;
// margin-bottom: 15rpx;
&-label {
min-width: 112rpx;
height: 100%;
color: #999999;
line-height: 70rpx;
}
&-values {
width: 100%;
display: flex;
flex-direction: row;
flex-wrap: wrap;
&-activation {
background: rgba(167, 213, 0, 0.2) !important;
border: 1rpx solid rgba(167, 213, 0, 0.5) !important;
color: rgb(167, 213, 0) !important;
}
&-Disable {
background-color: #adadad33 !important;
border: 1rpx solid #adadad33 !important;
color: #939393 !important;
}
&-item {
// min-width: 112rpx;
padding: 0 20rpx;
height: 100%;
line-height: 70rpx;
background: #F7F8FA;
border-radius: 6rpx;
margin-bottom: 20rpx;
text-align: center;
margin-right: 15rpx;
border: 1rpx solid #F7F8FA;
}
}
}
}
&-Infor {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding: 32rpx;
border-top: 1rpx solid rgba(102, 102, 102, 0.1);
&-left {
&-Price {
color: #FF780F;
.text1 {
font-size: 24rpx;
}
.text2 {
font-size: 36rpx;
}
}
&-sku {
color: #666666;
font-size: 22rpx;
}
}
&-right {
width: 254rpx;
height: 86rpx;
max-width:254rpx;
max-height:86rpx;
min-width:254rpx;
min-height:86rpx;
background: linear-gradient(-77deg, #a7d500, #d0dbaa);
box-shadow: 0 6rpx 8rpx 0 rgba(74, 111, 231, 0.2300);
border-radius: 43rpx;
text-align: center;
line-height: 86rpx;
color: #ffffff;
}
}
}
</style>

View File

@ -0,0 +1,409 @@
<template>
<view class="Order-settlement">
<view class="Order-settlement-left">
<view class="Order-settlement-left-item">
原价: {{RetainDecimalPoint(InforData['original_price'])}}
</view>
<view class="Order-settlement-left-item">
消费补贴卡抵扣{{RetainDecimalPoint(InforData['deduction_amount_total'])}}
</view>
<view class="Order-settlement-left-item">
预估佣金{{InforData['self_commission']}}
</view>
</view>
<view class="Order-settlement-btn-price">
<view class="Order-settlement-btn-price-pay-price">
<text class="text1">{{InforData['status'] | OrderStateText}}</text>
<text class="text2" style="color:#DE2F2C">{{RetainDecimalPoint(InforData['pay_price'])}}</text>
</view>
<!-- 待支付 -->
<view class="Order-settlement-btn-price-operate" v-if="InforData['status'] == OrderStatus0">
<view class="btn btn1" @tap.stop="cancel(InforData['order_sn'],index)">
取消订单
</view>
<view class="btn btn2" :style="[orderStyle]" @tap.stop="payment(InforData['order_sn'],index)">
去支付
</view>
</view>
<!-- 已出餐 -->
<view class="Order-settlement-btn-price-operate" v-if="InforData['status'] == OrderStatus2">
<!-- 瑞幸-已出参订单按钮 -->
<template v-if="Brand_RX">
<view class="btn btn1" @tap.stop="location">
联系客服
</view>
<!-- <navigator hover-class="none" -->
<!-- :url="`/pages/restaurant/order/order-details/rx-orders-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn2" :style="[orderStyle]" @tap.stop="OrderDetails(shopid['RX_brand_id'])">
查看取餐码
</view>
<!-- </navigator> -->
</template>
<!-- 肯德基-已出参订单按钮 -->
<template v-if="Brand_KFC">
<!-- <navigator hover-class="none"
:url="`/pages/restaurant/order/order-details/order-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn1" :style="[orderStyle]" @tap.stop="OrderDetails(shopid['KFC_brand_id'])">
查看取餐码
</view>
<!-- </navigator> -->
</template>
<!-- 麦当劳-已出参订单按钮 -->
<template v-if="Brand_MDL">
<!-- <navigator hover-class="none" -->
<!-- :url="`/pages/restaurant/order/order-details/xbk-orders-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn1" :class="`theme-Union-Class-${BrandInfor['brand_id']}-1`" :style="[orderStyle]" @tap.stop="OrderDetails(shopid['XBK_brand_id'])">
查看取餐码
</view>
<!-- </navigator> -->
</template>
<!-- 星巴克-已出参订单按钮 -->
<template v-if="Brand_XBK">
<!-- <navigator hover-class="none" -->
<!-- :url="`/pages/restaurant/order/order-details/xbk-orders-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn1" :style="[orderStyle]" @tap.stop="OrderDetails(shopid['XBK_brand_id'])">
取餐口令
</view>
<!-- </navigator> -->
</template>
</view>
<!-- 已出餐部分退款 -->
<view class="Order-settlement-btn-price-operate" v-if="InforData['status'] == OrderStatus4">
<!-- 瑞幸-已出参部分退款订单按钮 -->
<template v-if="Brand_RX">
<!-- <navigator hover-class="none" -->
<!-- :url="`/pages/restaurant/order/order-details/rx-orders-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn1" :style="[orderStyle]" @tap.stop="OrderDetails(shopid['RX_brand_id'])">
查看取餐码
</view>
<!-- </navigator> -->
</template>
<!-- 肯德基-已出参部分退款订单按钮 -->
<template v-if="Brand_KFC">
<!-- <navigator hover-class="none" -->
<!-- :url="`/pages/restaurant/order/order-details/order-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn1" :style="[orderStyle]" @tap.stop="OrderDetails(shopid['KFC_brand_id'])">
查看取餐码
</view>
<!-- </navigator> -->
</template>
<!-- 麦当劳-已出参订单按钮 -->
<template v-if="Brand_MDL">
<!-- <navigator hover-class="none" -->
<!-- :url="`/pages/restaurant/order/order-details/xbk-orders-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn1" :style="[orderStyle]" @tap.stop="OrderDetails(shopid['XBK_brand_id'])">
查看取餐码
</view>
<!-- </navigator> -->
</template>
<!-- 星巴克-已出参部分退款订单按钮 -->
<template v-if="Brand_XBK">
<!-- <navigator hover-class="none" -->
<!-- :url="`/pages/restaurant/order/order-details/xbk-orders-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn1" :style="[orderStyle]" @tap.stop="OrderDetails(shopid['XBK_brand_id'])">
查看口令
</view>
<!-- </navigator> -->
</template>
</view>
<!-- 待出餐/已退款订单失败就会退款 -->
<view class="Order-settlement-btn-price-operate"
v-if="InforData['status'] == OrderStatus1 || InforData['status'] == OrderStatus3">
<!-- 瑞幸-待出餐/已退款订单按钮 -->
<template v-if="Brand_RX">
<view class="btn btn1" @tap.stop="location">
联系客服
</view>
<!-- <navigator hover-class="none" -->
<!-- :url="`/pages/restaurant/order/order-details/rx-orders-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn1 btn2" @tap.stop="OrderDetails(shopid['RX_brand_id'])">
查看订单
</view>
<!-- </navigator> -->
</template>
<!-- 肯德基-待出餐/已退款订单按钮 -->
<template v-if="Brand_KFC">
<view class="btn btn1" @tap.stop="location">
联系客服
</view>
</template>
<!-- 麦当劳-待出餐/已退款订单按钮 -->
<template v-if="Brand_MDL">
<view class="btn btn1" :class="`theme-Union-Class-${BrandInfor['brand_id']}-1`" @tap.stop="location">
联系客服
</view>
</template>
<!-- 星巴克-待出餐/已退款订单按钮 -->
<template v-if="Brand_XBK">
<!-- <navigator hover-class="none" -->
<!-- :url="`/pages/restaurant/order/order-details/xbk-orders-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn1 btn2" @tap.stop="OrderDetails(shopid['XBK_brand_id'])">
查看订单
</view>
<!-- </navigator> -->
</template>
</view>
<!-- 已取消 -->
<view class="Order-settlement-btn-price-operate" v-if="InforData['status'] == OrderStatus5">
<!-- 瑞幸-已取消订单按钮 -->
<template v-if="Brand_RX">
<view class="btn btn1" @tap.stop="location">
联系客服
</view>
<view class="btn btn1 btn2" @tap.stop="OrderReorder">
再来一单
</view>
</template>
<!-- 肯德基-已取消订单按钮 -->
<template v-if="Brand_KFC">
<view class="btn btn1 btn2" @tap.stop="OrderReorder">
重新下单
</view>
</template>
<!-- 肯德基-已取消订单按钮 -->
<template v-if="Brand_MDL">
<view class="btn btn1 btn2" :class="`theme-Union-Class-${BrandInfor['brand_id']}-1`" @tap.stop="OrderReorder">
重新下单
</view>
</template>
<!-- 星巴克-已取消订单按钮 -->
<template v-if="Brand_XBK">
<view class="btn btn1" @tap.stop="location">
联系客服
</view>
<view class="btn btn1 btn2" @tap.stop="OrderReorder">
重新下单
</view>
</template>
</view>
</view>
</view>
</template>
<script>
import {
RXSERVICE
} from '@/static/js/serviceurl.js'
import mixin from '@/static/js/mixin/mixin.js';
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
import {
mapGetters,
} from 'vuex'
export default {
name: 'b-order-item-settlement',
mixins: [mixin, restaurantmixins],
// ,,
inject: ["cancel", "Reorder", "payments"],
props: {
index: {
type: Number,
default: 0
},
infor: {
type: Object,
default: () => {}
}
},
computed: {
InforData() {
return this['infor']
},
//
orderStyle() {
let style = {};
switch (this['BrandInfor']['brand_id']) {
case 1:
style['color'] = uni.$u.addUnit('#C63836');
style['border'] = uni.$u.addUnit('1px solid #DC7473');
break;
case 5:
style['color'] = uni.$u.addUnit('#000000');
style['background-color'] = uni.$u.addUnit('#FFBC0D');
break;
case 10:
style['color'] = uni.$u.addUnit('#ffffff');
style['background-color'] = uni.$u.addUnit('#00AF66');
// style['border'] = uni.$u.addUnit('1px solid #00AF66');
break;
case 13:
style['color'] = uni.$u.addUnit('#4A6FE7');
style['border'] = uni.$u.addUnit('1px solid #4A6FE7');
break;
};
return style;
},
Brand_RX() {
return this['BrandInfor']['brand_id'] == 13;
},
Brand_KFC() {
return this['BrandInfor']['brand_id'] == 1;
},
Brand_XBK() {
return this['BrandInfor']['brand_id'] == 10;
},
Brand_MDL() {
return this['BrandInfor']['brand_id'] == 5;
},
Brand_DYP() {
return this['BrandInfor']['brand_id'] == 19;
}
},
data() {
return {
}
},
methods: {
//
OrderReorder() {
let arr = this['InforData']['goods'].map(item => {
console.log(this['InforData'],'InforData')
item['restaurant_id'] = this['InforData']['restaurant_id'];
//
item['restaurant_address'] = this['InforData']['restaurant_address'];
item['restaurant_name'] = this['InforData']['restaurant_name'];
item['latitude'] = this['InforData']['lat'];
item['longitude'] = this['InforData']['lng'];
// 使num,amount
item['num'] = item['amount'];
item['pay'] = item['original_price'] / item['amount'];
// item['pay_price'] = item['original_price'];
return item;
});
this.Reorder(arr);
},
OrderDetails(type) {
let url;
switch (type) {
case this['shopid']['KFC_brand_id']:
url =
`/pages/restaurant/order/order-details/order-details?order=${this['InforData']['order_sn']}`;
break;
case this['shopid']['XBK_brand_id']:
url =
`/pages/restaurant/order/order-details/xbk-orders-details?order=${this['InforData']['order_sn']}`;
break;
case this['shopid']['RX_brand_id']:
url =
`/pages/restaurant/order/order-details/rx-orders-details?order=${this['InforData']['order_sn']}`;
break;
};
uni.navigateTo({url})
},
/**
* @跳转客服
* */
service() {
uni.openCustomerServiceChat({
extInfo: {
url: RXSERVICE,
},
corpId: 'ww4f46b491a045158c',
success(e) {
console.log(e)
},
fail(e) {
console.log(e)
}
})
},
}
}
</script>
<style lang="scss">
.Order-settlement {
padding: 0 32rpx 21rpx 32rpx;
margin-top: 48rpx;
display: flex;
justify-content: space-between;
&-left {
color: #333333;
font-size: $FONTSIZE24;
&-item:nth-of-type(1) {
margin-bottom: 12rpx;
}
&-item:nth-of-type(2) {
margin-bottom: 12rpx;
}
}
&-btn-price {
display: flex;
align-items: flex-end;
flex-direction: column;
justify-content: space-between;
&-pay-price {
.text1 {
color: #333333;
font-size: $FONTSIZE24;
}
.text2 {
// color: #CE211F;
font-size: $FONTSIZE36;
}
}
&-operate {
display: flex;
.btn {
width: 160rpx;
height: 58rpx;
font-size: $FONTSIZE22;
text-align: center;
// line-height: 58rpx;
display: flex;
align-items: center;
justify-content: center;
}
.btn1 {
border: 2rpx solid #E3E3E3;
border-radius: 50rpx;
color: #666666;
}
.btn2 {
// border: 2rpx solid #C63836;
border-radius: 50rpx;
// color: #C63836;
margin-left: 20rpx;
}
}
}
}
</style>

View File

@ -0,0 +1,390 @@
<template>
<view class="b-orders" @tap.stop="orderdetails">
<!-- 肯德基门店信息 -->
<view class="b-orders-header" v-if="item['brand_id'] == 1">
<view class="b-orders-header-label">
门店
</view>
<view class="b-orders-header-name">
{{item['restaurant_name']}}
</view>
<!-- 待出餐 -->
<view class="b-orders-header-state-70B452">
<text v-if="InforData['status'] == OrderStatus0">{{wait_for}}</text>{{InforData['status'] | OrderState}}
</view>
</view>
<!-- 麦当劳门店信息 -->
<view class="b-orders-header-Mdl" v-if="item['brand_id'] == 5">
<view class="b-orders-header-Mdl-label">
门店
</view>
<view class="b-orders-header-Mdl-name">
{{item['restaurant_name']}}
</view>
<!-- 待出餐 -->
<view class="b-orders-header-Mdl-state-MDL-70B452">
<text class="tiem" v-if="InforData['status'] == OrderStatus0">{{wait_for}}</text>
<text>{{InforData['status'] | OrderState}}</text>
</view>
</view>
<!-- 订单信息 -->
<view class="b-orders-infor">
<view class="b-orders-infor-item">
<view class="b-orders-infor-item-label">
订单编号:
</view>
<view class="b-orders-infor-item-value">
{{item['order_no']?item['order_no']:item['order_sn']}}
</view>
</view>
<view class="b-orders-infor-item">
<view class="b-orders-infor-item-label">
下单时间:
</view>
<view class="b-orders-infor-item-value">
{{item['create_time']}}
</view>
</view>
</view>
<view class="b-orders-list" :style="{height: item['goods']['length']>3?height:'auto'}">
<template v-for="(item,index) in item['goods']">
<view class="b-orders-list-item" :key="index">
<view class="b-orders-list-item-name">
{{item['product_name']}}
</view>
<view class="b-orders-list-item-num">
x{{item['amount']}}
</view>
</view>
</template>
</view>
<!-- 展开 -->
<view class="b-orders-expand" v-if="item['goods'] && item['goods']['length']>3" @tap.stop="show = !show">
{{ShowText}}
</view>
<!-- 订单底部结算组件 -->
<b-order-item-settlement :infor="item" :index="index"></b-order-item-settlement>
</view>
</template>
<script>
//
import {
KFCSERVICE
} from '@/static/js/serviceurl.js';
//
import bOrderItemSettlement from './b-order-item-settlement.vue';
import mixin from '@/static/js/mixin/mixin.js';
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
export default {
mixins: [mixin,restaurantmixins],
name: "b-orders",
components: {
bOrderItemSettlement
},
props: {
item: {
type: Object,
default: () => {}
},
index: {
type: Number,
default: 0
}
},
data() {
return {
height: '200rpx',
show: false,
// countDown:null,
// wait_for:''
};
},
watch: {
show(v) {
if (v) {
this['height'] = 'auto';
} else {
this['height'] = '200rpx';
}
},
//
status(v){
if(v != 0){
clearTimeout(this['countDown']);
}
},
},
computed: {
ShowText() {
return this['show'] ? '收起' : '展开';
},
InforData() {
return this['item'];
},
order_no() {
return this['InforData']['order_no'] ? this['InforData']['order_no'] : this['InforData']['order_sn']
},
status(){
return this['InforData']['status']
}
},
mounted() {
this.tiem(this['InforData']['status'], this['InforData']['createtime'])
},
methods: {
orderdetails() {
if (this['InforData']['status'] == 2 || this['InforData']['status'] == 5 || this['InforData']['status'] ==
1) {
uni.navigateTo({
url: `/pages/restaurant/order/order-details/order-details?order=${this['item']['order_sn']}`
})
}
},
//
cancel(order_sn) {
this.$emit('cancel', order_sn, this['index']);
},
//
payment(order_sn) {
this.$emit('payment', order_sn, this['item']['restaurant_id']);
},
//
Reorder() {
let arr = this['item']['goods'].map(item => {
item['restaurant_id'] = this['item']['restaurant_id'];
//
item['restaurant_address'] = this['item']['restaurant_address'];
item['restaurant_name'] = this['item']['restaurant_name'];
item['latitude'] = this['item']['lat'];
item['longitude'] = this['item']['lng'];
return item
})
// console.log(arr, 'arr');
this.$emit('Reorder', arr);
},
/**
* @跳转客服
* */
service() {
uni.openCustomerServiceChat({
extInfo: {
url: KFCSERVICE,
},
corpId: 'ww4f46b491a045158c',
success(e) {
// console.log(e)
},
fail(e) {
// console.log(e)
}
})
},
},
}
</script>
<style lang="scss">
.b-orders {
width: 100%;
// min-height: 637rpx;
background: #FFFFFF;
box-shadow: 0 0 14rpx 1rpx rgba(174, 174, 174, 0.3300);
border-radius: 20rpx;
overflow: hidden;
margin-top: 20rpx;
&-header-Mdl{
background: #FFFAEC !important;
}
&-header,&-header-Mdl {
// height: 70rpx;
background: #F6F6F6;
padding: 21rpx 30rpx;
font-size: $FONTSIZE28;
display: flex;
justify-content: flex-start;
&-label {
background: #E64946;
border-radius: 2rpx;
color: #FFFFFF;
margin-right: 15rpx;
padding: 2rpx 10rpx;
}
&-name {
color: #333333;
flex: 1;
}
&-state-E64946 {
color: #E64946;
}
&-state-999999 {
color: #999999;
}
&-state-70B452 {
color: #70B452;
}
&-state-MDL-70B452 {
.tiem{
color: #DE2F2C;
margin-right: 10rpx;
}
}
}
&-infor {
font-size: $FONTSIZE28;
color: #666666;
padding: 26rpx 32rpx;
position: relative;
&::after {
content: '';
position: absolute;
width: 90%;
bottom: 0;
left: 50%;
height: 1rpx;
background-color: #E3E3E3;
transform: scale(0.5, 0.5);
transform: translateX(-50%);
}
&-item {
margin-bottom: 23rpx;
display: flex;
justify-content: space-between;
&-label {
max-width: 170rpx;
min-width: 170rpx;
}
&-value {
text-align: right;
flex: 1;
}
}
}
&-list {
padding: 32rpx 32rpx 0 32rpx;
overflow: hidden;
transition: all 0.5s;
&-item {
margin-bottom: 20rpx;
display: flex;
justify-content: space-between;
font-size: $FONTSIZE28;
&-name {
flex: 1;
}
}
}
&-expand {
width: 100%;
line-height: 80rpx;
font-size: $FONTSIZE24;
text-align: center;
position: relative;
// border-bottom: 1rpx solid #E3E3E3;
&::after {
content: '';
position: absolute;
width: 90%;
bottom: 0;
left: 50%;
height: 1rpx;
background-color: #E3E3E3;
transform: scale(0.5, 0.5);
transform: translateX(-50%);
}
}
&-operate {
padding: 0 32rpx 21rpx 32rpx;
margin-top: 48rpx;
display: flex;
justify-content: space-between;
&-left {
color: #333333;
font-size: $FONTSIZE24;
&-item:nth-of-type(1) {
margin-bottom: 12rpx;
}
&-item:nth-of-type(2) {
margin-bottom: 12rpx;
}
}
&-btn-price {
display: flex;
align-items: flex-end;
flex-direction: column;
justify-content: space-between;
&-pay-price {
.text1 {
color: #333333;
font-size: $FONTSIZE24;
}
.text2 {
color: #CE211F;
font-size: $FONTSIZE36;
}
}
&-operate {
display: flex;
.btn {
width: 160rpx;
height: 58rpx;
font-size: $FONTSIZE28;
text-align: center;
line-height: 58rpx;
}
.btn1 {
border: 2rpx solid #E3E3E3;
border-radius: 50rpx;
color: #666666;
}
.btn2 {
border: 2rpx solid #C63836;
border-radius: 50rpx;
color: #C63836;
margin-left: 20rpx;
}
}
}
}
}
</style>

View File

@ -0,0 +1,229 @@
<template>
<view class="b-orders-rx" @tap.stop="OrderDetails">
<!-- 顶部店铺名称/状态栏 -->
<view class="Order-infor">
<view class="Order-infor-Img">
<image :src="qnyurl('rxlogo.png','rx')" class="img"></image>
</view>
<view class="Order-infor-Shop">
<view class="Order-infor-Shop-Name">
{{InforData['restaurant_name']}}
</view>
<view class="Order-infor-Shop-Createtime">
{{InforData['create_time']}}
</view>
</view>
<view class="Order-infor-State">
<view class="State">{{ InforData['status'] | OrderState}}</view>
<view class="time" v-if="InforData['status'] == OrderStatus0">{{wait_for}}</view>
</view>
</view>
<view class="Order-Code">
<view class="Order-Code-Content">
<view class="Order-Code-Content-Number">
自提订单{{order_no}}
</view>
<view class="Order-Code-Content-Copy" @tap.stop="Copy(order_no)">
复制
</view>
</view>
</view>
<view class="Order-Commodity">
<template v-for="(commodity,index) in InforData['goods']">
<view class="Order-Commodity-item">
<!-- 商品样式 -->
<b-rx-commodity-item :item="commodity" :key="index"></b-rx-commodity-item>
</view>
</template>
</view>
<!-- 订单底部结算组件 -->
<b-order-item-settlement :infor="InforData" :index="index"></b-order-item-settlement>
</view>
</template>
<script>
import mixin from '@/static/js/mixin/mixin.js';
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
//
import bRxCommodityItem from '@/components/b-rx-commodity-item/b-rx-commodity-item.vue'
import bOrderItemSettlement from './b-order-item-settlement.vue'
export default {
name: 'b-orders-rx',
mixins: [mixin,restaurantmixins],
props: {
index:{
type:Number,
default:0
},
item: {
type: Object,
default: () => {}
}
},
components: {
bRxCommodityItem,
bOrderItemSettlement
},
data() {
return {
// status:0,
}
},
computed: {
InforData() {
//
return this['item'];
},
order_no(){
return this['InforData']['order_no']?this['InforData']['order_no']:this['InforData']['order_sn']
},
status(){
return this['InforData']['status']
}
},
watch:{
//
status(v){
if(v != 0){
clearTimeout(this['countDown']);
}
},
},
mounted() {
if (this['status'] == this['OrderStatus0']) {
this.tiem(this['status'], this['InforData']['createtime'])
};
},
methods:{
/**
* @点击订单整体时
* */
OrderDetails() {
// >ID()
// >tab,,,ID,
if(!this['BrandInfor']['brand_id']) return;
console.log(this['InforData']['status'],this['OrderStatus0']);
if (this['InforData']['status'] == this['OrderStatus0'] ||
this['InforData']['status'] == this['OrderStatus1'] ||
this['InforData']['status'] == this['OrderStatus2'] ||
this['InforData']['status'] == this['OrderStatus5']) {
uni.navigateTo({
url: `/pages/restaurant/order/order-details/rx-orders-details?order=${this['InforData']['order_sn']}`
})
}
},
}
}
</script>
<style lang="scss">
.b-orders-rx {
width: 100%;
background: #FFFFFF;
border-radius: 20rpx;
margin-bottom: 20rpx;
.Order-infor {
width: 100%;
padding: 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
&-Img {
width: 60rpx;
height: 60rpx;
max-width: 60rpx;
max-height: 60rpx;
min-width: 60rpx;
min-height: 60rpx;
margin-right: 17rpx;
.img {
width: 100%;
height: 100%;
}
}
&-Shop {
flex: 1;
&-Name {
color: #333333;
font-size: 30rpx;
margin-bottom: 10rpx;
max-width: 460rpx;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
}
&-Createtime {
color: #999999;
font-size: 24rpx;
}
}
&-State {
color: #83ACFE;
text-align: center;
.State {
font-size: 26rpx;
margin-bottom: 12rpx;
}
.time {
font-size: 24rpx;
}
}
}
.Order-Code {
padding: 0 30rpx;
font-size: 28rpx;
&-Content {
background-color: #F7F9FC;
width: 100%;
padding: 20rpx;
display: flex;
align-items: center;
justify-content: flex-start;
&-Number {
color: #333333;
}
&-Copy {
color: #4B6FE7;
padding-left:20rpx;
}
}
}
.Order-Commodity {
padding: 32rpx;
&-item {
margin-bottom: 20rpx;
}
}
}
</style>

View File

@ -0,0 +1,373 @@
<template>
<view class="b-orders-xbk" @tap.stop="orderdetails">
<!-- 门店信息 -->
<view class="b-orders-xbk-header">
<view class="b-orders-xbk-header-Img">
<image :src="qnyurl('xbk_home.png','xbk')" class="img"></image>
</view>
<view class="b-orders-xbk-header-name">
{{item['restaurant_name']}}
</view>
<!-- 待出餐 -->
<view class="b-orders-xbk-header-state-70B452">
<text v-if="InforData['status'] == OrderStatus0">{{wait_for}}</text>{{InforData['status'] | OrderState}}
</view>
</view>
<!-- 订单信息 -->
<view class="b-orders-xbk-infor">
<view class="b-orders-xbk-infor-item">
<view class="b-orders-xbk-infor-item-label">
订单编号:
</view>
<view class="b-orders-xbk-infor-item-value">
{{item['order_no']?item['order_no']:item['order_sn']}}
</view>
</view>
<view class="b-orders-xbk-infor-item">
<view class="b-orders-xbk-infor-item-label">
下单时间:
</view>
<view class="b-orders-xbk-infor-item-value">
{{item['create_time']}}
</view>
</view>
</view>
<view class="b-orders-xbk-list" :style="{height: item['goods']['length']>3?height:'auto'}">
<template v-for="(commodity,index) in item['goods']">
<!-- 商品样式 -->
<b-rx-commodity-item :item="commodity" :key="index"></b-rx-commodity-item>
</template>
</view>
<!-- 展开 -->
<view class="b-orders-xbk-expand" v-if="item['goods'] && item['goods']['length']>3" @tap.stop="show = !show">
{{ShowText}}
</view>
<!-- 订单底部结算组件 -->
<b-order-item-settlement :infor="item" :index="index"></b-order-item-settlement>
</view>
</template>
<script>
//
import {
KFCSERVICE
} from '@/static/js/serviceurl.js';
//
import bOrderItemSettlement from './b-order-item-settlement.vue';
import bRxCommodityItem from '@/components/b-rx-commodity-item/b-rx-commodity-item.vue'
import mixin from '@/static/js/mixin/mixin.js';
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
export default {
mixins: [mixin,restaurantmixins],
name: "b-orders",
components: {
bOrderItemSettlement,
bRxCommodityItem
},
props: {
item: {
type: Object,
default: () => {}
},
index: {
type: Number,
default: 0
}
},
data() {
return {
height: '200rpx',
show: false,
// countDown:null,
// wait_for:''
};
},
watch: {
show(v) {
if (v) {
this['height'] = 'auto';
} else {
this['height'] = '200rpx';
}
},
//
status(v){
if(v != 0){
clearTimeout(this['countDown']);
}
},
},
computed: {
ShowText() {
return this['show'] ? '收起' : '展开';
},
InforData() {
return this['item'];
},
order_no() {
return this['InforData']['order_no'] ? this['InforData']['order_no'] : this['InforData']['order_sn']
},
status(){
return this['InforData']['status']
}
},
mounted() {
this.tiem(this['InforData']['status'], this['InforData']['createtime'])
},
methods: {
orderdetails() {
if (this['InforData']['status'] == 2 || this['InforData']['status'] == 5 || this['InforData']['status'] ==
1) {
uni.navigateTo({
url: `/pages/restaurant/order/order-details/xbk-orders-details?order=${this['item']['order_sn']}`
})
}
},
//
cancel(order_sn) {
this.$emit('cancel', order_sn, this['index']);
},
//
payment(order_sn) {
this.$emit('payment', order_sn, this['item']['restaurant_id']);
},
//
Reorder() {
let arr = this['item']['goods'].map(item => {
item['restaurant_id'] = this['item']['restaurant_id'];
//
item['restaurant_address'] = this['item']['restaurant_address'];
item['restaurant_name'] = this['item']['restaurant_name'];
item['latitude'] = this['item']['lat'];
item['longitude'] = this['item']['lng'];
return item
})
// console.log(arr, 'arr');
this.$emit('Reorder', arr);
},
/**
* @跳转客服
* */
service() {
uni.openCustomerServiceChat({
extInfo: {
url: KFCSERVICE,
},
corpId: 'ww4f46b491a045158c',
success(e) {
// console.log(e)
},
fail(e) {
// console.log(e)
}
})
},
},
}
</script>
<style lang="scss" scoped>
.b-orders-xbk {
width: 100%;
// min-height: 637rpx;
background: #FFFFFF;
box-shadow: 0 0 14rpx 1rpx rgba(174, 174, 174, 0.3300);
border-radius: 20rpx;
overflow: hidden;
margin-top: 20rpx;
&-header {
align-items: center;
&-Img{
width: 30rpx;
height: 30rpx;
margin-right: 15rpx;
.img{
width: 100%;
height: 100%;
}
}
// height: 70rpx;
background: #F6F6F6;
padding: 21rpx 30rpx;
font-size: $FONTSIZE28;
display: flex;
justify-content: flex-start;
&-label {
background: #E64946;
border-radius: 2rpx;
color: #FFFFFF;
margin-right: 15rpx;
padding: 2rpx 10rpx;
}
&-name {
color: #333333;
flex: 1;
}
&-state-E64946 {
color: #E64946;
}
&-state-999999 {
color: #999999;
}
&-state-70B452 {
color: #70B452;
}
}
&-infor {
font-size: $FONTSIZE28;
color: #666666;
padding: 26rpx 32rpx;
position: relative;
&::after {
content: '';
position: absolute;
width: 90%;
bottom: 0;
left: 50%;
height: 1rpx;
background-color: #E3E3E3;
transform: scale(0.5, 0.5);
transform: translateX(-50%);
}
&-item {
margin-bottom: 23rpx;
display: flex;
justify-content: space-between;
&-label {
max-width: 170rpx;
min-width: 170rpx;
}
&-value {
text-align: right;
flex: 1;
}
}
}
&-list {
padding: 32rpx;
overflow: hidden;
transition: all 0.5s;
&-item {
margin-bottom: 20rpx;
display: flex;
justify-content: space-between;
font-size: $FONTSIZE28;
&-name {
flex: 1;
}
}
}
&-expand {
width: 100%;
line-height: 80rpx;
font-size: $FONTSIZE24;
text-align: center;
position: relative;
// border-bottom: 1rpx solid #E3E3E3;
&::after {
content: '';
position: absolute;
width: 90%;
bottom: 0;
left: 50%;
height: 1rpx;
background-color: #E3E3E3;
transform: scale(0.5, 0.5);
transform: translateX(-50%);
}
}
&-operate {
padding: 0 32rpx 21rpx 32rpx;
margin-top: 48rpx;
display: flex;
justify-content: space-between;
&-left {
color: #333333;
font-size: $FONTSIZE24;
&-item:nth-of-type(1) {
margin-bottom: 12rpx;
}
&-item:nth-of-type(2) {
margin-bottom: 12rpx;
}
}
&-btn-price {
display: flex;
align-items: flex-end;
flex-direction: column;
justify-content: space-between;
&-pay-price {
.text1 {
color: #333333;
font-size: $FONTSIZE24;
}
.text2 {
color: #CE211F;
font-size: $FONTSIZE36;
}
}
&-operate {
display: flex;
.btn {
width: 160rpx;
height: 58rpx;
font-size: $FONTSIZE28;
text-align: center;
line-height: 58rpx;
}
.btn1 {
border: 2rpx solid #E3E3E3;
border-radius: 50rpx;
color: #666666;
}
.btn2 {
border: 2rpx solid #C63836;
border-radius: 50rpx;
color: #C63836;
margin-left: 20rpx;
}
}
}
}
}
</style>

View File

@ -0,0 +1,618 @@
<template>
<view class="b-page-home-mdl">
<view class="content-top">
<view class="content-top-process">
<view class="content-top-process-item">
<image class="content-top-process-item-img" :src="qnyurl('mdl-1.png','mdl')"
mode=""></image>
<view class="content-top-process-item-text">
选择餐厅
</view>
</view>
<view class="content-top-process-item">
<image class="content-top-process-item-img" :src="qnyurl('mdl-2.png','mdl')"
mode=""></image>
<view class="content-top-process-item-text">
选择菜品
</view>
</view>
<view class="content-top-process-item">
<image class="content-top-process-item-img" :src="qnyurl('mdl-3.png','mdl')"
mode=""></image>
<view class="content-top-process-item-text">
等待取餐码
</view>
</view>
<view class="content-top-process-item">
<image class="content-top-process-item-img" :src="qnyurl('mdl-4.png','mdl')"
mode=""></image>
<view class="content-top-process-item-text">
到店取餐
</view>
</view>
</view>
<!-- 地址/搜索/选择 -->
<view class="content-top-search">
<view class="content-top-search-area-search">
<navigator url="/pages/restaurant/arealist/arealist" hover-class="none">
<view class="content-top-search-area-search-text">
<!-- 第一次获取肯定是获取不到的主要是动态显示用户改变的地址 -->
{{UserArae1?UserArae1:UserArae2['city']}}
<view style="transform: rotate(90deg);">
<text class="icon iconfont icon-youjiantou"></text>
</view>
</view>
</navigator>
<u-search placeholder="输入门店名称查询" :showAction="false" v-model="keyword" @search="search">
</u-search>
</view>
<view class="content-top-search-tabs">
<u-tabs @change="e=>{tabsconfig['index'] = e['index']}" :list="tabsconfig['list']"
:scrollable="tabsconfig['scrollable']" :lineColor="tabsconfig['lineColor']"
:lineWidth="tabsconfig['lineWidth']"></u-tabs>
</view>
</view>
</view>
<!-- 店铺列表 -->
<!-- 因为骨架屏的颜色和UI设置背景色冲突所以在没有列表元素时先将背景色设置为白色 -->
<view class="Store-List" :style="{height:`${height}rpx`}">
<!-- 附近餐厅 -->
<view v-show="tabsconfig['index'] == 0">
<scroll-view scroll-y="true" class="scroll-Y" :style="{height:`${height}rpx`}"
@scrolltolower="scrolltolower">
<template v-for="(item,index) in StoreList[0]['list']">
<view class="Store-List-Item" :key="index">
<view class="infot">
<view class="Store-List-Item-Top">
<view class="Store-List-Item-Top-Name">
{{item['restaurant_name']}}
</view>
<view class="Store-List-Item-Top-distance">
{{item['distance']}}m
</view>
</view>
<view class="Store-List-Item-Area">
{{item['restaurant_address']}}
</view>
</view>
<view class="btn" @tap="SETSHOPDETAIL(item);eattypeShow = true;">
去点餐
</view>
</view>
</template>
<view class="default" v-if="StoreList[0]['list']['length'] <= 0">
<img class="img" :src="qnyurl('default.png','rx')" alt="">
<text>该地区暂无门店信息</text>
</view>
</scroll-view>
</view>
<!-- 我的收藏 -->
<view v-show="tabsconfig['index'] == 1">
<scroll-view scroll-y="true" class="scroll-Y" :style="{height:`${height}rpx`}"
@scrolltolower="scrolltolower">
<template v-for="(item,index) in StoreList[1]['list']">
<view class="Store-List-Item" :key="index">
<view class="infot">
<view class="Store-List-Item-Top">
<view class="Store-List-Item-Top-Name">
{{item['restaurant_name']}}
</view>
<view class="Store-List-Item-Top-distance">
{{item['distance']}}m
</view>
</view>
<view class="Store-List-Item-Area">
{{item['restaurant_address']}}
</view>
</view>
<view class="btn" @tap="SETSHOPDETAIL(item);eattypeShow = true;">
去点餐
</view>
</view>
</template>
<view class="default" v-if="StoreList[1]['list']['length'] <= 0">
<img class="img" :src="qnyurl('default.png','rx')" alt="">
<text>该地区暂无门店信息</text>
</view>
</scroll-view>
</view>
<!-- 加载状态 -->
<b-load :show="loading && height>0" position="absolute" width="79" height="80" color="#000000"></b-load>
</view>
<!-- 选择就餐方式弹框 -->
<u-popup :show="eattypeShow" @close="eattypeShow = false" closeable>
<view class="poupconten">
<view class="shop-inofr">
<view class="shop-inofr-name">
<image class="icon" :src="qnyurl('sopicon.png')" mode=""></image>
<text>{{GetShopInfor['restaurant_name']}}</text>
</view>
<view class="shop-inofr-area">
{{GetShopInfor['restaurant_address']}}
</view>
</view>
<view class="hint">
温馨提示<text :class="`themeColor-${BrandInfor['brand_id']}`">肯德基点餐为第三方供应商提供的代下单服务暂不支持外卖</text><text
class="text2">出餐后可凭取餐码到店取餐如有疑问请及时联系在线客服</text>
</view>
<view class="Way">
<view class="Way-title">请选择就餐方式</view>
<view class="Way-type">
<view class="Way-type-item " :class="[GetMODE == 'EAT_IN'?`theme-Union-Class-${BrandInfor['brand_id']}-1`:'']"
@tap="InforPage('EAT_IN')">
<view class="Way-type-item-img">
<image class="img" :src="qnyurl('diannei.png')" mode="aspectFit"></image>
</view>
<view class="Way-type-item-right">
<view class="Way-type-item-right-text1">
店内就餐
</view>
<view class="Way-type-item-right-text2">
Dine In
</view>
</view>
</view>
<view class="Way-type-item" :class="[GetMODE == 'TAKE_AWAY'?`theme-Union-Class-${BrandInfor['brand_id']}-1`:'']"
@tap="InforPage('TAKE_AWAY')">
<view class="Way-type-item-img">
<image class="img" :src="qnyurl('dabao.png')" mode="aspectFit"></image>
</view>
<view class="Way-type-item-right">
<view class="Way-type-item-right-text1">
打包带走
</view>
<view class="Way-type-item-right-text2">
Take Away
</view>
</view>
</view>
</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
/**
* @肯德基首页
* */
//
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
import mixin from '@/static/js/mixin/mixin.js';
// //
import {
restaurantQueryAPI,
storeCollectionListAPI
} from '@/request/restaurant/index.js';
export default {
mixins: [mixin,restaurantmixins],
name: "b-page-home-mdl",
data() {
return {
//
eattypeShow: false,
eat_type: 'EAT_IN',
//
temporaryData: [],
//
CollectiontemporaryData: [],
// /
StoreList: [{
page: 1,
count: 0,
list: []
},
{
page: 1,
count: 0,
list: []
},
],
// scroll
height: 0,
//
keyword: '',
// tabs
tabsconfig: {
//
index: 0,
scrollable: false,
//
lineWidth: '40',
//
lineColor: "#FFBC0F",
list: [{
name: '附近餐厅',
}, {
name: '我的关注',
}]
},
//
loading:true,
};
},
computed: {
tabindex() {
return this['tabsconfig']['index']
},
},
watch: {
GetCityCode(val) {
console.log(val, '监听器');
//
this['StoreList'][0]['list'] = [];
this.GetList();
},
tabindex(val) {
if (val == 1) {
console.log(this['StoreList'][1]['list']);
this['StoreList'][1]['list'] = [];
this.GetstoreCollectionList();
}
}
},
mounted() {
console.log('进入选店组件');
this.initScrollView({
el: 'content-top'
}).then(res => {
this['height'] = res;
console.log(this['height'],'height')
//
this.GetList();
//
// this.GetstoreCollectionList();
})
},
methods: {
/**
* @搜索
* */
search() {
if (this['tabsconfig']['index'] == 0) {
this['StoreList'][0]['page'] = 1;
this['StoreList'][0]['list'] = [];
this.GetList();
return
}
this['StoreList'][1]['page'] = 1;
this['StoreList'][1]['list'] = [];
this.GetstoreCollectionList();
},
/**
* @获取餐厅列表
* */
GetList() {
this['loading'] = true;
let parameters = {
brand_id: this['BrandInfor']['brand_id'],
city_code: this.GetCityCode,
address: this['keyword'],
}
restaurantQueryAPI(parameters).then(res => {
this['loading'] = false;
console.log(res,'res')
if(res['data']['data']['length'] <= 0){
uni.showToast({
title:'该区域暂无数据',
icon:'none'
});
return;
}
//
if (res['data']['data']['length'] > 0) {
//
this['StoreList'][0]['count'] = res['count'];
//
this['temporaryData'] = res['data']['data'];
this['StoreList'][0]['page'] += 1;
//
this.arrObtain('temporaryData', 0);
} else {
console.log('没数');
}
})
},
/**
* @获取关注冽表
* */
GetstoreCollectionList() {
this['loading'] = true;
let parameters = {
brand_id: this['BrandInfor']['brand_id'],
address: this['keyword'],
}
storeCollectionListAPI(parameters).then(data => {
this['loading'] = false;
if (data['data']['data']['length'] > 0) {
//
this['StoreList'][1]['count'] = data['data']['count'];
//
this['CollectiontemporaryData'] = data['data']['data'];
this['StoreList'][1]['page'] += 1;
//
this.arrObtain('CollectiontemporaryData', 1);
} else {
console.log('没数');
}
})
},
/**
* @进入餐厅
* */
InforPage(type) {
//
this.SETMODE(type);
uni.navigateTo({
url: `/pages/restaurant/home/shop_home/shop_home?restaurant_id=${this['GetShopInfor']['restaurant_id']}`,
success: () => {
this['eattypeShow'] = false;
}
})
},
/**
* @scroll触底时间
* */
scrolltolower() {
//
uni.$u.debounce(() => {
// 0
if (this['tabsconfig']['index'] == 0 && this['temporaryData']['length'] > 0) {
this.arrObtain('temporaryData', 0);
} else {
this.arrObtain('CollectiontemporaryData', 1);
}
}, 800, true)
},
/**
* @获取数据前十个
* */
arrObtain(key, index) {
let arr = this[key].splice(0, 9);
this['StoreList'][index]['list'].push(...arr);
}
}
}
</script>
<style lang="scss">
// //
.content-top {
width: 100%;
height: auto;
background-color: #ffffff;
&-process {
position: relative;
width: 100%;
height: 210rpx;
.img {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
}
&-process {
display: flex;
justify-content: space-between;
align-items: center;
background-color: #F4F4F4;
// background-image: url(https://img.agrimedia.cn/chwl/v2/choose.png);
// background-size: 100% 100%;
// background-repeat: no-repeat;
padding: 0 32rpx;
box-sizing: border-box;
&-item {
display: flex;
flex-direction: column;
align-items: center;
font-size: $FONTSIZE28;
color: #000000;
&-img {
width: 84rpx;
height: 84rpx;
border-radius: 50%;
box-shadow: 0 0 20rpx rgba(255, 255, 255, 0.3);
margin-bottom: 13rpx;
}
}
}
&-search {
background-color: #ffffff;
padding-top: 32rpx;
&-area-search {
padding: 0 32rpx;
box-sizing: border-box;
display: flex;
align-items: center;
&-text {
font-size: $FONTSIZE28;
display: flex;
align-items: center;
.icon-youjiantou {
font-size: $FONTSIZE25;
color: #666666;
margin: 0 15rpx;
}
}
}
}
}
//
.Store-List {
padding: 0 32rpx;
position: relative;
background-color: #ffffff;
&-Item {
width: 100%;
height: auto;
background-color: #ffffff;
border-radius: 15rpx;
min-height: 155rpx;
padding: 32rpx;
margin-top: 20rpx;
display: flex;
align-items:center;
.infot{
flex: 1;
}
.btn{
width: 146rpx;
height: 56rpx;
border: 2rpx solid #FFBC0F;
border-radius: 28rpx;
text-align: center;
line-height: 56rpx;
font-size: 28rpx;
color: #FFA200;
margin-left: 15rpx;
}
&-Top {
&-Name {
font-size: $FONTSIZE30;
color: $THEMECOLOR4;
margin-right: 20rpx;
}
&-distance {
font-size: $FONTSIZE26;
color: $THEMECOLOR5;
flex: 1;
}
}
&-Area {
font-size: $FONTSIZE26;
}
}
}
//
.poupconten {
width: 100%;
height: 656rpx;
background-color: #ffffff;
padding: 32rpx;
.shop-inofr {
margin-bottom: 50rpx;
&-name {
font-size: $FONTSIZE32;
display: flex;
align-items: center;
margin-bottom: 20rpx;
.icon {
width: 33rpx;
height: 30rpx;
margin-right: 20rpx;
}
}
&-area {
font-size: $FONTSIZE24;
color: #999999;
}
}
.hint {
font-size: $FONTSIZE24;
line-height: 45rpx;
// .text1 {
// color: #DA2F35;
// }
.text2 {
color: #999999;
}
}
//
.Way {
width: 100%;
&-title {
font-size: $FONTSIZE24;
color: #333333;
line-height: 40rpx;
}
&-type {
width: 100%;
display: flex;
justify-content: space-between;
margin-top: 32rpx;
&-rightactivation {
color: #FFFFFF !important;
border-color: #DE393F !important;
background-color: #DE393F !important;
}
&-item {
width: 320rpx;
height: 130rpx;
border: 1rpx solid #E3E3E3;
border-radius: 6rpx;
text-align: center;
color: #666666;
border-radius: 10rpx;
display: flex;
align-items: center;
justify-content: space-around;
&-img {
width: 74rpx;
height: 61rpx;
.img {
width: 100%;
height: 100%;
}
}
&-right {
display: flex;
flex-direction: column;
justify-content: center;
&-text1 {
font-size: $FONTSIZE30;
}
&-text2 {
font-size: $FONTSIZE24;
}
}
}
}
}
}
</style>

View File

@ -0,0 +1,598 @@
<template>
<view class="b-page-home">
<view class="content-top">
<view class="content-top-process">
<view class="content-top-process-item">
<image class="content-top-process-item-img" src="https://img.agrimedia.cn/chwl/v2/choose_two.png"
mode=""></image>
<view class="content-top-process-item-text">
选择餐厅
</view>
</view>
<view class="content-top-process-item">
<image class="content-top-process-item-img" src="https://img.agrimedia.cn/chwl/v2/choose_two.png"
mode=""></image>
<view class="content-top-process-item-text">
选择菜品
</view>
</view>
<view class="content-top-process-item">
<image class="content-top-process-item-img" src="https://img.agrimedia.cn/chwl/v2/choose_two.png"
mode=""></image>
<view class="content-top-process-item-text">
等待取餐码
</view>
</view>
<view class="content-top-process-item">
<image class="content-top-process-item-img" src="https://img.agrimedia.cn/chwl/v2/choose_two.png"
mode=""></image>
<view class="content-top-process-item-text">
到店取餐
</view>
</view>
</view>
<!-- 地址/搜索/选择 -->
<view class="content-top-search">
<view class="content-top-search-area-search">
<navigator url="/pages/restaurant/arealist/arealist" hover-class="none">
<view class="content-top-search-area-search-text">
<!-- 第一次获取肯定是获取不到的主要是动态显示用户改变的地址 -->
{{UserArae1?UserArae1:UserArae2['city']}}
<view style="transform: rotate(90deg);">
<text class="icon iconfont icon-youjiantou"></text>
</view>
</view>
</navigator>
<u-search placeholder="输入门店名称查询" :showAction="false" v-model="keyword" @search="search">
</u-search>
</view>
<view class="content-top-search-tabs">
<u-tabs @change="e=>{tabsconfig['index'] = e['index']}" :list="tabsconfig['list']"
:scrollable="tabsconfig['scrollable']" :lineColor="tabsconfig['lineColor']"
:lineWidth="tabsconfig['lineWidth']"></u-tabs>
</view>
</view>
</view>
<!-- 店铺列表 -->
<!-- 因为骨架屏的颜色和UI设置背景色冲突所以在没有列表元素时先将背景色设置为白色 -->
<view class="Store-List" :style="{height:`${height}rpx`,'background-color':loading? '#ffffff':'#F2F2F2'}">
<!-- 附近餐厅 -->
<view v-show="tabsconfig['index'] == 0">
<scroll-view scroll-y="true" class="scroll-Y" :style="{height:`${height}rpx`}"
@scrolltolower="scrolltolower">
<template v-for="(item,index) in StoreList[0]['list']">
<view class="Store-List-Item" @tap="SETSHOPDETAIL(item);eattypeShow = true;" :key="index">
<view class="Store-List-Item-Top">
<view class="Store-List-Item-Top-Name">
{{item['restaurant_name']}}
</view>
<b-restaurant-state></b-restaurant-state>
<view class="Store-List-Item-Top-distance">
{{item['distance']}}m
</view>
</view>
<view class="Store-List-Item-Area">
{{item['restaurant_address']}}
</view>
</view>
</template>
<view class="default" v-if="StoreList[0]['list']['length'] <= 0">
<img class="img" :src="qnyurl('default.png','rx')" alt="">
<text>该地区暂无门店信息</text>
</view>
</scroll-view>
</view>
<!-- 我的收藏 -->
<view v-show="tabsconfig['index'] == 1">
<scroll-view scroll-y="true" class="scroll-Y" :style="{height:`${height}rpx`}"
@scrolltolower="scrolltolower">
<template v-for="(item,index) in StoreList[1]['list']">
<view class="Store-List-Item" @tap="SETSHOPDETAIL(item);eattypeShow = true;" :key="index">
<view class="Store-List-Item-Top">
<view class="Store-List-Item-Top-Name">
{{item['restaurant_name']}}
</view>
<b-restaurant-state></b-restaurant-state>
<view class="Store-List-Item-Top-distance">
{{item['distance']}}m
</view>
</view>
<view class="Store-List-Item-Area">
{{item['restaurant_address']}}
</view>
</view>
</template>
<view class="default" v-if="StoreList[1]['list']['length'] <= 0">
<img class="img" :src="qnyurl('default.png','rx')" alt="">
<text>该地区暂无门店信息</text>
</view>
</scroll-view>
</view>
<!-- 加载状态 -->
<b-load :show="loading && height>0" position="absolute" width="79" height="80" color="#000000"></b-load>
</view>
<!-- 选择就餐方式弹框 -->
<u-popup :show="eattypeShow" @close="eattypeShow = false" closeable>
<view class="poupconten">
<view class="shop-inofr">
<view class="shop-inofr-name">
<image class="icon" :src="qnyurl('sopicon.png')" mode=""></image>
<text>{{GetShopInfor['restaurant_name']}}</text>
</view>
<view class="shop-inofr-area">
{{GetShopInfor['restaurant_address']}}
</view>
</view>
<view class="hint">
温馨提示<text class="text1">肯德基点餐为第三方供应商提供的代下单服务暂不支持外卖</text><text
class="text2">出餐后可凭取餐码到店取餐如有疑问请及时联系在线客服</text>
</view>
<view class="Way">
<view class="Way-title">请选择就餐方式</view>
<view class="Way-type">
<view class="Way-type-item " :class="[GetMODE == 'EAT_IN'?'Way-type-rightactivation':'']"
@tap="InforPage('EAT_IN')">
<view class="Way-type-item-img">
<image class="img" :src="qnyurl('diannei.png')" mode="aspectFit"></image>
</view>
<view class="Way-type-item-right">
<view class="Way-type-item-right-text1">
店内就餐
</view>
<view class="Way-type-item-right-text2">
Dine In
</view>
</view>
</view>
<view class="Way-type-item" :class="[GetMODE == 'TAKE_AWAY'?'Way-type-rightactivation':'']"
@tap="InforPage('TAKE_AWAY')">
<view class="Way-type-item-img">
<image class="img" :src="qnyurl('dabao.png')" mode="aspectFit"></image>
</view>
<view class="Way-type-item-right">
<view class="Way-type-item-right-text1">
打包带走
</view>
<view class="Way-type-item-right-text2">
Take Away
</view>
</view>
</view>
</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
/**
* @肯德基首页
* */
//
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
import mixin from '@/static/js/mixin/mixin.js';
// //
import {
restaurantQueryAPI,
storeCollectionListAPI
} from '@/request/restaurant/index.js';
export default {
mixins: [mixin,restaurantmixins],
name: "b-page-home",
data() {
return {
//
eattypeShow: false,
eat_type: 'EAT_IN',
//
temporaryData: [],
//
CollectiontemporaryData: [],
// /
StoreList: [{
page: 1,
count: 0,
list: []
},
{
page: 1,
count: 0,
list: []
},
],
// scroll
height: 0,
//
keyword: '',
// tabs
tabsconfig: {
//
index: 0,
scrollable: false,
//
lineWidth: '40',
//
lineColor: "#C63836",
list: [{
name: '附近餐厅',
}, {
name: '我的关注',
}]
},
//
loading:true,
};
},
computed: {
tabindex() {
return this['tabsconfig']['index']
},
},
watch: {
GetCityCode(val) {
console.log(val, '监听器');
//
this['StoreList'][0]['list'] = [];
this.GetList();
},
tabindex(val) {
if (val == 1) {
console.log(this['StoreList'][1]['list']);
this['StoreList'][1]['list'] = [];
this.GetstoreCollectionList();
}
}
},
mounted() {
console.log('进入选店组件');
this.initScrollView({
el: 'content-top'
}).then(res => {
this['height'] = res;
console.log(this['height'],'height')
//
this.GetList();
//
// this.GetstoreCollectionList();
})
},
methods: {
/**
* @搜索
* */
search() {
if (this['tabsconfig']['index'] == 0) {
this['StoreList'][0]['page'] = 1;
this['StoreList'][0]['list'] = [];
this.GetList();
return
}
this['StoreList'][1]['page'] = 1;
this['StoreList'][1]['list'] = [];
this.GetstoreCollectionList();
},
/**
* @获取餐厅列表
* */
GetList() {
this['loading'] = true;
let parameters = {
brand_id: this['BrandInfor']['brand_id'],
city_code: this.GetCityCode,
address: this['keyword'],
}
restaurantQueryAPI(parameters).then(res => {
this['loading'] = false;
console.log(res,'res')
if(res['data']['data']['length'] <= 0){
uni.showToast({
title:'该区域暂无数据',
icon:'none'
});
return;
}
//
if (res['data']['data']['length'] > 0) {
//
this['StoreList'][0]['count'] = res['count'];
//
this['temporaryData'] = res['data']['data'];
this['StoreList'][0]['page'] += 1;
//
this.arrObtain('temporaryData', 0);
} else {
console.log('没数');
}
})
},
/**
* @获取关注冽表
* */
GetstoreCollectionList() {
this['loading'] = true;
let parameters = {
brand_id: this['BrandInfor']['brand_id'],
address: this['keyword'],
}
storeCollectionListAPI(parameters).then(data => {
this['loading'] = false;
if (data['data']['data']['length'] > 0) {
//
this['StoreList'][1]['count'] = data['data']['count'];
//
this['CollectiontemporaryData'] = data['data']['data'];
this['StoreList'][1]['page'] += 1;
//
this.arrObtain('CollectiontemporaryData', 1);
} else {
console.log('没数');
}
})
},
/**
* @进入餐厅
* */
InforPage(type) {
//
this.SETMODE(type);
uni.navigateTo({
url: `/pages/restaurant/home/shop_home/shop_home?restaurant_id=${this['GetShopInfor']['restaurant_id']}`,
success: () => {
this['eattypeShow'] = false;
}
})
},
/**
* @scroll触底时间
* */
scrolltolower() {
//
uni.$u.debounce(() => {
// 0
if (this['tabsconfig']['index'] == 0 && this['temporaryData']['length'] > 0) {
this.arrObtain('temporaryData', 0);
} else {
this.arrObtain('CollectiontemporaryData', 1);
}
}, 800, true)
},
/**
* @获取数据前十个
* */
arrObtain(key, index) {
let arr = this[key].splice(0, 9);
this['StoreList'][index]['list'].push(...arr);
}
}
}
</script>
<style lang="scss">
// //
.content-top {
width: 100%;
height: auto;
background-color: #ffffff;
&-process {
position: relative;
width: 100%;
height: 210rpx;
.img {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
}
&-process {
display: flex;
justify-content: space-between;
align-items: center;
background-image: url(https://img.agrimedia.cn/chwl/v2/choose.png);
background-size: 100% 100%;
background-repeat: no-repeat;
padding: 0 32rpx;
box-sizing: border-box;
&-item {
display: flex;
flex-direction: column;
align-items: center;
font-size: $FONTSIZE28;
color: #FCFCFC;
&-img {
width: 84rpx;
height: 84rpx;
border-radius: 50%;
box-shadow: 0 0 20rpx rgba(255, 255, 255, 0.3);
margin-bottom: 13rpx;
}
}
}
&-search {
background-color: #ffffff;
padding-top: 32rpx;
&-area-search {
padding: 0 32rpx;
box-sizing: border-box;
display: flex;
align-items: center;
&-text {
font-size: $FONTSIZE28;
display: flex;
align-items: center;
.icon-youjiantou {
font-size: $FONTSIZE25;
color: #666666;
margin: 0 15rpx;
}
}
}
}
}
//
.Store-List {
padding: 0 32rpx;
position: relative;
&-Item {
width: 100%;
height: auto;
background-color: #ffffff;
border-radius: 15rpx;
min-height: 155rpx;
padding: 32rpx;
margin-top: 20rpx;
&-Top {
display: flex;
align-items: flex-end;
margin-bottom: 30rpx;
&-Name {
font-size: $FONTSIZE30;
color: $THEMECOLOR4;
margin-right: 20rpx;
}
&-distance {
font-size: $FONTSIZE26;
color: $THEMECOLOR5;
flex: 1;
text-align: right;
}
}
&-Area {
font-size: $FONTSIZE26;
}
}
}
//
.poupconten {
width: 100%;
height: 656rpx;
background-color: #ffffff;
padding: 32rpx;
.shop-inofr {
margin-bottom: 50rpx;
&-name {
font-size: $FONTSIZE32;
display: flex;
align-items: center;
margin-bottom: 20rpx;
.icon {
width: 33rpx;
height: 30rpx;
margin-right: 20rpx;
}
}
&-area {
font-size: $FONTSIZE24;
color: #999999;
}
}
.hint {
font-size: $FONTSIZE24;
line-height: 45rpx;
.text1 {
color: #DA2F35;
}
.text2 {
color: #999999;
}
}
//
.Way {
width: 100%;
&-title {
font-size: $FONTSIZE24;
color: #333333;
line-height: 40rpx;
}
&-type {
width: 100%;
display: flex;
justify-content: space-between;
margin-top: 32rpx;
&-rightactivation {
color: #FFFFFF !important;
border-color: #DE393F !important;
background-color: #DE393F !important;
}
&-item {
width: 320rpx;
height: 130rpx;
border: 1rpx solid #E3E3E3;
border-radius: 6rpx;
text-align: center;
color: #666666;
border-radius: 10rpx;
display: flex;
align-items: center;
justify-content: space-around;
&-img {
width: 74rpx;
height: 61rpx;
.img {
width: 100%;
height: 100%;
}
}
&-right {
display: flex;
flex-direction: column;
justify-content: center;
&-text1 {
font-size: $FONTSIZE30;
}
&-text2 {
font-size: $FONTSIZE24;
}
}
}
}
}
}
</style>

View File

@ -0,0 +1,396 @@
<template>
<view class="b-page-home">
<view class="content-top">
<view class="content-top-banner">
<image class="img" :src="qnyurl('banner-1.jpg','rx')" mode=""></image>
</view>
<!-- 地址/搜索/选择 -->
<view class="content-top-search">
<view class="content-top-search-area-search">
<navigator url="/pages/restaurant/arealist/arealist" hover-class="none">
<view class="content-top-search-area-search-text">
<!-- 第一次获取肯定是获取不到的主要是动态显示用户改变的地址 -->
{{UserArae1?UserArae1:UserArae2['city']}}
<view
style="width: 50rpx;height: 30rpx;display: flex;justify-content: center;align-items: center;">
<image style="width: 15rpx;height: 12rpx;" class="img" :src="qnyurl('xiala.jpg','rx')">
</image>
</view>
</view>
</navigator>
<u-search placeholder="输入门店名称查询" :showAction="false" v-model="keyword" @search="search">
</u-search>
</view>
<!-- 收藏项 -->
<!-- <view class="content-top-search-tabs">
<u-tabs @change="e=>{tabsconfig['index'] = e['index']}" :list="tabsconfig['list']"
:scrollable="tabsconfig['scrollable']" :lineColor="tabsconfig['lineColor']"
:lineWidth="tabsconfig['lineWidth']"></u-tabs>
</view> -->
</view>
</view>
<!-- 店铺列表 -->
<!-- 因为骨架屏的颜色和UI设置背景色冲突所以在没有列表元素时先将背景色设置为白色 -->
<view class="Store-List" :style="{height:`${height}rpx`,'background-color':'#F2F2F2'}">
<!-- 附近餐厅 -->
<view v-show="tabsconfig['index'] == 0">
<scroll-view scroll-y="true" class="scroll-Y" :style="{height:`${height}rpx`,'position': 'relative'}"
@scrolltolower="scrolltolower">
<!-- 骨架屏占位元素 -->
<template v-if="StoreList[0]['list']['length'] > 0">
<!-- 组件内部会获取到品牌类型,从而显示对应类型的店铺列表样式 -->
<view style="padding-bottom: 32rpx;" v-for="(item,index) in StoreList[0]['list']">
<!-- 店铺列表样式 -->
<b-shop-list-item :item="item" :key="index" @itemclick="SETSHOPDETAIL(item);eattypeShow = true">
</b-shop-list-item>
</view>
</template>
<template v-else>
<!-- 必须先确保scoll有高度 -->
<!-- 缺省图 -->
<view class="default" v-if="Show == 1">
<img class="img" :src="qnyurl('default.png','rx')" alt="">
<text>该地区暂无门店信息</text>
</view>
<!-- 加载中 -->
<b-load :show="Show == 2" position="absolute" background="transparent" width="79" height="80" color="#000000"></b-load>
</template>
<!-- <b-shop-load type="load" width="79" height="74" :show="loading"></b-shop-load> -->
</scroll-view>
</view>
</view>
<u-modal :show="eattypeShow" title="温馨提示" width="580rpx">
<template v-slot:default>
<view class="slot-content">
<view class="slot-content-Tips">
瑞幸咖啡点餐为<text class="text1">第三方提供的点餐服务</text>该服务与瑞幸官方无关有问题请联系在线客服
</view>
<view class="slot-content-Tips2">
<view>
优惠点餐不支持开发票!
</view>
<view>
出餐后不支持退款
</view>
</view>
</view>
</template>
<template v-slot:confirmButton>
<view class="confirmButton" @tap="InforPage">
我知道了
</view>
</template>
</u-modal>
</view>
</template>
<script>
import mixin from '@/static/js/mixin/mixin.js';
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
//
import {
restaurantQueryAPI,
storeCollectionListAPI
} from '@/request/restaurant/index.js';
// vuex
import {
mapGetters,
mapMutations
} from 'vuex';
export default {
mixins: [mixin,restaurantmixins],
name: "b-page-home",
data() {
return {
//
eattypeShow: false,
eat_type: 'EAT_IN',
//
temporaryData: [],
//
CollectiontemporaryData: [],
// /
StoreList: [{
page: 1,
count: 0,
list: []
},
{
page: 1,
count: 0,
list: []
},
],
// scroll
height: 0,
//
keyword: '',
// tabs
tabsconfig: {
//
index: 0,
scrollable: false,
//
lineWidth: '40',
//
lineColor: "#C63836",
list: [{
name: '附近餐厅',
}, {
name: '我的关注',
}]
},
//
loading: true,
};
},
computed: {
tabindex() {
return this['tabsconfig']['index']
},
Show(){
console.log(this['StoreList'][0]['list']['length'],'length');
console.log(this['loading'],'loading');
//
if(this['StoreList'][0]['list']['length'] <= 0 && !this['loading'] && this['height'] > 0){
return 1;
};
//
if(this['loading'] && this['height'] > 0){
return 2
}
}
// islist(){
// return this['StoreList'][0]['list']['length'] <= 0;
// }
},
watch: {
GetCityCode(val) {
console.log(val, '监听器');
//
this['StoreList'][0]['list'] = [];
this.GetList();
},
tabindex(val) {
if (val == 1) {
console.log(this['StoreList'][1]['list']);
this['StoreList'][1]['list'] = [];
this.GetstoreCollectionList();
}
}
},
mounted() {
console.log('进入选店组件');
this.GetList();
},
methods: {
/**
* @搜索
* */
search() {
if (this['tabsconfig']['index'] == 0) {
this['StoreList'][0]['page'] = 1;
this['StoreList'][0]['list'] = [];
this.GetList();
return
}
this['StoreList'][1]['page'] = 1;
this['StoreList'][1]['list'] = [];
this.GetstoreCollectionList();
},
/**
* @获取餐厅列表
* */
GetList() {
let self = this;
this['loading'] = true;
// DOM
setTimeout(()=>{
self.initScrollView({
el: 'content-top',
}).then(eres => {
self['height'] = eres;
let parameters = {
brand_id: this['BrandInfor']['brand_id'],
city_code: this.GetCityCode,
address: this['keyword'],
}
restaurantQueryAPI(parameters).then(res => {
console.log(res,'ressssssss');
self['loading'] = false;
if (res['data']['data']['length'] <= 0) {
uni.showToast({
title: '该区域暂无数据',
icon: 'none'
});
return;
}
//
if (res['data']['data']['length'] > 0) {
//
self['StoreList'][0]['count'] = res['data']['count'];
//
self['temporaryData'] = res['data']['data'];
self['StoreList'][0]['page'] += 1;
//
self.arrObtain('temporaryData', 0);
} else {
console.log('没数1');
}
}).catch(err=>{
self['loading'] = false;
})
})
},1000)
},
/**
* @获取关注冽表
* */
GetstoreCollectionList() {
let parameters = {
brand_id: this['BrandInfor']['brand_id'],
address: this['keyword'],
}
storeCollectionListAPI(parameters).then(data => {
if (data['data']['length'] > 0) {
//
this['StoreList'][1]['count'] = data['data']['count'];
//
this['CollectiontemporaryData'] = data['data']['data'];
this['StoreList'][1]['page'] += 1;
//
this.arrObtain('CollectiontemporaryData', 1);
} else {
console.log('没数');
}
})
},
/**
* @进入餐厅
* */
InforPage(item) {
uni.navigateTo({
url: `/pages/restaurant/home/shop_home/shop_home?restaurant_id=${this['GetShopInfor']['restaurant_id']}`,
success: () => {
this['eattypeShow'] = false;
}
})
},
/**
* @scroll触底时间
* */
scrolltolower() {
//
uni.$u.debounce(() => {
// 0
if (this['tabsconfig']['index'] == 0 && this['temporaryData']['length'] > 0) {
this.arrObtain('temporaryData', 0);
} else {
this.arrObtain('CollectiontemporaryData', 1);
}
}, 800, true)
},
/**
* @获取数据前十个
* */
arrObtain(key, index) {
let arr = this[key].splice(0, 9);
this['StoreList'][index]['list'].push(...arr);
console.log(this['StoreList'][index]['list'], 'list');
}
}
}
</script>
<style lang="scss">
// //
.content-top {
width: 100%;
height: auto;
background-color: #ffffff;
&-banner {
width: 100%;
height: 314rpx;
.img {
width: 100%;
height: 100%;
}
}
&-search {
background-color: #ffffff;
padding: 32rpx;
&-area-search {
padding: 0 32rpx;
box-sizing: border-box;
display: flex;
align-items: center;
&-text {
font-size: $FONTSIZE28;
display: flex;
align-items: center;
.icon-youjiantou {
font-size: $FONTSIZE25;
color: #666666;
margin: 0 15rpx;
}
}
}
}
}
//
.Store-List {
padding: 0 32rpx;
}
//
.slot-content-Tips {
font-size: 30rpx;
line-height: 40rpx;
.text1 {
color: #DB9F5E;
}
}
.slot-content-Tips2 {
width: 100%;
background-color: #FFF9F3;
margin-top: 20rpx;
color: #FF7910;
font-size: 26rpx;
line-height: 49rpx;
padding: 15rpx 32rpx;
}
.confirmButton{
background: linear-gradient(-77deg, #4A6FE7, #83ACFF);
border-radius: 43px;
color: #ffffff;
font-size: 30rpx;
text-align: center;
line-height: 80rpx;
}
</style>

View File

@ -0,0 +1,648 @@
<template>
<view class="b-page-home">
<view class="content-top">
<view class="store_background">
<image class="store_background-img" :src="qnyurl('store_background.jpg','xbk')" mode="widthFix"></image>
<view class="store_background-content">
<view class="store_background-content-text1">
<image class="img" :src="qnyurl('icon.png','xbk')" mode=""></image>
<text>自助点餐不支持外卖</text>
</view>
<view class="store_background-content-text2">
到店前10~15分钟在线点餐到店后直接在取品台领取即可
</view>
</view>
</view>
<!-- 步骤 -->
<view class="content-top-process">
<view class="content-top-process-item">
<image class="content-top-process-item-img" :src="qnyurl('choose_one.png','xbk')" mode=""></image>
<view class="content-top-process-item-text">
选择餐厅
<text class="content-top-process-item-text-choose"></text>
</view>
</view>
<view class="content-top-process-item">
<image class="content-top-process-item-img" :src="qnyurl('choose_two.png','xbk')" mode=""></image>
<view class="content-top-process-item-text">
选择菜品
<text class="content-top-process-item-text-choose"></text>
</view>
</view>
<view class="content-top-process-item">
<image class="content-top-process-item-img" :src="qnyurl('choose_three.png','xbk')" mode=""></image>
<view class="content-top-process-item-text">
等待取餐码
<text class="content-top-process-item-text-choose"></text>
</view>
</view>
<view class="content-top-process-item">
<image class="content-top-process-item-img" :src="qnyurl('choose_four.png','xbk')" mode=""></image>
<view class="content-top-process-item-text">
到店取餐
</view>
</view>
</view>
<!-- 占位元素 -->
<view style="width: 100%;height: 100rpx;"></view>
<!-- 搜索店铺/地址选择 -->
<view class="content-top-search">
<view class="content-top-search-area-search">
<navigator url="/pages/restaurant/arealist/arealist" hover-class="none">
<view class="content-top-search-area-search-text">
<!-- 第一次获取肯定是获取不到的主要是动态显示用户改变的地址 -->
{{UserArae1?UserArae1:UserArae2['city']}}
<view style="transform: rotate(90deg);">
<text class="icon iconfont icon-youjiantou"></text>
</view>
</view>
</navigator>
<u-search placeholder="输入门店名称查询" :showAction="false" v-model="keyword" @search="search">
</u-search>
</view>
<view class="content-top-search-tabs">
<u-tabs @change="e=>{tabsconfig['index'] = e['index']}" :list="tabsconfig['list']"
:scrollable="tabsconfig['scrollable']" :lineColor="tabsconfig['lineColor']"
:lineWidth="tabsconfig['lineWidth']"></u-tabs>
</view>
</view>
</view>
<view class="Store-List" :style="{height:`${height}rpx`,'background-color':loading? '#ffffff':'#F2F2F2'}">
<!-- 附近餐厅 -->
<view v-show="tabsconfig['index'] == 0">
<scroll-view scroll-y="true" class="scroll-Y" :style="{height:`${height}rpx`}"
@scrolltolower="scrolltolower">
<!-- 骨架屏占位元素 -->
<template v-for="(item,index) in StoreList[0]['list']">
<view class="Store-List-Item" @tap="PageShopHome(item)" :key="index">
<view class="Store-List-Item-Top">
<view class="Store-List-Item-Top-Name">
{{item['restaurant_name']}}
</view>
<view class="Store-List-Item-Top-distance">
{{item['distance']}}km
</view>
</view>
<view class="Store-List-Item-Area">
{{item['restaurant_address']}}
</view>
</view>
</template>
<view style="width: 100%;height: 32rpx;"></view>
<view class="default" v-if="StoreList[0]['list']['length'] <= 0">
<img class="img" :src="qnyurl('default.png','rx')" alt="">
<text>该地区暂无门店信息</text>
</view>
</scroll-view>
</view>
<!-- 我的收藏 -->
<view v-show="tabsconfig['index'] == 1">
<scroll-view scroll-y="true" class="scroll-Y" :style="{height:`${height}rpx`}"
@scrolltolower="scrolltolower">
<template v-for="(item,index) in StoreList[1]['list']">
<view class="Store-List-Item" @tap="PageShopHome(item)" :key="index">
<view class="Store-List-Item-Top">
<view class="Store-List-Item-Top-Name">
{{item['restaurant_name']}}
</view>
<view class="Store-List-Item-Top-distance">
{{item['distance']}}m
</view>
</view>
<view class="Store-List-Item-Area">
{{item['restaurant_address']}}
</view>
</view>
</template>
<view style="width: 100%;height: 32rpx;"></view>
<view class="default" v-if="StoreList[1]['list']['length'] <= 0">
<img class="img" :src="qnyurl('default.png','rx')" alt="">
<text>该地区暂无门店信息</text>
</view>
</scroll-view>
</view>
<!-- 加载状态 -->
<b-load :show="loading && height>0" position="absolute" width="79" height="80" color="#000000"></b-load>
<!-- 必须先确保scoll有高度 -->
</view>
</view>
</template>
<script>
/**
* @肯德基首页
* */
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
import mixin from '@/static/js/mixin/mixin.js';
//
import {
restaurantQueryAPI,
storeCollectionListAPI
} from '@/request/restaurant/index.js';
// vuex
import {
mapGetters,
mapMutations
} from 'vuex';
export default {
mixins: [mixin,restaurantmixins],
name: "b-page-home",
data() {
return {
//
eattypeShow: false,
eat_type: 'EAT_IN',
//
temporaryData: [],
//
CollectiontemporaryData: [],
// /
StoreList: [{
page: 1,
count: 0,
list: []
},
{
page: 1,
count: 0,
list: []
},
],
// scroll
height: 0,
//
keyword: '',
// tabs
tabsconfig: {
//
index: 0,
scrollable: false,
//
lineWidth: '40',
//
lineColor: "#00AF66",
list: [{
name: '附近餐厅',
}, {
name: '我的关注',
}]
},
//
loading: true,
//
Show:false
};
},
computed: {
tabindex() {
return this['tabsconfig']['index']
},
// islist(){
// return this['StoreList'][0]['list']['length'] <= 0;
// }
},
watch: {
GetCityCode(val) {
console.log(val, '监听器');
//
this['StoreList'][0]['list'] = [];
this.GetList();
},
tabindex(val) {
if (val == 1) {
console.log(this['StoreList'][1]['list']);
this['StoreList'][1]['list'] = [];
this.GetstoreCollectionList();
}
},
},
mounted() {
console.log('进入选店组件');
//
this.GetList();
},
methods: {
...mapMutations({
SETSHOPDETAIL: 'shopping/SETSHOPDETAIL',
SETMODE: 'shopping/SETMODE'
}),
/**
* @搜索
* */
search() {
if (this['tabsconfig']['index'] == 0) {
this['StoreList'][0]['page'] = 1;
this['StoreList'][0]['list'] = [];
this.GetList();
return
}
this['StoreList'][1]['page'] = 1;
this['StoreList'][1]['list'] = [];
this.GetstoreCollectionList();
},
/**
* @获取餐厅列表
* */
GetList() {
let self = this;
//
self['loading'] = true;
//
self['Show'] = false;
//
setTimeout(()=>{
self.initScrollView({
el: 'content-top',
}).then(eres => {
console.log(eres,'resresresres');
self['height'] = eres;
let parameters = {
brand_id: this['BrandInfor']['brand_id'],
city_code: this.GetCityCode,
address: this['keyword'],
}
restaurantQueryAPI(parameters).then(res => {
console.log(res,'餐厅列表');
self['loading'] = false;
//
if (res['data']['data']['length'] > 0) {
//
self['StoreList'][0]['count'] = res['count'];
//
self['temporaryData'] = res['data']['data'];
self['StoreList'][0]['page'] += 1;
//
self.arrObtain('temporaryData', 0);
} else {
self['Show'] = true;
console.log('没数');
};
})
});
},800)
},
/**
* @获取关注冽表
* */
GetstoreCollectionList() {
//
this['loading'] = true;
//
this['Show'] = false;
let parameters = {
brand_id: this['BrandInfor']['brand_id'],
address: this['keyword'],
}
storeCollectionListAPI(parameters).then(data => {
this['loading'] = false;
if (data['data']['data']['length'] > 0) {
//
this['StoreList'][1]['count'] = data['data']['count'];
//
this['CollectiontemporaryData'] = data['data']['data'];
this['StoreList'][1]['page'] += 1;
//
this.arrObtain('CollectiontemporaryData', 1);
} else {
this['Show'] = false;
console.log('没数');
};
})
},
/**
* @进入餐厅
* */
InforPage(type) {
//
this.SETMODE(type);
uni.navigateTo({
url: `/pages/restaurant/home/shop_home/shop_home?restaurant_id=${this['GetShopInfor']['restaurant_id']}`,
success: () => {
this['eattypeShow'] = false;
}
})
},
/**
* @scroll触底事件
* */
scrolltolower() {
//
uni.$u.debounce(() => {
// 0
if (this['tabsconfig']['index'] == 0 && this['temporaryData']['length'] > 0) {
this.arrObtain('temporaryData', 0);
} else {
this.arrObtain('CollectiontemporaryData', 1);
};
}, 800, true)
},
/**
* @获取数据前十个
* */
arrObtain(key, index) {
let arr = this[key].splice(0, 9);
this['StoreList'][index]['list'].push(...arr);
},
/**
* @进入店铺
* */
PageShopHome(item){
this.SETSHOPDETAIL(item);
uni.navigateTo({
url: `/pages/restaurant/home/shop_home/shop_home?restaurant_id=${this['GetShopInfor']['restaurant_id']}`,
})
}
}
}
</script>
<style lang="scss">
page{
background-color: #ffffff;
};
// //
.content-top {
width: 100%;
height: auto;
background-color: #ffffff;
position: relative;
.store_background {
width: 100%;
height: auto;
&-img {
width: 100%;
display: block;
}
&-content{
color: #ffffff;
padding: 20rpx 20rpx 0 20rpx;
position: absolute;
left: 0;
top: 0;
width: 100%;
&-text1{
font-size: 30rpx;
line-height: 60rpx;
display: flex;
align-items: center;
.img{
width: 20rpx;
height: 30rpx;
margin-right: 10rpx;
}
}
&-text2{
font-size: 24rpx;
opacity: 0.7;
}
}
}
// &-process {
// position: relative;
// width: 100%;
// height: 210rpx;
// .img {
// width: 100%;
// height: 100%;
// position: absolute;
// top: 0;
// left: 0;
// }
// }
&-process {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 32rpx;
box-sizing: border-box;
position: absolute;
width: 94%;
height: 210rpx;
top: 150rpx;
left: 50%;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
border-radius: 15rpx;
overflow: hidden;
background-repeat: no-repeat;
box-shadow: -5px 0px 20px 0px rgba(101, 101, 101, 0.2400);
background-color: #ffffff;
&-item {
display: flex;
flex-direction: column;
align-items: center;
font-size: $FONTSIZE25;
color: #333333;
&-img {
width: 84rpx;
height: 84rpx;
border-radius: 50%;
box-shadow: 0 0 20rpx rgba(255, 255, 255, 0.3);
margin-bottom: 13rpx;
}
&-text {
position: relative;
&-choose {
font-size: 25rpx;
position: absolute;
right: -60%;
top: -5%;
transform: translateX(-50%);
color: #a0a0a0;
display: flex;
align-items: center;
}
}
}
}
&-search {
background-color: #ffffff;
padding-top: 32rpx;
&-area-search {
padding: 0 32rpx;
box-sizing: border-box;
display: flex;
align-items: center;
&-text {
font-size: $FONTSIZE28;
display: flex;
align-items: center;
.icon-youjiantou {
font-size: $FONTSIZE25;
color: #666666;
margin: 0 15rpx;
}
}
}
}
}
//
.Store-List {
padding: 0 32rpx;
position: relative;
&-Item {
width: 100%;
height: auto;
background-color: #ffffff;
border-radius: 15rpx;
min-height: 155rpx;
padding: 32rpx;
margin-top: 20rpx;
&-Top {
display: flex;
align-items: flex-end;
margin-bottom: 30rpx;
&-Name {
font-size: $FONTSIZE30;
color: $THEMECOLOR4;
margin-right: 20rpx;
}
&-distance {
font-size: $FONTSIZE26;
color: $THEMECOLOR5;
flex: 1;
text-align: right;
}
}
&-Area {
font-size: $FONTSIZE26;
}
}
}
//
.poupconten {
width: 100%;
height: 656rpx;
background-color: #ffffff;
padding: 32rpx;
.shop-inofr {
margin-bottom: 50rpx;
&-name {
font-size: $FONTSIZE32;
display: flex;
align-items: center;
margin-bottom: 20rpx;
.icon {
width: 33rpx;
height: 30rpx;
margin-right: 20rpx;
}
}
&-area {
font-size: $FONTSIZE24;
color: #999999;
}
}
.hint {
font-size: $FONTSIZE24;
line-height: 45rpx;
.text1 {
color: #DA2F35;
}
.text2 {
color: #999999;
}
}
//
.Way {
width: 100%;
&-title {
font-size: $FONTSIZE24;
color: #333333;
line-height: 40rpx;
}
&-type {
width: 100%;
display: flex;
justify-content: space-between;
margin-top: 32rpx;
&-rightactivation {
color: #FFFFFF !important;
border-color: #DE393F !important;
background-color: #DE393F !important;
}
&-item {
width: 320rpx;
height: 130rpx;
border: 1rpx solid #E3E3E3;
border-radius: 6rpx;
text-align: center;
color: #666666;
border-radius: 10rpx;
display: flex;
align-items: center;
justify-content: space-around;
&-img {
width: 74rpx;
height: 61rpx;
.img {
width: 100%;
height: 100%;
}
}
&-right {
display: flex;
flex-direction: column;
justify-content: center;
&-text1 {
font-size: $FONTSIZE30;
}
&-text2 {
font-size: $FONTSIZE24;
}
}
}
}
}
}
</style>

View File

@ -0,0 +1,302 @@
<template>
<view class="content">
<view class="OrderToggleType">
<view class="typebtn" @tap="Typetoggle(0)">
待结算{{count['un_commission_total']}}
</view>
<view class="typebtn" @tap="Typetoggle(1)">
已结算{{count['commission_total']}}
</view>
</view>
<view class="order-list">
<scroll-view :scroll-top="0" scroll-y="true" class="scroll-Y"
:style="{'height':`${scrollHeight}rpx`}"
@scrolltolower="GetorderList">
<template v-for="(item,index) in List">
<!-- 肯德基 -->
<template v-if="item['brand_id'] == 1 || item['brand_id'] == 5">
<b-orders-kfc :key="index" :index="index" :item="item">
</b-orders-kfc>
</template>
<!-- 瑞幸 -->
<template v-if="item['brand_id'] == 13">
<b-orders-rx :key="index" :index="index" :item="item">
</b-orders-rx>
</template>
<!-- 星巴克 -->
<template v-if="item['brand_id'] == 10">
<b-orders-xbk :key="index" :index="index" :item="item">
</b-orders-xbk>
</template>
</template>
<template v-if="List['length'] <= 0">
<b-shop-load width="161" height="148" type="orders" :offset="['25%','0']"></b-shop-load>
</template>
</scroll-view>
</view>
<!-- 加载状态 -->
<b-load :show="loading" width="79" height="80" background="rgba(0,0,0,0.3)" type="load"></b-load>
</view>
</template>
<script>
import {
orderListAPI,
agOrderPayAPI,
cancelOrderAPI
} from '@/request/restaurant/index.js';
import bOrdersKfc from '@/components/b-orders/b-orders-kfc.vue'
import bOrdersRx from '@/components/b-orders/b-orders-rx.vue'
import bOrdersXbk from '@/components/b-orders/b-orders-xbk.vue'
import {
mapMutations,
mapGetters,
mapActions
} from 'vuex';
import mixin from '@/static/js/mixin/mixin.js';
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
export default {
name: "b-page-orders",
mixins:[mixin,restaurantmixins],
components: {
bOrdersKfc,
bOrdersRx,
bOrdersXbk
},
provide() {
return {
//
cancel: this.cancel,
//
Reorder: this.Reorder,
//
payments: this.payments
}
},
data() {
return {
List: [],
page: 1,
total: 0,
scrollHeight: 0,
// type
last_time_toggle:'',
type: '',
count: {
un_commission_total: 0,
commission_total: 0
},
//
loading:false
};
},
watch: {
//
// type() {
// this['page'] = 1;
// this.GetorderList();
// },
// // tab
// Getnavindex(){
// this['page'] = 1;
// this.GetorderList();
// },
Getnavindex(val) {
//
if (val != 0) {
this['type'] = '';
this.GetorderList();
}else{
this['loading'] = true;
this['page'] = 1;
this['List'] = [];
}
}
},
mounted() {
let self = this;
this['loading'] = true;
// scollview
console.log(self['NAVHEIGHT'],'------------');
setTimeout(()=>{
this.initScrollView({
el: 'OrderToggleType',
}).then(res => {
self.scrollHeight = res;
self.GetorderList();
})
},1000)
},
methods: {
/**
* @顶部选项
* */
Typetoggle(type){
// ,
console.log(this['last_time_toggle'],type);
if(this['last_time_toggle'] === type){
this['type'] = '';
}else{
this['type'] = type;
}
this['page'] = 1;
this['List'] = [];
this.GetorderList();
this['last_time_toggle'] = this['type'];
},
/**
* @获取订单列表
* */
GetorderList() {
// uni.showLoading({
// title: '...'
// });
let self = this;
orderListAPI({
page: this['page'],
type: this['type'],
brand_id: this['BrandInfor']['brand_id']
}).then(data => {
if (self['page'] == 1) {
self['List'] = [];
};
self['count'] = data['data']['count'];
self['List'].push(...data['data']['data']['data']);
self['total'] = data['data']['data']['total'];
self['page'] += 1;
// uni.hideLoading();
this['loading'] = false;
})
},
/**
* @再次支付
* */
payments(order_sn, restaurant_id) {
let self = this;
this.againpayment(order_sn)
// let redirect_url;
// //
// if (self['BrandInfor']['brand_id'] == 1) {
// redirect_url = `/pages/restaurant/order/order-status/order-status?order=${order_sn}`
// } else if (self['BrandInfor']['brand_id'] == 10) {
// //
// redirect_url = `/pages/restaurant/order/order-details/xbk-orders-details?order=${order_sn}`
// } else if (self['BrandInfor']['brand_id'] == 13) {
// //
// redirect_url = `/pages/restaurant/order/order-details/rx-orders-details?order=${order_sn}`
// }
// agOrderPayAPI({
// order_sn,
// type:3,
// redirect_url
// }).then(data => {
// location.href = data['data']['redirect_url'];
// })
},
/**
* @取消订单
* */
cancel(order_sn, index) {
cancelOrderAPI({
order_sn
}).then(data => {
this.$set(this['List'][index], 'status', 5);
this.$forceUpdate();
})
},
/**
* @重新下单
* */
Reorder(commodity) {
console.log(commodity,'重新下单商品');
uni.showLoading({
title:'加载中...',
})
let self = this;
let index = 0;
//
let {
restaurant_id,
latitude,
longitude,
restaurant_address,
restaurant_name
} = commodity[0];
this.SETSHOPDETAIL({
city_name: "",
close_time: "",
distance: "",
latitude,
longitude,
open_time: "",
province_name: "",
regoin_name: "",
restaurant_address,
restaurant_id,
restaurant_name,
special: false,
});
let add = function(){
console.log(`${index}个,总共有${commodity['length']-1}`);
self.ADD_CART({
commodity: commodity[index]
}).then(()=>{
if(index >= commodity['length']-1) {
uni.hideLoading();
uni.navigateTo({
url: `/pages/restaurant/home/shop_home/shop_home?restaurant_id=${restaurant_id}`
});
return;
};
index += 1;
add();
})
}
this.EMPTY(commodity[0]['restaurant_id']).then( res => {
console.log(res);
setTimeout( () => {
add();
}, 1000);
})
},
}
}
</script>
<style lang="scss">
.content {
padding: 0 19rpx;
}
.scroll-Y{
box-sizing: border-box;
padding-top:30rpx;
position: relative;
}
.OrderToggleType {
display: flex;
justify-content: space-between;
.typebtn {
width: 347rpx;
height: 91rpx;
background: #FFFFFF;
border: 1rpx solid #DEDEDE;
border-radius: 20rpx;
text-align: center;
line-height: 91rpx;
color: #333333;
font-size: $FONTSIZE24;
}
}
</style>

101
components/b-pay/b-pay.vue Normal file
View File

@ -0,0 +1,101 @@
<template>
<view class="b-pay">
<view class="Shop-Infor">
<view class="Shop-Infor-Left">
<image class="Shop-Infor-Left-Img" :src="storeInofr['store_img']"></image>
</view>
<view class="Shop-Infor-Right">
<!-- 为防止后期该位置添加东西所以再里面再包裹一层 -->
<view class="Shop-Infor-Right-Title">
{{storeInofr['store_name']}}
</view>
</view>
</view>
</view>
</template>
<script>
import mixin from '@/static/js/mixin.js'
export default {
name: "b-pay",
props: {
storeid: {
type: Number,
default: 0
}
},
data() {
return {
storeInofr: {
store_img: '',
store_name: ''
}
};
},
methods: {
/**
* @获取店铺信息
* */
getStoreInfo(store_id) {
this.$store.dispatch('shop/getStore', {
store_id
}).then(res => {
this.storeInofr = res
}).catch(err=>{
if(err['code'] == 7777){
// token,tokentoken,
// ,token
console.log(err,'接口错误');
uni.removeStorageSync('token');
this.DetectUserLogin(()=>{
this.getStoreInfo(store_id);
})
}
})
},
}
}
</script>
<style lang="scss">
.b-pay {
padding: 32rpx;
box-sizing: border-box;
}
.Shop-Infor {
display: flex;
justify-content: space-between;
align-items: center;
background-color: #ffffff;
border-radius: 15rpx;
padding: 20rpx;
box-sizing: border-box;
&-Left {
width: 240rpx;
height: 240rpx;
&-Img {
width: 100%;
height: 100%;
border-radius: 10rpx;
}
}
&-Right {
padding-left: 20rpx;
box-sizing: border-box;
flex: 1;
display: flex;
align-items: center;
&-Title {
color: #333333;
font-size: 36rpx;
}
}
}
</style>

View File

@ -0,0 +1,194 @@
<template>
<!-- 肯德基底部导航 -->
<view class="b-restaurant-nav">
<!-- 肯德基底部导航 -->
<template v-if="BrandInfor['brand_id'] == 1">
<view class="nav-KFC">
<view class="b-restaurant-nav-item" @tap="SETNAVINDEX(index)" v-for="(item,index) in navtab">
<image :src="Getnavindex == index?item['activation']:item['icon']" class="b-restaurant-nav-item-img"
mode="">
</image>
<view class="b-restaurant-nav-item-title" :style="{color:Getnavindex == index?'#C63836':'#999999'}">
{{item['title']}}
</view>
</view>
</view>
</template>
<!-- 肯德基底部导航 -->
<template v-if=" BrandInfor['brand_id'] == 5">
<view class="nav-KFC">
<view class="b-restaurant-nav-item" @tap="SETNAVINDEX(index)" v-for="(item,index) in mdlbtnnav">
<image :src="Getnavindex == index?item['activation']:item['icon']" class="b-restaurant-nav-item-img"
mode="">
</image>
<view class="b-restaurant-nav-item-title" :style="{color:Getnavindex == index?'#FFA200':'#999999'}">
{{item['title']}}
</view>
</view>
</view>
</template>
<!-- 瑞幸底部导航 -->
<template v-if="BrandInfor['brand_id'] == 13">
<view class="nav-rx">
<view class="b-restaurant-nav-item-RX" @tap="SETNAVINDEX(index)" v-for="(item,index) in navtab">
<view class="b-restaurant-nav-item-RX-title">
{{item['title']}}
</view>
</view>
</view>
</template>
<!-- 星巴克 -->
<template v-if="BrandInfor['brand_id'] == 10">
<view class="nav-xbk">
<view class="b-restaurant-nav-item-xbk" @tap="SETNAVINDEX(index)" v-for="(item,index) in xbkbtnnav">
<image :src="item['activation']" class="b-restaurant-nav-item-xbk-img"
mode="">
</image>
<view class="b-restaurant-nav-item-xbk-title" >
{{item['title']}}
</view>
</view>
</view>
</template>
<b-Bottom-Fit></b-Bottom-Fit>
</view>
</template>
<script>
import Vue from 'vue'
/**
* @底部导航组件
* */
import config from '@/static/js/config.js';
import {
mapMutations,
mapGetters
} from 'vuex'
export default {
name: "b-restaurant-nav",
data() {
return {
navtab: config['btnnav'],
xbkbtnnav:config['xbkbtnnav'],
mdlbtnnav:config['mdlbtnnav'],
};
},
computed: {
...mapGetters({
Getnavindex: 'shopping/Getnavindex',
// Id
BrandInfor: 'shopping/BrandInfor',
})
},
watch: {
Getnavindex: {
immediate: true,
handler(val) {
console.log(val, '导航索引变化');
uni.setNavigationBarTitle({
// /config/config/config.js
title: config['btnnav'][val]['title']
});
}
}
},
mounted() {
},
methods: {
...mapMutations({
SETNAVINDEX: 'shopping/SETNAVINDEX'
}),
/**
* @获取导航高度
*/
GetEMH(){
return new Promise((resolve,reject)=>{
let query = uni.createSelectorQuery().in(this);
query.select('.b-restaurant-nav').boundingClientRect();
query.exec(res => {
Vue.prototype.NAVHEIGHT = res[0]['height'];
console.log(this['NAVHEIGHT'],'NAVHEIGHT----');
resolve();
});
})
}
// PageGo(index) {
// this.SETNAVINDEX(index);
// }
}
}
</script>
<style lang="scss">
.b-restaurant-nav {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
background-color: #ffffff;
display: flex;
flex-direction: column;
.nav-KFC,
.nav-rx,
.nav-xbk{
display: flex;
justify-content: space-around;
align-items: center;
padding-top: 20rpx;
}
//
&-item {
width: 50%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
&-img {
width: 43rpx;
height: 43rpx;
margin-bottom: 13rpx;
}
&-title {
font-size: $FONTSIZE24;
font-weight: 700;
}
}
//
&-item-RX {
width: 335rpx;
height: 85rpx;
text-align: center;
line-height: 85rpx;
border: 1rpx solid #4A6FE7;
border-radius: 43rpx;
color: $THEMECOLOR6;
font-size: $FONTSIZE30;
}
//
&-item-xbk {
width: 50%;
display: flex;
justify-content: center;
align-items: center;
&-img {
width: 43rpx;
height: 43rpx;
margin-right: 15rpx;
}
&-title {
font-size: $FONTSIZE24;
font-weight: 700;
}
}
}
</style>

View File

@ -0,0 +1,268 @@
<template>
<view class="b-restaurant-order-status">
<!-- 订单状态 -->
<!-- 瑞幸订单状态 -->
<template v-if="InforData['brand_id'] == 13">
<view class="rx-Order-status style" v-if="InforData['status'] != 2 && InforData['status'] != 4">
<image class="rx-Order-status-Img" v-if="InforData['status'] == OrderStatus0"
:src="qnyurl('Unpaid.png','rx')" mode=""></image>
<image class="rx-Order-status-Img" v-if="InforData['status'] == OrderStatus1"
:src="qnyurl('NotServed.png','rx')" mode=""></image>
<image class="rx-Order-status-Img" v-if="InforData['status'] == OrderStatus5"
:src="qnyurl('cancel.png','rx')" mode=""></image>
<!-- 订单状态 -->
<view class="rx-Order-status-Title">
{{InforData['status'] | OrderState}}
</view>
<!-- 未支付 -->
<template v-if="InforData['status'] == OrderStatus0">
<view class="rx-Order-status-time">
剩余付款时间 {{wait_for}}
</view>
<view class="rx-Order-status-pay" :style="BtnStyle" @tap="payments">
立即支付
</view>
<view class="rx-Order-status-wait">
若您已支付请耐心等待商家结算
</view>
</template>
<!-- 待出餐 -->
<template v-if="InforData['status'] == OrderStatus1">
<view class="rx-Order-status-wait">
下单成功取餐码生成中请稍后查看
</view>
</template>
</view>
<!-- 已经出餐 -->
<view class="rx-Order-status-take style" v-else>
<view class="rx-Order-status-take-code">
<text class="text1">取餐码</text>
<text class="text2">{{InforData['codes'].join('')}}</text>
</view>
<view class="rx-Order-status-take-codeimg">
<img class="img" :src="InforData['qrcode']" alt="">
</view>
</view>
</template>
<template v-if="InforData['brand_id'] == 10">
<view class="xbk-Order-status style" v-if="InforData['status'] != 2 && InforData['status'] != 4">
<image class="xbk-Order-status-Img" v-if="InforData['status'] == OrderStatus0"
:src="qnyurl('Unpaid.png','xbk')" mode=""></image>
<image class="xbk-Order-status-Img" v-if="InforData['status'] == OrderStatus1"
:src="qnyurl('Unpaid.png','xbk')" mode=""></image>
<image class="xbk-Order-status-Img" v-if="InforData['status'] == OrderStatus5"
:src="qnyurl('cancel.png','xbk')" mode=""></image>
<!-- 订单状态 -->
<view class="xbk-Order-status-Title">
{{InforData['status'] | OrderState}}
</view>
<!-- 未支付 -->
<template v-if="InforData['status'] == OrderStatus0">
<view class="xbk-Order-status-time">
剩余付款时间 {{wait_for}}
</view>
<view class="xbk-Order-status-pay" @tap="payments">
立即支付
</view>
<view class="xbk-Order-status-wait">
若您已支付请耐心等待商家结算
</view>
</template>
<!-- 待出餐 -->
<template v-if="InforData['status'] == OrderStatus1">
<view class="xbk-Order-status-wait">
排队下单中请耐心等待
</view>
<view class="xbk-Order-status-Tips">
本页面可关闭将短信通知取单号或稍后查询我的订单
</view>
</template>
</view>
<!-- 已经出餐 -->
<view class="xbk-Order-status-take style" v-else>
<view class="codes" v-for="(item,index) in InforData['codes']">
<view class="codes-img">
<image class="img" :src="qnyurl('Password.png','xbk')" mode=""></image>
</view>
<view class="codes-Password">
口令{{index+1}}{{item}}
</view>
</view>
</view>
</template>
</view>
</template>
<script>
import mixin from '@/static/js/mixin/mixin.js';
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
export default {
mixins: [mixin,restaurantmixins],
name: "b-restaurant-order-status",
props: {
InforData: {
type: Object,
default: () => {}
}
},
computed: {
BtnStyle() {
let style = {};
switch (this['InforData']['brand_id']) {
case 1:
style['color'] = uni.$u.addUnit('#C63836');
style['border'] = uni.$u.addUnit('1px solid #DC7473');
break;
case 10:
style['color'] = uni.$u.addUnit('#ffffff');
style['background-color'] = uni.$u.addUnit('#00AF66');
// style['border'] = uni.$u.addUnit('1px solid #00AF66');
break;
case 13:
style['color'] = uni.$u.addUnit('#ffffff');
style['border'] = uni.$u.addUnit('1px solid #4A6FE7');
break;
};
return style;
}
},
mounted() {
if (this['InforData']['status'] == this['OrderStatus0']) {
this.tiem(this['InforData']['status'], this['InforData']['createtime'])
};
},
data() {
return {};
},
methods: {
payments() {
this.$emit('payments', {
order_sn: this['InforData']['order_sn'],
restaurant_id: this['InforData']['restaurant_id']
});
},
}
}
</script>
<style lang="scss">
page {
background-color: #f8f8f8;
padding: 32rpx;
box-sizing: border-box;
}
.b-restaurant-order-status {
width: 100%;
height: 100%;
.style {
border-radius: 20rpx;
background-color: #ffffff;
}
// //
.rx-Order-status {
display: flex;
flex-direction: column;
align-items: center;
padding: 35rpx 0;
&-Img {
width: 108rpx;
height: 108rpx;
}
&-Title {
font-size: 36rpx;
margin-bottom: 20rpx;
}
&-time {
color: #666666;
font-size: 26rpx;
margin-bottom: 20rpx;
}
&-pay {
width: 220rpx;
height: 60rpx;
color: #ffffff;
font-size: 28rpx;
background: linear-gradient(-77deg, #4A6FE7, #83ACFF);
border-radius: 30rpx;
text-align: center;
line-height: 60rpx;
}
&-wait {
background: #F7F8FA;
border-radius: 28rpx;
padding: 15rpx 30rpx;
color: #666666;
font-size: 26rpx;
}
//
&-Tips {
color: #999999;
font-size: 24rpx;
}
}
//
.rx-Order-status-take {
display: flex;
flex-direction: column;
align-items: center;
padding: 15rpx 0;
&-code {
display: flex;
align-items: center;
.text1 {
color: #000000;
font-size: 26rpx;
margin-right: 15rpx;
}
.text2 {
color: #4B6FE7;
font-size: 52rpx;
}
}
&-codeimg {
width: 234rpx;
height: 235rpx;
.img {
width: 100%;
height: 100%;
}
}
}
}
.b-restaurant-order-status {
width: 100%;
height: 100%;
.style {
border-radius: 20rpx;
background-color: #ffffff;
}
}
</style>

View File

@ -0,0 +1,202 @@
<template>
<view class="b-restaurant-state">
<!-- 肯德基 -->
<template v-if="BrandInfor['brand_id'] == 1">
<view class="b-restaurant-state-KDJ" :style="{
'backgroundColor':type == 1?activation:inactivated,
'color':type == 1?activationcolor:inactivatedcolor,
}">
{{ type | state}}
</view>
</template>
<!-- 奈雪 -->
<template v-if="BrandInfor['brand_id'] == 2">
<view class="b-restaurant-state-NX">
<view class="b-restaurant-state-NX-Name">
{{Brand()['BrandName']}}
</view>
<view class="b-restaurant-state-NX-Tiem">
{{item['open_time']}}-{{item['close_time']}}
<!-- 07:30-20:00 -->
<!-- 今日休息中 -->
</view>
<view class="b-restaurant-state-NX-status" v-if="!item['is_open']">
未营业
</view>
</view>
</template>
<!-- 瑞幸 -->
<template v-if="BrandInfor['brand_id'] == 13">
<view class="b-restaurant-state-RX">
<view class="b-restaurant-state-RX-Name">
{{Brand()['BrandName']}}
</view>
<view class="b-restaurant-state-RX-Tiem">
{{item['open_time']}}-{{item['close_time']}}
<!-- 07:30-20:00 -->
<!-- 今日休息中 -->
</view>
<view class="b-restaurant-state-RX-status" v-if="!item['is_open']">
未营业
</view>
</view>
</template>
</view>
</template>
<script>
//
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
/**
* @店铺状态组件
* */
import {
mapGetters,
} from 'vuex';
export default {
mixins:[restaurantmixins],
name: "b-restaurant-state",
props: {
item: {
type: Object,
default: () => {}
},
//
type: {
type: [Number,String],
default: 1
},
//
activation: {
type: String,
default: '#C63836'
},
//
activationcolor: {
type: String,
default: '#ffffff'
},
//
inactivated: {
type: String,
default: '#F6F6F6'
},
//
inactivatedcolor: {
type: String,
default: '#999999'
}
},
computed: {
...mapGetters({
// Id
BrandInfor: 'shopping/BrandInfor',
}),
},
data() {
return {
};
},
filters: {
state(v) {
switch (v) {
case 1:
return '点餐';
case 0:
return '未营业';
}
}
}
}
</script>
<style lang="scss">
//
.b-restaurant-state-KDJ {
width: 96rpx;
height: 32rpx;
font-size: $FONTSIZE24;
text-align: center;
line-height: 32rpx;
}
//
.b-restaurant-state-RX {
width: auto;
height: 38rpx;
border-radius: 5rpx;
display: flex;
&-Name {
width: 111rpx;
color: #ffffff;
font-size: $FONTSIZE24;
background: linear-gradient(-77deg, $THEMECOLOR6, #83ACFF);
line-height: 38rpx;
text-align: center;
}
&-Tiem {
border: 1rpx solid $THEMECOLOR6;
color: #83ACFF;
line-height: 32rpx;
font-size: $FONTSIZE24;
padding: 0 20rpx;
}
&-status {
width: 91rpx;
height: 38rpx;
background: #FFFFFF;
border: 1rpx solid #CCCCCC;
border-radius: 5rpx;
color: #CCCCCC;
font-size: $FONTSIZE24;
margin-left: 10rpx;
text-align: center;
}
}
//
//
.b-restaurant-state-NX {
width: auto;
height: 38rpx;
border-radius: 5rpx;
display: flex;
&-Name {
width: 111rpx;
color: #ffffff;
font-size: $FONTSIZE24;
background: linear-gradient(-77deg, #9BC419, #B0D342);
line-height: 38rpx;
text-align: center;
}
&-Tiem {
border-top: 1rpx solid $themeBackColor-2-1;
border-bottom: 1rpx solid $themeBackColor-2-1;
border-right: 1rpx solid $themeBackColor-2-1;
color: $themeBackColor-2-1;
line-height: 32rpx;
font-size: $FONTSIZE24;
padding: 0 20rpx;
}
&-status {
width: 91rpx;
height: 38rpx;
background: #FFFFFF;
border: 1rpx solid #CCCCCC;
border-radius: 5rpx;
color: #CCCCCC;
font-size: $FONTSIZE24;
margin-left: 10rpx;
text-align: center;
}
}
</style>

View File

@ -0,0 +1,141 @@
<template>
<view class="b-rx-commodity-item">
<view class="b-rx-commodity-item-commodity">
<view class="b-rx-commodity-item-commodity-img">
<image class="img" :src="item['product_img']" mode=""></image>
</view>
<view class="b-rx-commodity-item-commodity-infor">
<!-- 商品 -->
<view class="b-rx-commodity-item-commodity-infor-name">
{{item['product_name']}}
</view>
<view v-if="item['sku']" class="b-rx-commodity-item-commodity-infor-sku">
{{item['sku']}}
</view>
<!-- 价格 -->
<view class="b-rx-commodity-item-commodity-infor-money">
<view class="b-rx-commodity-item-commodity-infor-money-price">
<text class="b-rx-commodity-item-commodity-infor-money-yang">x</text>
<text class="b-rx-commodity-item-commodity-infor-money-amount">{{item['num']?item['num']:item['amount']}}</text>
</view>
</view>
</view>
</view>
<!-- 数量 -->
<view class="quantity">
<!-- 订单列表中的商品数据价格是后台计算过的所以直接使用就行了original_price属性之后订单数据才会返回 -->
<view class="num" v-if="item['original_price']">
{{RetainDecimalPoint(item['pay_price'])}}
</view>
<view class="num" v-else-if="!item['original_price'] && (BrandInfor['brand_id'] == 13 || BrandInfor['brand_id'] == 1)">
{{RetainDecimalPoint(item['pay_price'] * (item['num']?item['num']:item['amount']))}}
</view>
<view class="num" v-else-if="!item['original_price'] && BrandInfor['brand_id'] == 10">
{{RetainDecimalPoint(item['adj_pay'] * (item['num']?item['num']:item['amount']))}}
</view>
</view>
</view>
</template>
<script>
// :
import mixin from '@/static/js/mixin/mixin.js';
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
export default {
name: "b-rx-commodity-item",
mixins:[mixin,restaurantmixins],
props:{
item:{
type:Object,
default:()=>{}
}
},
data() {
return {
};
}
}
</script>
<style lang="scss">
.b-rx-commodity-item {
width: 100%;
display: flex;
justify-content: space-between;
box-sizing: border-box;
padding-bottom: 20rpx;
&-commodity {
display: flex;
flex: 1;
&-img {
width: 120rpx;
height: 120rpx;
min-width: 120rpx;
min-height: 120rpx;
.img {
width: 100%;
height: 100%;
border-radius: 10rpx;
}
}
&-infor {
display: flex;
flex-direction: column;
justify-content: space-between;
padding-left: 22rpx;
&-name {
font-size: $FONTSIZE30;
max-width: 336rpx;
min-width: 336rpx;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
}
&-sku {
color: #999999;
font-size: $FONTSIZE22;
}
&-money {
// max-width: 115rpx;
// min-width: 115rpx;
text-align: center;
&-yang {
font-size: $FONTSIZE22;
}
&-price {
display: flex;
align-items: center;
font-size: $FONTSIZE30;
}
}
}
}
.quantity {
// display: flex;
// justify-content: space-between;
font-size: 30rpx;
flex: 1;
color: #4A6FE7;
.num {
text-align: center;
}
.img {
width: 42rpx;
height: 42rpx;
}
}
}
</style>

View File

@ -0,0 +1,331 @@
<template>
<view class="b-rx-sku-popup">
<u-popup :show="show" @close="show = false" round="20" closeable zIndex="20080">
<view class="commodity-sku">
<!-- 商品图 -->
<view class="commodity-sku-cover">
<!-- 封面 -->
<image class="img" :src="skuinfor['product_img']" mode="widthFix"></image>
<!-- 名称-数量 -->
<view class="commodity-sku-cover-name">
<view class="commodity-sku-cover-name-title" :style="{color:Brand()['ThemeColor']}">
{{skuinfor['product_name']}}
</view>
<view class="commodity-sku-cover-name-cart">
<image class="img" :src="qnyurl('reduce.png','rx')" mode="" @tap="reducequantity()"></image>
<view class="num">
{{skuinfor['num']}}
</view>
<image class="img" :src="qnyurl('add.png','rx')" mode="" @tap="Addquantity()"></image>
</view>
</view>
</view>
<!-- 规格 -->
<view class="commodity-sku-option" v-if="skuinfor['details']">
<template v-for="(item,index) in skuinfor['details']['specifications']">
<view class="commodity-sku-option-item" :key="index">
<view class="commodity-sku-option-item-label">
{{item['name']}}
</view>
<view class="commodity-sku-option-item-values">
<template v-for="(item2,index2) in item['ingredients']">
<view @tap="skuClick(index,index2)"
:class="{'commodity-sku-option-item-values-activation':item2['checked']}"
class="commodity-sku-option-item-values-item" :key="index2">
{{item2['name']}}
</view>
</template>
</view>
</view>
</template>
</view>
<view class="commodity-sku-Infor">
<view class="commodity-sku-Infor-left">
<view class="commodity-sku-Infor-left-Price">
<text class="text1"></text>
<text class="text2">{{_amount(skuinfor['adj_pay'] * skuinfor['num'])}}</text>
<view>{{skuinfor['sku']}}</view>
</view>
<view class="commodity-sku-Infor-left-sku">
{{skutext}}
</view>
</view>
<!-- Addcommodity方法中不可设置形参,因为点击事件默认第一个参数就是点击事件的各种参数并不是形参中所设置的默认值 -->
<!-- 所以在点击时手动传入skuinfor参数 -->
<view class="commodity-sku-Infor-right" @tap="Addcommodity">
加入购物车
</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import {
mapGetters
} from 'vuex';
import mixin from '@/static/js/mixin/mixin.js'
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js'
export default {
mixins: [mixin, restaurantmixins],
name: "b-rx-sku-popup",
data() {
return {
// /
show: false,
//
skuinfor: {},
//
skutext: '',
};
},
computed: {
...mapGetters({
GetcommodityInfor: 'shopping/GetcommodityInfor'
}),
},
watch: {
// ,便
GetcommodityInfor(value) {
this['skuinfor'] = JSON.parse(JSON.stringify(value));
this.skuInit();
}
},
methods: {
/**
* @添加数量
* */
Addquantity(num = 1) {
this['skuinfor']['num'] += num;
},
/**
* @选择规格数量减
* */
reducequantity(num = 1) {
if (this['skuinfor']['num'] == 1) return;
this['skuinfor']['num'] -= num;
},
/**
* @加入购物车
* */
Addcommodity() {
let self = this;
uni.$u.debounce(() => {
self.ADD_CART({
commodity: self['skuinfor'],
quantity: self['skuinfor']['num']
}).then(() => {
console.log('加入成功');
self['show'] = false;
console.log(self['show'], 'show');
});
}, 800, true)
},
/**
* @筛选出当前选择的高亮规格
* */
skuInit() {
let r = [];
let t = this['skuinfor']['details']['specifications'];
let pay = 0;
for (let i = 0; i < t['length']; i++) {
let item = t[i];
r.push(...item['ingredients']);
};
//
let newarr = r.filter(item => item['checked']).map(item => item['name']);
this['skuinfor']['sku'] = newarr.join('/');
//
pay + r.filter(item => item['checked']).map(item => item['price']).reduce(function(previousValue, currentValue) {
return previousValue + currentValue;
});
this['skuinfor']['add_price'] = pay;
//
this['skuinfor']['adj_pay'] = (+this['skuinfor']['pay_price']) + (pay * 100);
// code
let index = -1;
let code = '';
outer: for (let j = 0; j < this['skuinfor']['details']['sku_infos']['length']; j++) {
let item1 = this['skuinfor']['details']['sku_infos'][j];
index = 0;
code = item1['code'];
for (let k = 0; k < item1['values']['length']; k++) {
let item2 = item1['values'][k];
if (newarr.indexOf(item2['spec_name']) != -1) {
index += 1;
} else {
continue;
}
if (index >= newarr['length']) {
this['skuinfor']['sku_code'] = code;
break outer;
}
}
};
if (!code) this['skuinfor']['sku_code'] = this['skuinfor']['details']['sku_infos'][0]['code'];
// this['skuinfor']['add_price'] = _newSupItemArr.flatMap(item => item)
console.log(this['skuinfor'],'瑞幸筛选的CODE');
},
/**
* @规格选择
* */
skuClick(index1, index2) {
let pay = 0;
// ,
this['skuinfor']['details']['specifications'][index1]['ingredients'].map((item, index) => {
if (index2 == index) {
item['checked'] = true;
} else {
item['checked'] = false;
}
});
this.skuInit();
},
}
}
</script>
<style lang="scss">
//
.commodity-sku {
&-cover {
// height: 560rpx;
height: auto;
position: relative;
.img {
width: 100%;
}
&-title {
color: #333333;
font-size: 34rpx;
}
&-name {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
color: #ffffff;
padding: 10rpx 32rpx;
background-color: rgba(255, 255, 255, 0.5);
&-cart {
flex: 1;
height: 60rpx;
display: flex;
justify-content: flex-end;
font-size: 36rpx;
align-items: center;
.num {
max-width: 100rpx;
min-width: 100rpx;
text-align: center;
color: #000000;
}
.img {
width: 42rpx;
height: 42rpx;
}
}
}
}
&-option {
padding: 32rpx;
&-item {
width: 100%;
height: 70rpx;
font-size: 26rpx;
display: flex;
justify-content: flex-start;
margin-bottom: 15rpx;
&-label {
min-width: 112rpx;
height: 100%;
color: #999999;
line-height: 70rpx;
}
&-values {
width: 100%;
display: flex;
justify-content: flex-start;
&-activation {
background: rgba(131, 172, 255, 0.3) !important;
border: 1rpx solid #83ACFF !important;
color: #4A6FE7 !important;
}
&-item {
min-width: 112rpx;
height: 100%;
line-height: 70rpx;
background: #F7F8FA;
border-radius: 6rpx;
margin-bottom: 20rpx;
text-align: center;
margin-right: 15rpx;
border: 1rpx solid #F7F8FA;
}
}
}
}
&-Infor {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding: 32rpx;
border-top: 1rpx solid rgba(102, 102, 102, 0.1);
&-left {
&-Price {
color: #FF780F;
.text1 {
font-size: 24rpx;
}
.text2 {
font-size: 36rpx;
}
}
&-sku {
color: #666666;
font-size: 22rpx;
}
}
&-right {
width: 254rpx;
height: 86rpx;
background: linear-gradient(-77deg, #4A6FE7, #83ACFF);
box-shadow: 0 6rpx 8rpx 0 rgba(74, 111, 231, 0.2300);
border-radius: 43rpx;
text-align: center;
line-height: 86rpx;
color: #ffffff;
}
}
}
</style>

View File

@ -0,0 +1,24 @@
<template>
<view class="b-settlement">
</view>
</template>
<script>
/**
* @deprecated 页面底部结算组件
* @property {Boolean} mode 展示方式
* */
export default {
name: "b-settlement",
data() {
return {
};
}
}
</script>
<style lang="scss">
</style>

View File

@ -0,0 +1,285 @@
<template>
<view class="b-shop-infor-head">
<!-- 瑞幸 -->
<view class="shop-top-rx shop-top" v-if="BrandInfor['brand_id'] == 13">
<view class="shop-top-rx-infor ">
<view class="shop-top-rx-infor-icon">
<image class="img" :src="qnyurl('shopareaioc.png','rx')" mode=""></image>
</view>
<view class="shop-top-rx-infor-Name-Area">
<view class="shop-top-rx-infor-Name-Area-name">
{{GetShopInfor['restaurant_name']}}
</view>
<view class="shop-top-rx-infor-Name-Area-area">
{{GetShopInfor['restaurant_address']}}
</view>
</view>
<view class="shop-top-rx-infor-Navigation" @click="openLocation()">
导航
</view>
</view>
</view>
<!-- 星巴克 -->
<view class="shop-top-xbk shop-top" v-if="BrandInfor['brand_id'] == 10">
<view class="shop-top-xbk-infor-Name-Area">
<view class="shop-top-xbk-infor-Name-Area-icon">
<image class="img" :src="qnyurl('xbk_home.png','xbk')" mode=""></image>
</view>
<view class="shop-top-xbk-infor-Name-Area-name">
{{GetShopInfor['restaurant_name']}}>
</view>
<view class="shop-top-xbk-infor-Name-Area-map-address" @tap="openLocation()">
<image class="img" :src="qnyurl('map.png','xbk')" mode=""></image>
</view>
</view>
<view class="shop-top-xbk-infor-Name-area">
{{GetShopInfor['restaurant_address']}}
</view>
</view>
<!-- 奈雪 -->
<view class="shop-top-xbk shop-top" v-if="BrandInfor['brand_id'] == 2">
<view class="shop-top-xbk-infor-Name-Area">
<view class="shop-top-xbk-infor-Name-Area-icon">
<image class="img" :src="qnyurl('xbk_home.png','xbk')" mode=""></image>
</view>
<view class="shop-top-xbk-infor-Name-Area-name">
{{GetShopInfor['restaurant_name']}}>
</view>
<view class="shop-top-xbk-infor-Name-Area-map-address" @tap="openLocation()">
<image class="img" :src="qnyurl('map.png','xbk')" mode=""></image>
</view>
</view>
<view class="shop-top-xbk-infor-Name-area">
{{GetShopInfor['restaurant_address']}}
</view>
</view>
</view>
</template>
<script>
import {
mapGetters,
} from 'vuex';
import {
isCollectionAPI,
storeCollectionAPI,
} from '@/request/restaurant/index.js';
import mixin from '@/static/js/mixin/mixin.js';
export default {
name: "b-shop-infor-head",
mixins: [mixin],
data() {
return {
//
isCollection: false,
};
},
computed: {
...mapGetters({
//
GetShopInfor: 'shopping/GetShopInfor',
// Id
BrandInfor: 'shopping/BrandInfor',
}),
},
mounted() {
if (this['BrandInfor']['brand_id'] == 1) {
let parameters = {
brand_id: this['BrandInfor']['brand_id'],
restaurant_id: this['GetShopInfor']['restaurant_id']
}
isCollectionAPI(parameters).then(res => {
this['isCollection'] = res ? true : false;
})
}
},
methods: {
/**
* @关注或者取消关注
* */
Collection() {
let parameters = {
lng: this['GetShopInfor']['longitude'],
lat: this['GetShopInfor']['latitude'],
status: !this['isCollection'],
brand_id: this['BrandInfor']['brand_id'],
brand_name: this['BrandInfor']['brand_name'],
restaurant_id: this['GetShopInfor']['restaurant_id'],
restaurant_name: this['GetShopInfor']['restaurant_name'],
restaurant_address: this['GetShopInfor']['restaurant_address']
}
storeCollectionAPI(parameters).then(res => {
this['isCollection'] = !this['isCollection'];
if (this['isCollection']) {
uni.showToast({
title: '关注成功',
icon: 'none'
});
return;
};
uni.showToast({
title: '取消关注',
icon: 'none'
})
})
},
}
}
</script>
<style lang="scss">
.shop-top{
background-color: #FFFFFF;
}
//
.shop-infor {
display: flex;
align-items: center;
width: 100%;
height: 131rpx;
padding: 0 30rpx 30rpx 30rpx;
.shop-infor-left {
flex: 1;
&-name {
font-size: $FONTSIZE28;
font-weight: 700;
margin-bottom: 18rpx;
}
&-area {
font-size: $FONTSIZE24;
color: #999999;
}
}
.shop-infor-right {
font-size: $FONTSIZE24;
color: $PROMPTTEXTCOLOR;
font-size: 24rpx;
color: #666666;
display: flex;
flex-direction: column;
align-items: center;
.img {
max-width: 36rpx;
min-width: 36rpx;
min-height: 36rpx;
max-height: 36rpx;
margin-bottom: 16rpx;
}
}
}
//
.shop-top-rx {
width: 100%;
padding: 0 30rpx 30rpx 30rpx;
&-infor {
display: flex;
align-items: center;
justify-content: flex-start;
&-icon {
width: 37rpx;
height: 43rpx;
margin-right: 30rpx;
.img {
width: 100%;
height: 100%;
}
}
&-Name-Area {
flex: 1;
&-name {
font-size: 30rpx;
line-height: 65rpx;
}
&-area {
color: #999999;
font-size: 26rpx;
}
}
&-Navigation {
width: 89rpx;
height: 43rpx;
background: #FFFFFF;
border: 1rpx solid #4A6FE7;
border-radius: 22rpx;
color: #4A6FE7;
text-align: center;
line-height: 43rpx;
margin-left: 60rpx;
font-size: 26rpx;
}
}
// .shop-infor-Navigation{
// width: 89rpx;
// height: 43rpx;
// background: #FFFFFF;
// border: 1rpx solid #4A6FE7;
// border-radius: 22rpx;
// color: #4A6FE7;
// text-align: center;
// line-height: 43rpx;
// margin-left: 60rpx;
// }
// &-icon{
// .img{
// width: 37px;
// height: 43px;
// }
// }
}
.shop-top-xbk{
width: 100%;
padding:32rpx;
&-infor-Name-Area{
display: flex;
justify-content:flex-start;
margin-bottom: 16rpx;
align-items: center;
&-icon{
width: 30rpx;
height: 30rpx;
margin-right: 15rpx;
.img{
width: 100%;
height: 100%;
}
}
&-name{
color: #333333;
font-size: 30rpx;
flex: 1;
}
&-map-address{
width: 42rpx;
height: 38rpx;
.img{
width: 100%;
height: 100%;
}
}
}
&-infor-Name-area{
font-size: 24rpx;
color: #777777;
}
}
</style>

View File

@ -0,0 +1,191 @@
<template>
<view class="b-kfc-shop-item">
<view class="b-kfc-shop-item-commodity">
<image class="b-kfc-shop-item-commodity-img" :src="item['product_img']" mode=""></image>
</view>
<view class="b-kfc-shop-item-commodity-infor">
<!-- 商品标题 -->
<view class="b-kfc-shop-item-commodity-infor-title b-kfc-shop-item-commodity-infor-bottom">
{{item['product_name']}}
</view>
<!-- 补贴金额 -->
<view class="b-kfc-shop-item-commodity-infor-discount b-kfc-shop-item-commodity-infor-bottom">
最高补贴{{RetainDecimalPoint(item['max_deduction'])}}面额
</view>
<!-- 价格 -->
<view class="b-kfc-shop-item-commodity-infor-price b-kfc-shop-item-commodity-infor-bottom">
<text class="yang">原价:</text>
<text class="price">{{RetainDecimalPoint(item['pay_price'])}}</text>
</view>
<!-- 优惠补贴后的价格 -->
<view class="b-kfc-shop-item-commodity-infor-price b-kfc-shop-item-commodity-infor-bottom">
<text class="yang">补贴后价格:</text>
<text class="price">{{RetainDecimalPoint(item['pay_price'] - item['max_deduction'])}}</text>
</view>
<!-- 加入购物车 -->
<view class="b-kfc-shop-item-commodity-infor-shopping-cart">
<view v-show="shopCart && shopCart['num']" class="Reduce-Button" :class="[`theme-Union-Class-${BrandInfor['brand_id']}-2`]" @tap.stop="reducecommodity">
<view>-</view>
</view>
<view class="num" v-show="shopCart && shopCart['num']">
{{shopCart['num']}}
</view>
<view class="Add-Button" :class="[`theme-Union-Class-${BrandInfor['brand_id']}-1`]" @tap.stop="Addcommodity">
<view>+</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
//
import mixin from '@/static/js/mixin/mixin.js';
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js'
export default {
mixins: [mixin, restaurantmixins],
name: "b-kfc-shop-item",
props: {
item: {
type: Object,
default: () => {}
}
},
data() {
return {
};
},
computed: {
//
shopCart: function() {
try {
return {
...this['GetCartList'][this['item']['product_id']]
};
} catch (e) {
return false
}
},
},
mounted() {
// //
// uni.$on('skuarrangement',function(data){
// console.log(data);
// })
},
methods: {
// vuex
/**
* @添加数量/增加商品
* */
Addcommodity() {
if (this['item']['is_sku']) {
this.PageShopCombo();
return;
};
console.log(this['item'],'item添加');
this.ADD_CART({
commodity: this['item']
})
},
/**
* @减少/删除商品
* */
reducecommodity() {
this.REDUCE_CART(this['item'])
},
//
PageShopCombo() {
uni.navigateTo({
url: `/pages/restaurant/home/shop_home/shop-combo/mdl-shop-combo?product_id=${this['item']['product_id']}`
})
}
}
}
</script>
<style lang="scss">
.b-kfc-shop-item {
width: 100%;
height: auto;
display: flex;
justify-content: flex-start;
&-commodity {
width: 220rpx;
height: 195rpx;
max-width: 220rpx;
max-height: 195rpx;
min-width: 220rpx;
min-height: 195rpx;
border-radius: 10rpx;
overflow: hidden;
&-img {
width: 100%;
height: 100%;
}
}
&-commodity-infor {
flex: 1;
padding-left: 22rpx;
&-bottom {
margin-bottom: 15rpx;
}
&-title {
font-size: $FONTSIZE26;
color: $THEMECOLOR4;
}
&-discount {
background-color: #FFDADA;
border-radius: 50rpx;
color: $THEMECOLOR1;
font-size: $FONTSIZE22;
padding: 5rpx 15rpx;
display: inline-block;
}
&-price {
color: $THEMECOLOR1;
.yang {
font-size: $FONTSIZE22;
}
.price {
font-size: $FONTSIZE30;
}
}
&-shopping-cart {
flex: 1;
height: 60rpx;
display: flex;
justify-content: flex-end;
font-size: 36rpx;
align-items: center;
.num {
max-width: 100rpx;
min-width: 100rpx;
text-align: center;
}
.img {
width: 42rpx;
height: 42rpx;
}
}
}
}
</style>

View File

@ -0,0 +1,271 @@
<template>
<view class="b-rx-shop-item">
<view class="b-rx-shop-item-commodity">
<image class="b-rx-shop-item-commodity-img" :src="item['product_img']" mode=""></image>
</view>
<view class="b-rx-shop-item-commodity-infor">
<!-- 商品标题 -->
<view class="b-rx-shop-item-commodity-infor-title b-rx-shop-item-commodity-infor-bottom">
{{item['product_name']}}
</view>
<!-- 补贴金额 -->
<view v-if="item['max_deduction'] > 0"
class="b-rx-shop-item-commodity-infor-discount b-rx-shop-item-commodity-infor-bottom">
最高补贴{{RetainDecimalPoint(item['max_deduction'])}}面额
</view>
<!-- 价格 -->
<view class="b-rx-shop-item-commodity-infor-original-price b-rx-shop-item-commodity-infor-bottom">
<text class="yang">原价:</text>
<text class="price">{{RetainDecimalPoint(item['pay_price'])}}</text>
</view>
<!-- 优惠补贴后的价格 -->
<view class="b-rx-shop-item-commodity-infor-price b-rx-shop-item-commodity-infor-bottom">
<text class="yang">补贴后价格:</text>
<text class="price">{{RetainDecimalPoint(item['pay_price'] - item['max_deduction'])}}</text>
</view>
<!-- 直接添加商品 -->
<!-- <view class="b-kfc-shop-item-commodity-infor-shopping-cart" v-if="shopCart['num'] > 0">
<image class="img" :src="qnyurl('reduce.png','rx')" mode=""
@tap="reducecommodity"></image>
<view class="num">
{{shopCart['num']}}
</view>
<image class="img" :src="qnyurl('add.png','rx')" mode="" @tap="GetCommodity"></image>
</view> -->
<!-- 需要选择规格 -->
<view class="b-rx-shop-item-commodity-infor-shopping-cart-sku" @tap="$u.debounce(GetCommodity, 800,true)">
<view class="b-rx-shop-item-commodity-infor-shopping-cart-sku-btn" :style="[Btnstyle]">
<u-badge v-if="NumValu > 0" :offset="[-6,-5]" max="99" absolute :value="NumValu"></u-badge>
选规格
</view>
</view>
</view>
</view>
</template>
<script>
/**
* @肯德基店铺商品组件
* */
//
import mixin from '@/static/js/mixin/mixin.js';
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
//
import {
menuDetailsAPI,
} from '@/request/restaurant/index.js';
import {
mapMutations
} from 'vuex'
export default {
mixins: [mixin, restaurantmixins],
name: "b-rx-shop-item",
props: {
item: {
type: Object,
default: () => {}
}
},
data() {
return {};
},
computed: {
//
shopCart: function() {
try {
return this['GetCartList'][this['item']['product_id']];
} catch (e) {
return 0
}
},
NumValu(){
try{
return this['GetCartList'][this['item']['product_id']]['num']
}catch(e){
return 0
}
},
//
Btnstyle() {
if (this['BrandInfor']['brand_id'] == 10) {
return {
'background': '#00AF66'
};
}
if (this['BrandInfor']['brand_id'] == 13) {
return {
'background': 'linear-gradient(-77deg, #4A6FE7, #83ACFF)'
};
}
}
},
methods: {
...mapMutations({
SetcommodityInfor: 'shopping/SETINFOR'
}),
//
GetCommodity() {
uni.showLoading({
title: '加载中...'
});
let parameters = {
brand_id: this['BrandInfor']['brand_id'],
restaurant_id: this['GetShopInfor']['restaurant_id'],
product_id: this['item']['product_id']
}
menuDetailsAPI(parameters).then(res => {
uni.hideLoading();
//
res['data']['num'] = 1;
this.SetcommodityInfor(res['data']);
if (this['BrandInfor']['brand_id'] == 10) {
// H5
// this['$parent']['$parent']['$parent']['$refs']['b-xbk-sku-popup']['show'] = true;
this.$emit('skupopup','b-xbk-sku-popup');
console.log(this['BrandInfor']['brand_id'],'执行1')
};
if (this['BrandInfor']['brand_id'] == 13) {
this.$emit('skupopup','b-rx-sku-popup');
// H5
// this['$parent']['$parent']['$parent']['$refs']['b-rx-sku-popup']['show'] = true;
console.log(this['BrandInfor']['brand_id'],'执行2')
}
})
}
}
}
</script>
<style lang="scss">
.b-rx-shop-item {
width: 100%;
height: auto;
display: flex;
justify-content: flex-start;
&-commodity {
width: 220rpx;
height: 195rpx;
max-width: 220rpx;
max-height: 195rpx;
min-width: 220rpx;
min-height: 195rpx;
border-radius: 10rpx;
overflow: hidden;
&-img {
width: 100%;
height: 100%;
}
}
&-commodity-infor {
flex: 1;
padding-left: 22rpx;
&-bottom {
margin-bottom: 15rpx;
}
&-title {
font-size: $FONTSIZE26;
color: $THEMECOLOR4;
}
&-discount {
background-color: #FFDADA;
border-radius: 50rpx;
color: $THEMECOLOR1;
font-size: $FONTSIZE22;
padding: 5rpx 15rpx;
display: inline-block;
}
&-original-price {
.yang {
font-size: $FONTSIZE22;
}
.price {
font-size: $FONTSIZE22;
}
}
&-price {
color: $THEMECOLOR1;
.yang {
font-size: $FONTSIZE22;
}
.price {
font-size: $FONTSIZE30;
}
}
&-shopping-cart {
flex: 1;
height: 60rpx;
display: flex;
justify-content: flex-end;
font-size: 36rpx;
align-items: center;
.num {
max-width: 100rpx;
min-width: 100rpx;
text-align: center;
}
.img {
width: 42rpx;
height: 42rpx;
}
}
&-shopping-cart-sku {
flex: 1;
height: 60rpx;
display: flex;
justify-content: flex-end;
font-size: 36rpx;
align-items: center;
&-btn {
width: 106rpx;
height: 50rpx;
position: relative;
border-radius: 25rpx;
color: #ffffff;
text-align: center;
line-height: 50rpx;
font-size: 24rpx;
}
}
}
}
.b-kfc-shop-item-commodity-infor-shopping-cart {
flex: 1;
height: 60rpx;
display: flex;
justify-content: flex-end;
font-size: 36rpx;
align-items: center;
.num {
max-width: 100rpx;
min-width: 100rpx;
text-align: center;
}
.img {
width: 42rpx;
height: 42rpx;
}
}
</style>

View File

@ -0,0 +1,244 @@
<template>
<view class="Store-List-Item" @tap="itemclick">
<!-- 肯德基店铺列表样式 -->
<template v-if="BrandInfor['brand_id'] == 1">
<view class="Store-List-Item-Top">
<view class="Store-List-Item-Top-Name">
{{item['restaurant_name']}}
</view>
<b-restaurant-state></b-restaurant-state>
<view class="Store-List-Item-Top-distance">
{{item['distance']}}m
</view>
</view>
<view class="Store-List-Item-Area">
{{item['restaurant_address']}}
</view>
</template>
<!-- 瑞幸 -->
<template v-if="BrandInfor['brand_id'] == 13">
<view class="Store-List-Item-Top-RX">
<view class="Store-List-Item-Top-RX-Left">
<view class="Store-List-Item-Top-RX-Left-Title">
{{item['restaurant_name']}}
</view>
<b-restaurant-state :item="item"></b-restaurant-state>
</view>
<view class="Store-List-Item-Top-RX-Right" @tap.stop="openLocation(item['latitude'],item['longitude'])">
<img class="img" :src="qnyurl('Navigation.png','rx')" alt="">
<view class="Store-List-Item-Top-RX-Right-distance">
{{item['distance']}}km
</view>
</view>
</view>
<view class="Store-List-Item-Area-RX">
<image class="img" :src="qnyurl('areaicon.png','rx')" mode=""></image>
<view class="Store-List-Item-Area-RX-text">
{{item['restaurant_address']}}
</view>
</view>
</template>
<!-- 停店遮罩 -->
<view class="state-stop" v-if="item['is_open'] == 0"></view>
<!-- 闭店弹框 -->
<u-modal :show="show" title=" " borderRadius="20">
<template v-slot:default>
<view class="RX-slot-content">
<image class="img" :src="qnyurl('closureimg.png','rx')" mode=""></image>
<view class="text">
抱歉该门店未营业
</view>
</view>
</template>
<template v-slot:confirmButton>
<view class="RX-confirmButton">
<view class="btn" @tap="show = false">
确定
</view>
</view>
</template>
</u-modal>
</view>
</template>
<script>
/**
* @店铺列表组件
* */
import {
mapGetters,
} from 'vuex';
import mixin from '@/static/js/mixin/mixin.js';
export default {
name: "b-shop-list-item",
mixins: [mixin],
props: {
item: {
type: Object,
default: () => {}
}
},
computed: {
...mapGetters({
// Id
BrandInfor: 'shopping/BrandInfor',
}),
},
data() {
return {
//
show: false
};
},
methods: {
itemclick() {
if (this['item']['is_open'] == 0) {
this['show'] = true;
return;
}
this.$emit('itemclick', this['item'])
}
}
}
</script>
<style lang="scss">
//
.state-stop {
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.3);
position: absolute;
top: 0;
left: 0;
z-index: 100;
}
.Store-List-Item {
width: 100%;
height: auto;
background-color: #ffffff;
border-radius: 15rpx;
min-height: 155rpx;
padding: 32rpx;
margin-top: 20rpx;
position: relative;
//
&-Top {
display: flex;
align-items: flex-end;
margin-bottom: 30rpx;
&-Name {
font-size: $FONTSIZE30;
color: $THEMECOLOR4;
margin-right: 20rpx;
}
&-distance {
font-size: $FONTSIZE26;
color: $THEMECOLOR5;
flex: 1;
text-align: right;
}
}
&-Area {
font-size: $FONTSIZE26;
}
//
&-Top-RX {
display: flex;
justify-content: space-between;
margin-bottom: 30rpx;
&-Left {
font-size: $FONTSIZE30;
color: $THEMECOLOR4;
&-Title {
margin-bottom: 20rpx;
font-weight: 700;
}
}
&-Right {
display: flex;
flex-direction: column;
align-items: center;
color: $THEMECOLOR6;
font-size: 26rpx;
.img {
width: 64rpx;
height: 64rpx;
}
&-distance {
margin-top: 15rpx;
}
}
}
&-Area-RX {
color: #999999;
font-size: $FONTSIZE24;
padding-top: 22rpx;
border-top: 1rpx solid #EDEEF0;
display: flex;
justify-content: flex-start;
align-items: center;
&-text {
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
}
.img {
width: 22rpx;
height: 26rpx;
margin-right: 15rpx;
}
}
}
// //
// .slot-content {
// display: flex;
// flex-direction: column;
// align-items: center;
// .img {
// width: 196rpx;
// height: 169rpx;
// margin-bottom: 32rpx;
// }
// .text {
// font-size: 32rpx;
// color: #333333;
// }
// }
// .confirmButton {
// display: flex;
// justify-content: center;
// .btn {
// width: 470rpx;
// height: 86rpx;
// background: linear-gradient(-77deg, #4A6FE7, #83ACFF);
// border-radius: 43rpx;
// font-size: 30rpx;
// color: #ffffff;
// text-align: center;
// line-height: 86rpx;
// }
// }
</style>

View File

@ -0,0 +1,140 @@
<template>
<view class="b-shop-load" v-show="display">
<view :style="[position]" class="content">
<view class="Status-Img">
<image :src="Img" :style="[Style]" class="img"></image>
</view>
<!-- 提示文字 -->
<view class="Prompt-Text">
{{Text}}
</view>
</view>
</view>
</template>
<script>
// position: relative;
/**
* @param { String } type
* */
import mixin from '@/static/js/mixin/mixin.js'
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js'
export default {
name: "b-shop-load",
mixins: [mixin,restaurantmixins],
props: {
type: {
type: String,
default: ""
},
width: {
type: String,
default: "120"
},
height: {
type: String,
default: "120"
},
//
offset:{
type:[Array,String],
default:'content'
},
show:{
type:Boolean,
default:false
}
},
computed: {
//
display(){
console.log('组件计算属性',this['show']);
return this['show']
},
//
GetType() {
return this['type'];
},
Style() {
return {
width: `${this['width']}rpx`,
height: `${this['height']}rpx`
}
},
Text() {
//
if (this['GetType'] == 'load') {
return '加载中,请稍后'
} else if (this['GetType'] == 'close') {
//
return '抱歉,该门店已打烊'
} else if (this['GetType'] == 'orders') {
//
return '您还没有小食订单 '
} else if (this['GetType'] == 'store') {
//
return '该地区暂无门店信息'
}
},
Img() {
//
if (this['GetType'] == 'load') {
if(this['BrandInfor']['brand_id'] == 1){
return this.qnyurl('load.png', 'rx')
}else if(this['BrandInfor']['brand_id'] == 10){
return this.qnyurl('load.gif', 'xbk')
}else if(this['BrandInfor']['brand_id'] == 13){
return this.qnyurl('load.png', 'rx')
}else if(this['BrandInfor']['brand_id'] == 19){
return this.qnyurl('load.png', 'dyp')
}
} else if (this['GetType'] == 'close') {
//
return this.qnyurl('closureimg.png', 'rx')
} else if (this['GetType'] == 'orders') {
//
return this.qnyurl('orderno.png', 'rx')
} else if (this['GetType'] == 'store') {
//
return this.qnyurl('default.png', 'rx')
}
},
position(){
if(typeof this['offset'] == 'string' && this['offset'] == 'content'){
return {top:'50%',left:'50%',transform:'translate(-50%,-50%)'}
}
return {top:this['offset'][0],left:this['offset'][1]}
}
},
}
</script>
<style lang="scss">
.b-shop-load {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
background-color: #ffffff;
z-index: 10000;
.content{
width: 100%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
position: absolute;
}
.Prompt-Text {
margin-top: 34rpx;
color: #999999;
font-size: 28rpx;
}
}
</style>

View File

@ -0,0 +1,388 @@
<template>
<view class="b-rx-sku-popup">
<u-popup :show="show" @close="show = false" round="20" closeable zIndex="20080">
<view class="commodity-sku">
<!-- 商品图 -->
<view class="commodity-sku-Inofr">
<!-- 商品图片 -->
<view class="commodity-sku-Inofr-cover">
<image class="img" :src="skuinfor['product_img']" mode="widthFix"></image>
</view>
<view class="commodity-sku-Inofr-commodity">
<view class="commodity-sku-Inofr-commodity-title">
{{skuinfor['product_name']}}
</view>
<view class="commodity-sku-Inofr-commodity-sku" v-if="skuinfor['sku']">
<view class="commodity-sku-Inofr-commodity-sku-text">
{{skuinfor['sku']}}
</view>
<view class="commodity-sku-Inofr-commodity-sku-Price">
<text class="text1"></text>
<text class="text2">{{RetainDecimalPoint(skuinfor['adj_pay'] * skuinfor['num'])}}</text>
</view>
</view>
</view>
</view>
<!-- 规格 -->
<view class="commodity-sku-option" v-if="skuinfor['details']">
<template v-for="(item,index) in skuinfor['details']['optional']">
<view class="commodity-sku-option-item" :key="index">
<view class="commodity-sku-option-item-label">
{{item['name']}}
</view>
<view class="commodity-sku-option-item-values">
<template v-for="(item2,index2) in item['sku_infos']">
<view @tap="skuClick(index,index2)"
:class="{'commodity-sku-option-item-values-activation' :item2['checked']}"
class="commodity-sku-option-item-values-item" :key="index2">
{{item2['name']}}
</view>
</template>
</view>
</view>
</template>
</view>
<view class="commodity-sku-Infor">
<view class="commodity-sku-Infor-left">
<view class="commodity-sku-Infor-left-cart">
<image class="img" :src="qnyurl('reduce.png','xbk')" mode="" @tap="reducequantity()"></image>
<view class="num">
{{skuinfor['num']}}
</view>
<image class="img" :src="qnyurl('add.png','xbk')" mode="" @tap="Addquantity()"></image>
</view>
</view>
<!-- Addcommodity方法中不可设置形参,因为点击事件默认第一个参数就是点击事件的各种参数并不是形参中所设置的默认值 -->
<!-- 所以在点击时手动传入skuinfor参数 -->
<view class="commodity-sku-Infor-right" @tap="Addcommodity">
加入购物车
</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import {
mapGetters
} from 'vuex';
import mixin from '@/static/js/mixin/mixin.js'
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js'
export default {
mixins: [mixin,restaurantmixins],
name: "b-rx-sku-popup",
data() {
return {
// /
show: false,
//
skuinfor: {},
//
skutext: '',
};
},
computed: {
...mapGetters({
GetcommodityInfor: 'shopping/GetcommodityInfor'
})
},
watch: {
// ,便
GetcommodityInfor(value) {
this['skuinfor'] = JSON.parse(JSON.stringify(value));
console.log(this['skuinfor'],'skuinfor')
this.skuInit();
//
// var cmr = this.screensku_xbk();
// // this['skuinfor']['sku_code'] = cmr['sku_code'];
// this['skuinfor']['sku'] = cmr['sku'];
// this['skuinfor']['pay'] = cmr['pay'];
// // this['skuinfor']['adj_pay'] = this['skuinfor']['pay_price'];
// this['skuinfor']['add_price'] = cmr['add_price'];
}
},
methods: {
/**
* @添加数量
* */
Addquantity(num = 1) {
this['skuinfor']['num'] += num;
},
/**
* @选择规格数量减
* */
reducequantity(num = 1) {
if (this['skuinfor']['num'] == 1) return;
this['skuinfor']['num'] -= num;
},
/**
* @加入购物车
* */
Addcommodity() {
uni.$u.debounce(() => {
console.log(this['skuinfor'],'加入购物车商品');
this.ADD_CART({
commodity: this['skuinfor'],
quantity: this['skuinfor']['num']
}).then(() => {
this['show'] = false;
});
}, 800, true)
},
skuInit(){
let add_price = 0;
let r = [];
let sku_code = [];
// JSON.parseJSON.stringify
// RetainDecimalPoint
// let pay = +this.RetainDecimalPoint(JSON.parse(JSON.stringify(this['skuinfor']['pay_price'])));
let pay = +JSON.parse(JSON.stringify(this['skuinfor']['pay_price']));
// let t = this['skuinfor']['details']['optional'];
let t = this['skuinfor']['details']['optional'];
for (let i = 0; i < t['length']; i++) {
let item = t[i];
r.push(...item['sku_infos']);
};
let newarr = r.filter(item => {
if (item['checked']) {
if (item?.price) {
add_price = item['price'] * 100;
//
pay += add_price
};
return item;
}
}).map(item => item['name']);
// console.log(newarr,'newarr');
let str = [];
for (let i = 0; i < this['skuinfor']['details']['optional']['length']; i++) {
let t = this['skuinfor']['details']['optional'];
str.push(`${t[i]['id']}_${t[i]['sku_infos'].find(item=>item['checked'])['id']}`)
};
console.log(newarr,str);
//
this['skuinfor']['sku'] = newarr.join('/');
// code
this['skuinfor']['sku_code'] = str.join(',');
this['skuinfor']['add_price'] = add_price;
this['skuinfor']['adj_pay'] = (+this['skuinfor']['pay_price']) + (+add_price);
console.log(this['skuinfor'],'星巴克筛选');
},
/**
* @规格选择
* */
skuClick(index1, index2) {
// ,
this['skuinfor']['details']['optional'][index1]['sku_infos'].map((item, index) => {
if (index2 == index) {
item['checked'] = true;
} else {
item['checked'] = false;
}
});
this.skuInit();
// var cmr = this.screensku_xbk();
// console.log(cmr,'cmr');
// // this['skuinfor']['sku_code'] = cmr['sku_code'];
// this['skuinfor']['sku'] = cmr['sku'];
// this['skuinfor']['pay'] = cmr['pay'];
// // this['skuinfor']['adj_pay'] = this['skuinfor']['pay_price'];
// this['skuinfor']['add_price'] = cmr['add_price'];
},
}
}
</script>
<style lang="scss">
//
.commodity-sku {
&-Inofr {
border-bottom: 1rpx dashed #cccccc;
padding: 32rpx;
display: flex;
justify-content: space-between;
&-cover {
width: 176rpx;
height: 176rpx;
border-radius: 10rpx;
overflow: hidden;
.img {
width: 100%;
height: 100%;
}
}
&-commodity {
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
&-title {
line-height: 70rpx;
}
&-sku {
display: flex;
justify-content: space-between;
align-items: center;
&-text {
color: #666666;
font-size: 25rpx;
}
&-Price {
color: #DE302D;
.text1 {
font-size: 26rpx;
}
.text2 {
font-size: 35rpx;
}
}
}
}
}
// &-cover {
// // height: 560rpx;
// height: auto;
// position: relative;
// // &-title {
// // color: #333333;
// // font-size: 34rpx;
// // }
// // &-name {
// // position: absolute;
// // left: 0;
// // bottom: 0;
// // width: 100%;
// // display: flex;
// // justify-content: space-between;
// // align-items: center;
// // color: #ffffff;
// // padding: 10rpx 32rpx;
// // background-color: rgba(255, 255, 255, 0.5);
// // &-cart {
// // flex: 1;
// // height: 60rpx;
// // display: flex;
// // justify-content: flex-end;
// // font-size: 36rpx;
// // align-items: center;
// // .num {
// // max-width: 100rpx;
// // min-width: 100rpx;
// // text-align: center;
// // }
// // .img {
// // width: 42rpx;
// // height: 42rpx;
// // }
// // }
// // }
// }
&-option {
padding: 32rpx;
&-item {
width: 100%;
font-size: 26rpx;
margin-bottom: 15rpx;
&-label {
font-weight: 800;
min-width: 112rpx;
height: 100%;
color: #333333;
line-height: 100rpx;
}
&-values {
width: 100%;
display: flex;
justify-content: flex-start;
&-activation {
background: #ececec !important;
border: 1rpx solid #F7F8FA;
}
&-item {
min-width: 112rpx;
height: 100%;
line-height: 70rpx;
border-radius: 6rpx;
margin-bottom: 20rpx;
background: #ffffff;
text-align: center;
margin-right: 15rpx;
border: 1rpx solid transparent;
}
}
}
}
&-Infor {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding: 32rpx;
border-top: 1rpx solid rgba(102, 102, 102, 0.1);
&-left {
&-cart {
flex: 1;
height: 60rpx;
display: flex;
justify-content: flex-end;
font-size: 36rpx;
align-items: center;
.num {
max-width: 100rpx;
min-width: 100rpx;
text-align: center;
}
.img {
width: 42rpx;
height: 42rpx;
}
}
}
&-right {
width: 254rpx;
height: 86rpx;
background: #00AF66;
box-shadow: 0 6rpx 8rpx 0 rgba(74, 111, 231, 0.2300);
border-radius: 43rpx;
text-align: center;
line-height: 86rpx;
color: #ffffff;
}
}
}
</style>

View File

@ -0,0 +1,185 @@
<template>
<view>
<view class="flex flex-space-between" style="margin-bottom: 30rpx;">
<view class="flex">
<view class="" style="margin-right: 20rpx;">
<u-image width="180rpx" height="180rpx" radius="10rpx" :src="detail.goodsImg"></u-image>
</view>
<view class="" style="align-items: bottom;">
<view class="" :style="'height:' +(types == 0?'100':'80')+'rpx;'">
<u-text color="#333333" size="28rpx" lines="2" :text="detail.goodsTitle"></u-text>
</view>
<view class="fy">
<view class="je-class">
<text style="font-size: 20rpx;"></text><text>{{detail.price/100}}</text>
</view>
<view class="">
<text>分佣比</text><text style="color:#E71111">{{detail.commission_point}}</text><text>%</text>
</view>
<view class="lit-999">
<text>销量{{detail.sales}}</text>
</view>
<view class="lit-999" v-if="detail['is_sync'] == 1 && detail['is_sync_status'] == 1">
<text>库存{{detail['stock']}}</text>
</view>
<view class="lit-999" v-if="detail['is_sync'] == 1 && detail['is_sync_status'] == 1">
<text>阿里销量{{detail['ali_sales']}}</text>
</view>
</view>
</view>
</view>
<view class="flex" style="align-items: center;margin-left: 20rpx;">
<view class="" v-if="types == 0">
<view class="check-btn" @click="checkThis2">
选择
</view>
</view>
<view class="" v-if="types == 1">
<!-- 添加阿里库存 -->
<view v-if="detail['is_sync'] == 1 && detail['is_sync_status'] == 1" class="Add-stock" @click="show = true">
增加库存
</view>
<block v-if="detail.status == 2">
</block>
<block v-if="detail.status == 4">
<view class="check-btn" @click="checkThis(0)">
上架
</view>
</block>
<block v-if="detail.status == 3">
<view class="check-btn check-btn-red" @click="checkThis(1)">
编辑
</view>
<u-gap height="20rpx"></u-gap>
<view class="check-btn" @click="checkThis(2)">
重新提交审核
</view>
</block>
<block v-if="detail.status == 1">
<view class="check-btn" @click="checkThis(3)">
下架
</view>
</block>
<block v-if="detail.status == 0">
<view class="check-btn check-btn-red" @click="checkThis(1)">
编辑
</view>
<u-gap height="20rpx"></u-gap>
<view class="check-btn" @click="checkThis(0)">
重新上架
</view>
</block>
</view>
</view>
</view>
<!-- 添加库存弹框 -->
<u-modal :show="show" title="添加库存" showCancelButton @confirm="confirm" @close="show = false" @cancel="show = false">
<view class="slot-content">
<u-input placeholder="请输入内容" border="surround" v-model="value"></u-input>
</view>
</u-modal>
</view>
</template>
<script>
export default {
name: "bGoods",
props: {
types: {
type: Number,
default: 0
},
detail: {
type: Object,
default: null
}
},
data() {
return {
show: false,
value:'',
};
},
methods: {
checkThis(type) {
// 0 1 2 3
let title = type == 0?'上架成功':type == 3?'下架成功':'';
this.$emit('checkThis', {
type: type,
goods_id: this.detail.goods_id
},()=>{
console.log('提示');
uni.showToast({
title,
})
})
},
checkThis2() {
// 0 1 2 3
this.$emit('checkThis', this.detail)
},
//
confirm(){
uni.showLoading({
title: '加载中...'
});
this.$store.dispatch('shop/itemInventoryModify',{
g_id:this['detail']['goods_id'],
stock:+this['value']
}).then(res => {
uni.showToast({
title:'设置成功'
});
this['show'] = false;
this['value'] = '';
uni.hideLoading();
})
}
//
// /store.goods/itemInventoryModify g_id:id;stock:
// /store.order/gdOrderList date:();item_title:;commission_type:(0:;1:)
// /store.order/gdOrderInfo order_no
}
}
</script>
<style>
.je-class {
font-size: 30rpx;
color: #E71111;
}
.fy {
font-size: 24rpx;
color: #666666;
}
.check-btn {
width: 170rpx;
background: linear-gradient(45deg, #FFAD02, #FD8F3B);
text-align: center;
color: #fff;
font-size: 24rpx;
height: 60rpx;
line-height: 60rpx;
border-radius: 20rpx;
}
.check-btn-red {
background: #E71111;
}
.Add-stock {
height: 60rpx;
background: #DE0D0D;
color: #ffff;
font-size: 24rpx;
text-align: center;
line-height: 60rpx;
border-radius: 20rpx;
margin-bottom: 15rpx;
}
</style>

View File

@ -0,0 +1,300 @@
<template>
<view class="K-Album-Content">
<template v-for="(item,index) in lists">
<view :key='index' class="Album-Img-Item" :style="{
'width': `${width}rpx`,
'height': `${height}rpx`,
'margin-right': MarginDistance(index+1),
'margin-bottom': Margin,
'border-radius':`${radius}rpx`
}">
<!-- 图片 -->
<view v-if="item['filetype'] == 'image'" class="Album-Img-Item-Img" @tap.stop="previewImage(index)">
<image class="img" :src="item['url']" mode="aspectFill"></image>
<!-- <u--image :showLoading="true" :src="item['url']"></u--image> -->
</view>
<view class="Album-Img-Item-video" v-if="item['filetype'] == 'video'">
<!-- 视频 -->
<!-- <video :id="`Video${index}`" :src="item['url']"></video> -->
<!-- 视频封面 -->
<image class="img" :src="item['video_cover']" mode="aspectFill"></image>
</view>
<!-- 删除元素 -->
<view v-if="deletable" class="Album-Img-Item-deletable" @click="deleteBtn(index)">
<text class="icon iconfont icon-shanchu Album-Img-Item-deletable-icon"></text>
<!-- <image class="Album-Img-Item-deletable-icon" src="/static/image/nolineimage/deletable-icon.png"
mode=""></image> -->
</view>
</view>
</template>
<view class="append" @click="AddImages" v-if="lists.length < (Max-0) && isadd" :style="{
'width': `${width}rpx`,
'height': `${height}rpx`,
'margin-right': MarginDistance(lists.length+1),
'margin-bottom': Margin,
'border-radius':`${radius}rpx`
}">
<!-- <image class="img" src="/static/image/add.png" mode=""></image> -->
<view class="freight-row-up-img-el">
+
</view>
</view>
</view>
</template>
<script>
import props from './props.js';
/**
* Album 图片展示/上传组件
*
* @width 展示图片/视频宽度
* @height 展示图片/视频高度
* @list 展示数组
* @deletable 是否显示删除按钮
* @WAdaptive 展示宽度是否自适应,当该属性为true时width无效,会根据所给左间距来动态计算每个块的宽度
* @rightM 左间距(xx)
* @bottoM 下间距(xx)
* @Max 做多展示几张
* @radius 圆角
*/
export default {
mixins: [props],
name: "K-Album",
data() {
return {
lists: [],
Margin: 0,
linenumber: 0,
index: -1,
videotype: ['wmv', 'asf', 'asx', 'rm', 'rmvb', 'mp4', '3gp', 'mov', 'm4v', 'avi', 'dat', 'mkv', 'flv',
'vob'
],
imgtype: ['bmp', 'jpg', 'png', 'tif', 'gif', 'pcx', 'tga', 'exif', 'fpx', 'svg', 'psd',
'cdr', 'pcd', 'dxf', 'ufo', 'eps', 'ai', 'raw', 'WMF', 'webp', 'avif', 'apng'
]
};
},
async onReady() {
let Element = await this.getElSize.call(this, 'K-Album-Content');
// px
let w = uni.upx2px(this['width']);
//
let l = parseInt(Element['width'] / w);
// - ( * ) /
let Margin = ((Element['width'] - (w * l)) / (l - 1)) / (uni.upx2px(100) / 100) + 'rpx';
this['linenumber'] = l;
this['Margin'] = Margin;
},
computed: {
// Style() {
// this['index'] += 1;
// console.log(this['index'], '12312');
// return `width:${this['width']}rpx;height:${this['height']}rpx;margin-right:${((this['index'] + 1) % this['linenumber'] == 0) ? '' : this['Margin']}`
// },
},
mounted() {
console.log(this,'this');
//
if (this['list']['length'] > 0) {
this['lists'] = this.DataReset(this['list']);
console.log(this.DataReset(this['list']), '列表');
}
},
methods: {
/**
* @获取元素高度
* */
getElSize(em) {
return new Promise((res, rej) => {
uni.createSelectorQuery().in(this).select(`.${em}`)
.boundingClientRect(rect => {
res(rect);
})
.exec();
});
},
/**
* @删除按钮
* */
async deleteBtn(i) {
if (!this['deletable']) return;
this['lists'].splice(i, 1);
this.$emit('UpImg', this['lists'])
},
/**
* @检测类型
* */
detectionType(file) {
},
MarginDistance(index) {
return (index % this['linenumber'] == 0) ? '' : this['Margin']
},
/**
* @数据格式重置
* */
DataReset(d) {
let list = d.map(item => {
if (Object.prototype.toString.call(item) == '[object String]') {
if (!!item) {
return {
url: item,
filetype: this.detectionType(item)
}
}
} else if (Object.prototype.toString.call(item) == '[object Object]') {
return {
url: item[this['keyName']] || item['path'],
filetype: this.detectionType(item[this['keyName']] || item['path']),
video_cover: item['video_cover']
}
}
});
// console.log(list);
return list;
},
/**
* @添加图片
* */
AddImages() {
console.log(this.tool.uploadFile);
this.tool.uploadFile().then(data => {
let i = this.DataReset(data);
this['lists'].push(...i);
this.$emit('UpImg', this['lists'])
})
},
/**
* @预览
* */
previewImage(current) {
let tempFilePaths = this['lists'].map(item => {
return item['url']
})
uni.previewImage({
current,
urls: tempFilePaths,
longPressActions: {
// itemList: ['', '', ''],
success: function(data) {
// console.log('' + (data.tapIndex + 1) + ',' + (data.index + 1) + '');
},
fail: function(err) {
// console.log(err.errMsg);
}
}
});
},
detectionType(url) {
let xj = url.substring(url.lastIndexOf('.') + 1);
if (this.imgtype.indexOf(xj) !== -1) {
return 'image';
} else if (this.videotype.indexOf(xj) !== -1) {
return 'video'
}
}
}
}
</script>
<style lang="scss">
.K-Album-Content {
display: flex;
flex-wrap: wrap;
.Album-Img-Item {
// background-color: red;
overflow: hidden;
position: relative;
&-Img {
width: 100%;
height: 100%;
.img {
width: 100%;
height: 100%;
}
}
&-video {
width: 100%;
height: 100%;
.img {
width: 100%;
height: 100%;
}
}
&-deletable {
width: 30rpx;
height: 30rpx;
position: absolute;
top: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
border-radius: 0 0 0 15rpx;
z-index: 100;
text-align: center;
line-height: 30rpx;
&-icon {
width: 100%;
height: 100%;
font-size: 20rpx !important;
color: #ffffff;
}
}
}
}
.append {
.img {
width: 100%;
height: 100%;
}
}
@font-face {
font-family: "iconfont";
/* Project id 2903098 */
src: url('https://at.alicdn.com/t/font_2903098_lk7t0kvsx3k.woff2?t=1654136213785') format('woff2'),
url('https://at.alicdn.com/t/font_2903098_lk7t0kvsx3k.woff?t=1654136213785') format('woff'),
url('https://at.alicdn.com/t/font_2903098_lk7t0kvsx3k.ttf?t=1654136213785') format('truetype');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-shanchu:before {
content: "\e6f0";
}
.freight-row-up-img-el{
width: 88rpx;
height: 88rpx;
background-color: #DEDEDE;
margin-top: 20rpx;
color: #999999;
text-align: center;
line-height: 80rpx;
font-size: 80rpx;
}
</style>

View File

@ -0,0 +1,53 @@
export default {
props: {
width: {
type: Number | String,
default: 88,
},
height: {
type: Number | String,
default: 88,
},
list: {
type: Array,
default: () => {
return []
},
},
deletable: {
type: Boolean,
default: true
},
widthAdaptive: {
type: Boolean,
default: false,
},
Max: {
type: Number | String,
default: 9
},
rightM: {
type: Number | String,
default: 15,
},
bottoM: {
type: Number | String,
default: 15
},
radius: {
type: Number | String,
default: 10,
},
keyName:{
type:String,
default:'url',
},
// 是否显示添加
isadd:{
type:Boolean,
default:true,
}
}
}

View File

@ -0,0 +1,118 @@
<template>
<view>
<view class="flbtn" style="padding-top: 20rpx;">
<view class="flex">
<u-checkbox-group @change="checkboxChange">
<u-checkbox checked activeColor="#FF7700" shape="circle" v-for="(item, index) in checkboxList1"
:key="index" :label="item.name" :name="item.name">
</u-checkbox>
</u-checkbox-group>
<view class="lit-666 bold" style="padding-top: 4rpx;">
可用消费补贴卡余额抵扣<text style="color: #EB4141;">{{newPrice/100}}</text>
</view>
</view>
<view class="lit-666" style="font-weight: 400;padding-top: 4rpx;">
余额{{amount/100}}
</view>
</view>
<u-gap height="10rpx"></u-gap>
<view class="lit-666" style="padding-left: 44rpx;" v-if="amount < newPrice">
您余额不足实际可抵扣<text style="color: #EB4141;">{{amount <= 0?'0':(amount) / 100}}</text>
</view>
</view>
</template>
<script>
import {conWalletInfoAPI} from '@/request/pay/index.js'
export default {
name: "card-checked",
props: {
price: {
type: [String, Number],
default: 0
},
// percent:{
// type:[Number,String],
// default:0
// },
// store_id:{
// type:[String,Number],
// default:0
// }
},
data() {
return {
checkboxList1: [{
name: '',
}],
checked: '',
amount: -1,
newPrice: 0,
// price:0,
// percent:0
};
},
watch: {
price: {
immediate: true,
async handler(newVul, oldVul) {
console.log('*-*-*-*')
if(this.amount <= -1){
await this.getWallet()
}
// console.log(newVul,this.amount, '');
// console.log(newVul, 'new')
this.newPrice = Math.floor(newVul);
let _p = (this.newPrice > this.amount ? this.amount : this.newPrice) /
100 //this['amount'] * this['percent'];
this.$emit('GitData', _p)
// this.price = Math.floor(val*this.percent)
// console.log(val,'')
}
},
},
// mounted() {
// // console.log(this['price'], 'pricepriceprice');
// // this.getWallet();
// // this.getPercent();
// },
methods: {
async getWallet() {
let self = this;
// console.log('');
let _m = await conWalletInfoAPI();
console.log(_m,'111111111')
self['amount'] = _m['data']['amount'] ;
// self['amount'] = 10;
},
// getPercent(){
// this.$store.dispatch('api/storeDeductionProp',{
// store_id : this.store_id
// }).then(res => {
// this.percent = res
// })
// },
checkboxChange(e) {
console.log(e,'123');
this.$emit('checked', (e.length > 0 ? true : false))
// return this.checked
},
GetP() {
console.log(this.newPrice, 'new price')
let _p = (this.newPrice > this.amount ? this.amount : this.newPrice) /
100 //this['amount'] * this['percent'];
// console.log(_p,'p')
return _p;
}
}
}
</script>
<style>
</style>

View File

@ -0,0 +1,57 @@
<template>
<view>
<view class="flbtn" style="background-color: #fff;">
<view class="bd-color" :style="leftStyle">
</view>
<view class="center" :style="'padding-top: '+ (width / 2 -1 ) +'rpx;'">
<u-line dashed></u-line>
</view>
<view class="bd-color" :style="rightStyle">
</view>
</view>
</view>
</template>
<script>
export default {
name:"card_style",
props:{
width:{
type:Number,
default:40
},
bgColor:{
type:String,
default:'#f5f5f5'
}
},
computed: {
leftStyle(){
return 'background:'+ this.bgColor+';width: '+ this.width/2 +'rpx;height: '+ this.width+'rpx;border-radius: 0 '+ this.width/2+'rpx '+ this.width/2 +'rpx 0;'
},
rightStyle(){
return 'background:'+ this.bgColor+';width: '+ this.width/2 +'rpx;height: '+ this.width+'rpx;border-radius: '+ this.width/2+'rpx 0 0 '+ this.width/2 +'rpx;'
}
},
data() {
return {
};
}
}
</script>
<style>
.center{
width: 100%;
/* height: 40rpx; */
/* padding: 19rpx 5%; */
}
.right-box{
border-radius: 20rpx 0 0 20rpx;
background-color: #ededed;
}
</style>

1160
components/city.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,112 @@
<template>
<view>
<u-cell-group @click="goInfo" :border="false" customStyle="padding:0">
<u-cell :icon="commentData.head_img" :title="commentData.nickname"
titleStyle="margin-left:10rpx;font-size:22rpx"
iconStyle="width:114rpx;height:114rpx;border-radius: 50%;" :border="false" center>
<view slot="value" style="font-size: 22rpx;">
{{commentData.create_time}}
</view>
<view slot="label">
<u-rate size="22rpx" readonly activeColor="#000" :value="commentData.stars" inactiveColor="#000"></u-rate>
</view>
</u-cell>
</u-cell-group>
<view @click="goInfo" class="mt-30">
<rich-text style="font-size: 22rpx;color: #333333;"
:nodes="commentData.contents">
</rich-text>
</view>
<u-gap height="10"></u-gap>
<view class="mt-30" style="position: relative;" @click="showImage">
<view class="flex flex-left" style="flex-wrap: wrap;">
<view class="com-img" :style="index1==2?'margin-right:0':''" v-for="(item1,index1) in commentData.store_comment_img" :key="index1" v-if="showAllPic || index1 < 3">
<u-image width="100%" height="150rpx" :src="item1.img_url">
</u-image>
</view>
</view>
<view v-if="!showAllPic && commentData.store_comment_img.length> 3" class="qp">
{{commentData.store_comment_img.length}}
</view>
</view>
</view>
</template>
<script>
export default {
name:"comment",
props:{
showAllPic:{
type:Boolean,
default:false
},
commentData:{
type:Object,
default:null
}
},
data() {
return {
};
},
methods:{
goInfo(){
uni.navigateTo({
url:'/pages/comments/comment-info?comment_id='+this.commentData.comment_id,
fail(e) {
console.log(e,'err')
}
})
},
showImage(){
let _this = this
let urls = []
for(let i= 0;i<_this.commentData.store_comment_img.length;i++){
urls.push(_this.commentData.store_comment_img[i].img_url)
}
// console.log(urls)
// _this.commentData.store_comment_img.forEacn(v=>{
// urls.push(v.img_url)
// })
uni.previewImage({
urls:urls,
longPressActions: {
itemList: ['发送给朋友', '保存图片', '收藏'],
success: function(data) {
console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
},
fail: function(err) {
console.log(err.errMsg);
}
}
});
}
}
}
</script>
<style>
.com-img{
width: 30%;
margin-right: 20rpx;
margin-bottom: 20rpx;
}
.com-img.end{
margin-right: 0;
}
.qp {
position: absolute;
right: 10rpx;
bottom: 20rpx;
font-size: 20rpx;
background-color: #FFFFFF;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
border-bottom-left-radius: 20rpx;
padding: 0rpx 20rpx;
}
</style>

View File

@ -0,0 +1,76 @@
<template>
<view v-if="OrderStatus == 0">
{{wait_for}}
</view>
</template>
<script>
export default {
props: {
item: {
type: Object,
default: () => {}
},
status:{
type:[Number,String],
default:0
},
createtime:{
type:String,
default:'2022-11-11 00:00:00'
}
},
data() {
return {
wait_for: ''
}
},
mounted() {
this.tiem(this['OrderStatus'],this['Ordercreatetime']);
},
computed:{
OrderStatus(){
return this['status']
},
Ordercreatetime(){
return this['createtime']
}
},
methods: {
//
/**
* @param {Number} status 订单的状态
* @param {Number} createtime 下单时间
*/
tiem() {
console.log(this['OrderStatus'],'状态');
if (this['OrderStatus'] != 0) return;
//
let date = new Date(this['Ordercreatetime'].replace(/-/g, "/"));
date.setMinutes(date.getMinutes() + 30);
this['countDown'] = setTimeout(() => {
//
let end = date.getTime();
//
let start = new Date().getTime();
let x = new Date(end - start);
console.log(end - start, '执行2');
if ((end - start) <= 0) {
this.$emit('end')
// this['status'] = 5;
return;
};
this.tiem(this['OrderStatus'], this['Ordercreatetime'].replace(/-/g, "/"))
let m = x.getMinutes();
m = m > 9 ? m : `0${m}`;
let s = x.getSeconds();
s = s > 9 ? s : `0${s}`;
this['wait_for'] = `${m}:${s}`;
}, 1000)
},
}
}
</script>
<style>
</style>

View File

@ -0,0 +1,50 @@
<template>
<view>
<view class="status-line" :style="'height:' + lineHeight +';'">
</view>
<view class="status-line" :style="'height:' + navigateHeight +';'">
<view @click="goBack" class="flex" :style="'height:' + navigateHeight +';align-item:center;padding:0 20rpx'">
<u-icon name="arrow-left" ></u-icon>
</view>
</view>
</view>
</template>
<script>
export default {
name:"customHeader",
data() {
return {
navigateHeight:0,
lineHeight:0,
};
},
methods:{
goBack(){
this.$emit('goBack')
}
},
mounted() {
const systemInfo = uni.getSystemInfoSync();
// pxrpx
let pxToRpxScale = 750 / systemInfo.windowWidth;
let systems = {
ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, //
navigationHeight: 44 * pxToRpxScale, //
ktxWindowWidth: systemInfo.windowWidth * pxToRpxScale, // window
ktxWindowHeight: systemInfo.windowHeight * pxToRpxScale, // window
ktxScreentHeight: systemInfo.screenHeight * pxToRpxScale //
}
// tabBar
systems.tabBarHeight = systems.ktxScreentHeight - systems.ktxStatusHeight - systems.navigationHeight - systems
.ktxWindowHeight // tabBar
this.lineHeight = systems.ktxStatusHeight + 'rpx';
this.navigateHeight = systems.navigationHeight +'rpx';
},
}
</script>
<style>
</style>

View File

@ -0,0 +1,200 @@
<template>
<view class="Deduction" @tap="IsDeduction = !IsDeduction">
<view style="display: flex;justify-content:space-between;align-items: center;">
<view v-show="!IsDeduction" class="inactive"></view>
<view v-show="IsDeduction" class="active">
<image style="width: 100%;height: 100%;" src="https://img.agrimedia.cn/chwl/v2/xuanzyong.png"></image>
</view>
<view class="Deduction-Amount">
可用消费补贴卡余额抵扣:<text class="Deduction-Amount-Text">{{_amount(CanBeUsed)}}</text>
</view>
<view class="Amount">
账户余额:{{_amount(amount)}}
</view>
</view>
<view class="Amount-Running-Low" v-if="notEnough">
您余额不足实际可抵扣<text class="Amount-Running-Low-Text">{{_amount(Deduction_Amount)}}</text>
</view>
</view>
</template>
<script>
/**
* 若是传入的matrixing为true则会按照抵扣比例的计算方式计算抵扣价格
* <deduction :price="v['price'] * v['num']" matrixing :DeductionAmount="v['deduction_prop']"></deduction>
* */
import {
conWalletInfoAPI
} from '@/request/pay/index.js';
import mixin from '@/static/js/mixin/mixin.js'
export default {
name: "deduction",
mixins: [mixin],
props: {
//
price: {
type: [String, Number],
default: 0,
},
//
buyingPrice: {
type: [String, Number],
default: false
},
//
DeductionAmount: {
type: [String, Number],
default: 0,
}
},
data() {
return {
//
amount: -1,
//
IsDeduction: true,
//
CanBeUsed: 0,
//
Deduction_Amount: 0,
//
notEnough: false
};
},
computed: {
ax() {
return {
price: this['price'],
IsDeduction: this['IsDeduction'],
buyingPrice: this['buyingPrice'],
DeductionAmount: this['DeductionAmount']
}
}
},
watch: {
ax:{
deep:true,
immediate:true,
async handler(val){
// 使deep,,使async
if(this['amount'] == -1){
let conWalletInfo = await conWalletInfoAPI();
this['amount'] = conWalletInfo['data']['amount']
// this['amount'] = 600
};
// ,,
this['amount'] += Number(this['Deduction_Amount']);
console.log(val,'监听改变');
//
const profit = this['price'] - this['buyingPrice'];
//
this['CanBeUsed'] = Math.trunc(profit * (this['DeductionAmount'] / 100));
if (val['IsDeduction']) {
console.log(this['amount'],this['CanBeUsed']);
//
if(this['amount'] >= this['CanBeUsed']){
console.log('余额足够抵扣');
//
this['amount'] -= this['CanBeUsed'];
//
this['Deduction_Amount'] = this['CanBeUsed'];
this['notEnough'] = false;
}else{
console.log('余额不足抵扣');
this.count();
//
this['notEnough'] = true;
}
} else {
this['amount'] += Number(this['Deduction_Amount']);
this['Deduction_Amount'] = 0;
this['notEnough'] = false;
};
const _amount = this['amount'],
_Deduction_Amount = this['Deduction_Amount'],
_price = this['price'] - this['Deduction_Amount'];
this.$emit('change', {
//
_amount,
//
_Deduction_Amount,
//
_price,
//
status: val['IsDeduction']
})
}
},
},
methods: {
count() {
this['notEnough'] = true;
this['Deduction_Amount'] = this['amount'];
this['amount'] = 0;
}
}
}
</script>
<style lang="scss">
.Deduction {
width: 100%;
background-color: #FFFFFF;
border-radius: 15rpx;
padding: 32rpx;
.Deduction-Amount {
font-weight: bold;
flex: 1;
margin-left: 15rpx;
}
.Amount,
.Deduction-Amount,
.Amount-Running-Low {
font-size: 24rpx;
color: rgba(102, 102, 102, 1);
line-height: 50rpx;
&-Text {
color: #EB4141;
}
}
.Amount-Running-Low {
padding-left: 56rpx;
}
//
.inactive,
.active {
width: 40rpx;
height: 40rpx;
min-width: 40rpx;
max-width: 40rpx;
min-height: 40rpx;
max-height: 40rpx;
border-radius: 50%;
}
.inactive {
border: 1rpx solid #c8c9cc;
}
//
.active {
// background-color: #FF7700;
// position: relative;
color: #FFFFFF;
// .icon-gouxuan{
// content: '';
// position: absolute;
// left: 50%;
// top: 50%;
// transform: translate(-50% -50%);
// }
}
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,139 @@
/* eslint-disable */
var provinceData = [{
"label": "北京市",
"value": "11"
},
{
"label": "天津市",
"value": "12"
},
{
"label": "河北省",
"value": "13"
},
{
"label": "山西省",
"value": "14"
},
{
"label": "内蒙古自治区",
"value": "15"
},
{
"label": "辽宁省",
"value": "21"
},
{
"label": "吉林省",
"value": "22"
},
{
"label": "黑龙江省",
"value": "23"
},
{
"label": "上海市",
"value": "31"
},
{
"label": "江苏省",
"value": "32"
},
{
"label": "浙江省",
"value": "33"
},
{
"label": "安徽省",
"value": "34"
},
{
"label": "福建省",
"value": "35"
},
{
"label": "江西省",
"value": "36"
},
{
"label": "山东省",
"value": "37"
},
{
"label": "河南省",
"value": "41"
},
{
"label": "湖北省",
"value": "42"
},
{
"label": "湖南省",
"value": "43"
},
{
"label": "广东省",
"value": "44"
},
{
"label": "广西壮族自治区",
"value": "45"
},
{
"label": "海南省",
"value": "46"
},
{
"label": "重庆市",
"value": "50"
},
{
"label": "四川省",
"value": "51"
},
{
"label": "贵州省",
"value": "52"
},
{
"label": "云南省",
"value": "53"
},
{
"label": "西藏自治区",
"value": "54"
},
{
"label": "陕西省",
"value": "61"
},
{
"label": "甘肃省",
"value": "62"
},
{
"label": "青海省",
"value": "63"
},
{
"label": "宁夏回族自治区",
"value": "64"
},
{
"label": "新疆维吾尔自治区",
"value": "65"
},
{
"label": "台湾",
"value": "66"
},
{
"label": "香港",
"value": "67"
},
{
"label": "澳门",
"value": "68"
}
]
export default provinceData;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,219 @@
<template>
<view class="level-container">
<h1 class="title">选择收货地址</h1>
<ul class="name-list">
<li :class="showIndex==0?'select':''" @click="anewSelect(0)">{{province}}</li>
<li :class="showIndex==1?'select':''" @click="anewSelect(1)" v-if="showIndex>=1">{{city}}</li>
<li :class="showIndex==2?'select':''" @click="anewSelect(2)" v-if="showIndex>=2">{{area}}</li>
<li :class="showIndex==3?'select':''" @click="anewSelect(3)" v-if="showIndex>=3">{{street}}</li>
</ul>
<ul v-if="showIndex==0" class="content" :style="'height:'+ heightCot + 'upx'">
<li @click="selectPro(index,item.label)" v-for="(item,index) in provinceData" :key="item['value']">{{item.label}}</li>
</ul>
<ul v-if="showIndex==1" class="content" :style="'height:'+ heightCot + 'upx'">
<li @click="selectCity(index,item.label)" v-for="(item,index) in cityData" :key="item['value']">{{item.label}}</li>
</ul>
<ul v-if="showIndex==2" class="content" :style="'height:'+ heightCot + 'upx'">
<li @click="selectaArea(index,item.label)" v-for="(item,index) in areaData" :key="item['value']">{{item.label}}</li>
</ul>
<ul v-if="showIndex==3" class="content" :style="'height:'+ heightCot + 'upx'">
<li @click="selectStreet(index,item)" v-for="(item,index) in streetsData" :key="item['value']">{{item}}</li>
</ul>
</view>
</template>
<script>
import provinceData from './city-data/province.js';
import getCity from './city-data/city.js';
import getArea from './city-data/area.js';
import getStreets from './city-data/streets.js';
export default {
data() {
return {
province: "请选择",
city: "请选择",
area: "请选择",
street: "请选择",
cityDataAll: '', //
getAreaAll: '', //
getStreetsAll: '', //
presentIndex: [],
proIndex: 0,
cityIndex: 0,
areaIndex: 0,
provinceData: '', //
cityData: '', //
areaData: '', //
streetsData: '', //
showIndex: 0,
heightCot: 0,
bb: ''
}
},
created() {
uni.getSystemInfo({
success: res => {
console.log(res.safeArea.height)
this.heightCot = (res.safeArea.height * 2) / 2
}
})
},
mounted() {
// console.log(provinceData)
this.provinceData = provinceData;
this.cityDataAll = getCity;
this.getAreaAll = getArea;
this.getStreetsAll = getStreets;
console.log(this.provinceData)
// console.log(this.cityDataAll)
// console.log(this.getAreaAll)
// console.log(this.getStreetsAll)
},
methods: {
anewSelect(num) {
switch (num) {
case 0:
this.showIndex = 0;
this.areaData = [];
this.streetsData = [];
this.city = '请选择';
this.area = '请选择';
this.street = '请选择'
break;
case 1:
this.showIndex = 1;
this.areaData = [];
this.streetsData = [];
this.area = '请选择';
this.street = '请选择'
break;
case 2:
this.showIndex = 2;
this.streetsData = [];
this.street = '请选择'
break;
case 3:
console.log(11111);
break;
}
},
selectPro(index, label) {
console.log(index)
const {
cityDataAll
} = this;
this.proIndex = index; //
this.province = label;
this.cityData = cityDataAll[index];
this.showIndex = 1;
},
selectCity(index, label) {
const {
proIndex
} = this;
// console.log(this.getAreaAll)
this.city = label;
this.cityIndex = index; //
this.areaData = this.getAreaAll[proIndex][index];
this.showIndex = 2;
},
selectaArea(index, label) {
const {
proIndex,
cityIndex
} = this;
this.area = label;
this.showIndex = 3;
console.log(index)
console.log(this.getStreetsAll[proIndex][cityIndex])
console.log(this.getStreetsAll[proIndex][cityIndex][index])
this.streetsData = this.getStreetsAll[proIndex][cityIndex][index]
},
selectStreet(index, label) {
this.street = label;
const {
province,
city,
area,
street
} = this;
this.$emit('conceal',{
province,
city,
area,
street
})
// this.showIndex = 4;
}
}
}
</script>
<style lang="less">
ul,li{
list-style: none;
}
.level-container {
width: 100%;
background: #fff;
.select {
color: red;
position: relative;
&::after {
content: '';
width: 40upx;
height: 6upx;
background: red;
position: absolute;
left: 50%;
bottom: -8upx;
margin-left: -20upx;
}
}
li {
font-size: 26upx;
}
.content,
.name-list {
padding: 0 20upx;
}
.title {
font-size: 32upx;
margin: 30upx 20upx;
}
.name-list {
display: flex;
li {
margin-right: 40upx;
padding-bottom: 6upx;
}
}
.content {
margin-top: 20upx;
height: 600upx;
overflow-y: auto;
li {
border-bottom: 1px solid #f1f1f1;
padding: 20upx 0;
}
li:last-child {
border-bototm: none !important;
}
}
}
</style>

View File

@ -0,0 +1,43 @@
<template>
<view>
<view class="flex flex-center" style="padding: 30rpx 0;background-color: #f1f1f1;">
<view class="">
<u-line margin="20rpx 10rpx" length="100rpx"></u-line>
</view>
<view class="">
<u-text color="#999" :text="title+'·'" wordWrap="break-word"></u-text>
</view>
<view class="">
<u-text color="#31cf55" :bold="true" :text="enTitle"></u-text>
</view>
<view>
<u-line margin="20rpx 10rpx" length="100rpx"></u-line>
</view>
</view>
</view>
</template>
<script>
export default {
name:"fgTitle",
props:{
title:{
type:String,
default:'商品详情'
},
enTitle:{
type:String,
default:"DETAILS"
}
},
data() {
return {
};
}
}
</script>
<style>
</style>

View File

@ -0,0 +1,247 @@
<!-- 电影列表 -->
<template>
<view class="main" @tap="TofilmDesc(data)">
<view class="main-data" v-if="data.publishStatus == 'WAIT'">{{data.publishDate}}</view>
<view class="main-wrap">
<view class="main-image">
<image :src="data.posterUrl"></image>
</view>
<view class="main-content">
<view class="main-left">
<view class="main-title">{{data.movieName}}</view>
<view class="main-sub">导演{{data.director}}</view>
<view class="main-role">主演{{data.cast}}</view>
<view class="main-tag">
<text class="tag" v-if="data.versionType">
{{data.versionType}}
</text>
<text class="tag" v-if="data.movieType">
{{data.movieType}}
</text>
</view>
<view class="main-score" v-if="tabActive == 0">
评分<text>{{data.grade}}</text>
</view>
<view class="main-score" v-else>
<text>100</text>人想看
</view>
</view>
<view class="main-right" v-if="data.publishStatus == 'HOT'">
<view class="stop" v-if="data.stopSellTime">
停售
</view>
<view class="buy" v-else @tap.stop="buyBill(data)">
购票
</view>
</view>
<view class="main-right" v-else>
<view class="presell">
预售
</view>
<!-- <view class="want">
想看
</view> -->
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: "film-item",
props: {
tabActive: {
type: Number,
default: function () {
return 0
}
},
//
data: {
type: Object,
default: function () {
return {}
}
},
cinemaData: {
type: Object,
default: function () {
return {}
}
},
// or()
isPlay: {
type: Boolean,
default: function () {
return false
}
},
},
computed: {
},
methods: {
//
TofilmDesc(data) {
uni.navigateTo({
url: `../../pages/film/filmDesc?filmData=${encodeURIComponent(JSON.stringify(data))}`
})
},
//
buyBill(data) {
//
if (this.isPlay) {
uni.navigateTo({
url: `../../pages/film/filmPlay?cinemaData=${encodeURIComponent(JSON.stringify(this.cinemaData))}&filmData=${encodeURIComponent(JSON.stringify(data))}`,
})
} else {
//
uni.navigateTo({
url: `../../pages/film/filmYuan?filmData=${encodeURIComponent(JSON.stringify(data))}`
})
}
}
}
}
</script>
<style lang="scss" scoped>
.main {
margin-bottom: 20rpx;
.main-data {
margin-bottom: 24rpx;
font-size: 26rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #333333;
line-height: 40rpx;
}
.main-wrap {
padding: 24rpx;
width: 100%;
height: 260rpx;
background: #FFFFFF;
box-shadow: 0rpx 1rpx 4rpx 0rpx rgba(0,0,0,0.1);
border-radius: 20rpx;
display: flex;
.main-image {
width: 164rpx;
height: 216rpx;
margin-right: 20rpx;
image {
width: 164rpx;
height: 216rpx;
border-radius: 10rpx;
}
}
.main-content {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
height: 216rpx;
.main-left {
height: 216rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.main-title {
font-size: 30rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #333333;
line-height: 40rpx;
}
.main-sub, .main-role {
font-size: 24rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
line-height: 32rpx;
width: 300rpx !important;
display: inline-block;
white-space: nowrap;
width: 100%;
overflow: hidden;
text-overflow:ellipsis;
}
.main-tag {
.tag {
display: inline-block;
border: 2rpx solid #999999;
font-size: 24rpx;
color: #999999;
line-height: 26rpx;
margin-right: 10rpx;
padding: 1rpx 6rpx;
}
}
.main-score {
font-size: 24rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
line-height: 32rpx;
text {
color: #FF6D04;
font-weight: 900;
}
}
}
.main-right {
display: flex;
justify-content: space-between;
align-items: end;
width: 170rpx;
height: 216rpx;
flex-wrap: wrap;
.stop {
width: 170rpx;
height: 80rpx;
background: #DEDEDE;
box-shadow: 0rpx 2rpx 8rpx 0rpx rgba(0,0,0,0.1);
border-radius: 40rpx;
color: #666666;
text-align: center;
line-height: 80rpx;
font-size: 24rpx;
}
.buy {
width: 170rpx;
height: 80rpx;
background: linear-gradient(136deg, #FC4B5C 0%, #FD8D3D 100%);
box-shadow: 0rpx 2rpx 8rpx 0rpx rgba(0,0,0,0.1);
border-radius: 40rpx;
color: #FFFFFF;
text-align: center;
line-height: 80rpx;
font-size: 24rpx;
}
.presell {
width: 170rpx;
height: 80rpx;
background: linear-gradient(136deg, #9A00FF 0%, #FF6500 100%);
box-shadow: 0rpx 2rpx 8rpx 0rpx rgba(0,0,0,0.1);
border-radius: 40rpx;
color: #FFFFFF;
text-align: center;
line-height: 80rpx;
font-size: 24rpx;
}
.want {
width: 180rpx;
height: 80rpx;
background: linear-gradient(136deg, #FFD500 0%, #FF6500 100%);
box-shadow: 0rpx 2rpx 8rpx 0rpx rgba(0,0,0,0.1);
border-radius: 40rpx;
color: #FFFFFF;
text-align: center;
line-height: 80rpx;
font-size: 24rpx;
}
}
}
}
}
</style>

View File

@ -0,0 +1,182 @@
<template>
<view class="film-list">
<view class="times">
<view class="film-time">
{{filmList.showTime.substring(11, 16)}}
</view>
<view class="film-end">
{{filmList.stopSellTime.substring(11, 16)}}散场
</view>
</view>
<view class="size">
<view class="film-type">
{{filmList.showVersionType}}
</view>
<view class="film-end">
{{filmList.hallName}}
</view>
</view>
<view class="price">
<view class="film-price">
<text class="del-price">{{filmList.showPrice}}</text>
<text></text>{{Math.round((parseFloat(filmList.pay_price) - parseFloat(filmList.deduction_price))*100)/100}}
</view>
<view class="film-card">
消费卡补贴{{filmList.deduction_price}}
</view>
</view>
<!-- <view class="film-buy" @click="buyBill(filmList.showTime)" :class="this.isMoreOneTime(filmList.showTime)? '' : 'dontBuy'"> -->
<view class="film-buy" @click="buyBill(filmList.showTime)">
购票
</view>
</view>
</template>
<script>
import mixin from '@/static/js/mixin/mixin.js';
import film from '@/static/js/mixin/film.js';
export default {
mixins: [mixin, film],
data() {
return {
}
},
props: {
//
filmList: {
type: Object,
default: {}
},
//
filmData: {
type: Object,
default: {}
},
// ID
cinemaData: {
type: Object,
default: {}
}
},
methods: {
buyBill() {
uni.navigateTo({
url: `../../pages/film/filmSeat?cinemaData=${encodeURIComponent(JSON.stringify(this.cinemaData))}&filmList=${encodeURIComponent(JSON.stringify(this.filmList))}&filmData=${encodeURIComponent(JSON.stringify(this.filmData))}`
})
}
}
}
</script>
<style lang="scss" scoped>
.film-list {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
margin: 22rpx 0rpx;
.times {
width: 20%;
height: 80rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
margin-right: 24rpx;
.film-time {
font-size: 40rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #333333;
line-height: 52rpx;
}
.film-end {
font-size: 24rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
line-height: 32rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.size {
width: 25%;
display: flex;
flex-direction: column;
justify-content: space-between;
.film-end {
font-size: 24rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
line-height: 32rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.film-type {
font-size: 26rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #333333;
line-height: 60rpx;
text-overflow: ellipsis;
overflow: hidden;
white-space:nowrap;
}
}
.price {
width: 35%;
.film-price {
font-size: 32rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 900;
color: #FC4B5C;
line-height: 60rpx;
text-align: right;
text {
font-size: 24rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #FC4B5C;
line-height: 32rpx;
}
.del-price {
font-size: 24rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 32rpx;
text-decoration: line-through;
}
}
.film-card {
font-size: 24rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 32rpx;
text-align: right;
}
}
.film-buy {
width: 170rpx;
height: 80rpx;
background: linear-gradient(136deg, #FC4B5C 0%, #FD8D3D 100%);
box-shadow: 0rpx 2rpx 8rpx 0rpx rgba(0,0,0,0.1);
border-radius: 40rpx;
text-align: center;
color: #FFFFFF;
font-size: 24rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #FFFFFF;
line-height: 80rpx;
margin-left: 16rpx;
}
.dontBuy {
background: linear-gradient(136deg, #646464 0%, #121212 100%);
}
}
</style>

View File

@ -0,0 +1,92 @@
<!-- 三角角标组件 -
use:
<ynTriangleBadge width="60" height="60" text="金8" bgcolor="green" fontsize="12"></ynTriangleBadge>
-->
<template>
<!-- 定义三角面板包含2个元素 三角绘制和文字 -->
<view class="trianglePanel"
:style="{'max-width':width+'px','min-width':width+'px','max-height':height+'px','min-height':height+'px'}">
<view class="triangle-topright"
:style="{'border-top':height+'px solid '+bgcolor,'border-left':width+'px solid transparent'}"></view>
<!-- 用margin-left重叠三角 -->
<view class="textbox"
:style="{width:width*0.5+'px',height:height*0.5+'px','font-size':fontsize+'px','margin-left':width*-0.5+'px'}">
{{text}}
</view>
</view>
</template>
<script>
export default {
//
name: 'ynTriangleBadge',
props: {
//
bgcolor: {
type: String,
default: 'blue'
},
width: {
type: String,
default: '50'
},
height: {
type: String,
default: '50'
},
text: {
type: String,
default: 'N'
},
// 12px
fontsize: {
type: String,
default: "12"
}
},
data() {
return {
};
},
methods: {
},
created: function() {
},
// computed
computed: {},
}
</script>
<style>
.trianglePanel {
display: flex;
align-self: flex-end;
color: white;
/* border: red 1px solid; */
}
.textbox {
align-self: flex-start;
display: flex;
justify-content: center;
align-items: center;
z-index: 1;
margin: 1px;
/* 字符空格不忽略 */
white-space: pre;
word-break: break-all;
}
/* 右上三角 上 左有宽度 下 右 无宽度 */
.triangle-topright {
/* top:0;
left:0; */
z-index: 0;
width: 0;
height: 0;
}
</style>

View File

@ -0,0 +1,159 @@
<!-- 轮播图 -->
<template>
<view>
<view :style="{height: height+'rpx'}" class="swiper-container" @touchstart="touchStart" @touchend="touchEnd">
<view class="swiper-item" v-for="(item, index) in list" :key="index"
:style="{transform: styleList[index].transform, zIndex: styleList[index].zIndex, opacity: styleList[index].opacity,display:styleList[index].display}">
<view class="wrap">
<image @click="itemClick(index)" class="image" :src="item"></image>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
props: {
/**
* 图片url列表
*/
list: {
type: Array,
default: []
},
/**
* swiper高度
*/
height:{
type: Number,
default: 0
}
},
data() {
return {
/**
* 开始触摸点坐标
*/
start: {
x: 0,
y: 0
},
/**
* 每个item样式列表
*/
styleList: []
};
},
created() {
this.list.forEach((item, index) => {
this.styleList.push(this.addStyle(index))
})
},
methods: {
/**
* 计算每个item样式
* @param {Object} idx
*/
addStyle(idx) {
const len = this.list.length;
if (idx > len / 2) {
//item,62
var left = len - idx
return {
transform: 'scale(' + (1 - left / 10) + ') translate(-' + (left * 30) + '%,0px)',
zIndex: 9999 - left,
opacity: 0.8 / left,
display: idx == len - 1 ? "block" : "none"
}
} else {
//item64
return {
transform: 'scale(' + (1 - idx / 10) + ') translate(' + (idx * 30) + '%,0px)',
zIndex: 9999 - idx,
opacity: 0.8 / (idx === 0 ? 0.8 : idx),
display: idx > 1 ? "none" : "block"
}
}
},
/**
* 触摸开始
* @param {Object} e
*/
touchStart(e) {
this.start.x = e.changedTouches[0] ? e.changedTouches[0].pageX : 0;
this.start.y = e.changedTouches[0] ? e.changedTouches[0].pageY : 0;
},
/**
* 触摸结束
* @param {Object} e
*/
touchEnd(e) {
var newStyleList = JSON.parse(JSON.stringify(this.styleList))
let tx = e.changedTouches[0].pageX - this.start.x
let ty = e.changedTouches[0].pageY - this.start.y
if (Math.abs(tx) > Math.abs(ty)) {
//
if (tx < 0) {
//
var last = [newStyleList.pop()]
newStyleList = last.concat(newStyleList)
} else if (tx > 0) {
//
newStyleList.push(newStyleList[0])
newStyleList.splice(0, 1)
}
} else {
//
//
if (ty < 0) {
//
} else if (ty > 0) {
//
}
}
this.styleList = newStyleList
},
/**
* 当前item点击返回索引下标
* @param {Object} idx
*/
itemClick(idx) {
console.log(idx)
this.$emit('click', idx);
}
}
}
</script>
<style lang="scss">
.swiper-container {
box-sizing: border-box;
height: 690rpx;
width: 100%;
overflow: hidden;
position: relative;
.swiper-item {
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
transition: all .5s;
.wrap {
height: 100%;
width: 400rpx;
margin: 2rpx auto;
.image {
height: 100%;
width: 100%;
// border-radius: 10rpx;
// box-shadow: 0 0 10rpx #333;//
}
}
}
}
</style>

View File

@ -0,0 +1,792 @@
<!-- 电影画廊组件 -->
<template>
<view class="ynGalleryPanel">
<view class="gallerypanel" style="filter:brightness(1);border-radius:1upx"
:style="{'background':bkstyle,'height':galleryheight+'px','width':'100%'}">
<scroll-view class="scroll-view" scroll-x="true" scroll-with-animation="true" :scroll-into-view="toview"
:scroll-left="scrollLeft" @scroll="scroll">
<!-- scroll-view-panle 容纳左右空块+中间img块 -->
<view class="scroll-view-panle" @touchend='touchEndHandle' @touchstart='touchStartHandle'
@touchmove='touchMoveHandle'>
<!-- 左侧留空 必须用min-width属性 用width属性无效-->
<view class="leftview" :style="{'min-width':sviewlst.leftview.w+'px','height':galleryheight+'px'}">
</view>
<!-- 中间图像横向列表 ==-->
<!-- 外层 高度与画廊高度一样 -->
<view :id="'imgviewpanel'+index" :ref="'imgviewpanel'+index"
:class="[activeviewindex == index? 'trans-fadeout': '']" @animationstart="animationstartHandle"
@animationend="animationendHandle" v-for="(item,index) in sviewlst.imgsview" :key="index"
:style="{'width':item.w+'px','height':galleryheight+'px'}"
style="border: #BB6622 0px solid;display:flex;flex-direction: column;align-content:center;justify-content: flex-end;">
<!-- 内层 高度是图片容器的高度 -->
<!-- 顶部圆角角标 -->
<view v-if="showbadge && badegtype=='round'" class="roundbadge"
:style="{background:[(index % 2) ==0? 'red':'green']}">
<text> {{item.badeg}}</text>
</view>
<!-- 三角标记组件 -->
<!-- <ynTriangleBadge v-if="showbadge && badegtype=='trian'" :width="badegwidth"
:height="badegheight" :text="item.badeg" :bgcolor="item.badegcolor"
style="z-index:2;align-self: flex-end;margin-right: 5px;border: #EC6D2C 0upx solid;"
:style="{'margin-bottom':(parseInt(badegheight)+5)*-1+'px'}">
</ynTriangleBadge> -->
<!-- 图片框 居中属性-->
<view style="display:flex; align-content:flex-end;justify-content: center; border:red 0px solid;"
:style="{'width':item.w+'px','height': item.h+'px'}">
<image :ref="'image'+index"
style="align-self: center;border-radius: 1px; "
:style="{'width' :item.w-10 +'px',
'height':item.h-10 +'px',
'border':[activeviewindex == index? '#EC6D2C 1px solid':'#EC6D2C 0px solid']}"
:src="item.posterUrl"
@click="clickimg(index,item)" mode="scaleToFill">
</image>
</view>
<!-- 描述视图 -->
<view
style="display: flex;justify-content: center;margin-bottom: 4px;border: #008000 0px solid;min-height: 10px;">
<!-- <text v-if="showdec" style="align-self: center;font-size: 12px;color:white">{{item.dec}}</text> -->
</view>
</view>
<!-- 右侧留空 必须用min-width属性 用width属性无效-->
<view class="rightview"
:style="{'min-width':sviewlst.rightview.w+'px','height':galleryheight+'px'}"></view>
</view>
</scroll-view>
</view>
</view>
</template>
<script>
import ynTriangleBadge from './film-badge.vue';
export default {
components: {
ynTriangleBadge,
},
name: 'FilmSwiper',
props: {
//
bkstart: {
type: [String],
default: '#000000'
},
//
bkend: {
type: [String],
default: '#000000'
},
// px
galleryheight: {
type: [Number, String],
default: 180 * 1.0
},
//
images: {
type: Array,
},
//
imgviewwidth: {
type: [Number],
default: parseInt(170 * 0.5)
},
//
imgviewheight: {
type: [Number],
default: parseInt(235 * 0.45)
},
showbadge: {
type: [Boolean],
default: false
},
showdec: {
type: [Boolean],
default: false
},
badegtype: {
type: [String],
default: 'trian' //round trian
},
badegwidth: {
type: [String],
default: "25"
},
badegheight: {
type: [String],
default: "25"
}
},
data() {
return {
//bkstart bkend
bkstartcolor: this.bkstart,
bkendcolor: this.bkend,
badegcolor: "red",
//
TTT: null,
//
istouchmove: false,
//
isEndTouch: true,
//
screencenterpos: 0,
//viewindex
activeviewindex: 0,
//
offset: 0,
//
scrollLeft: 0,
//
newleft: 0,
//
oldleft: {
scrollleft: 0
},
//
sviewlst: {
leftview: {}, //
rightview: {}, //
imgsview: [] //image
},
toview: "viewitem0",
};
},
created: function() {
if (this.images.length > 0) {
this.screencenterpos = parseInt(uni.upx2px(750) / 2);
this.upDataScrollviewLayout(this.activeviewindex);
}
},
mounted: function() {},
watch: {
async images() {
var that = this;
console.log('watch监控到images属性变化');
this.screencenterpos = parseInt(uni.upx2px(750) / 2);
console.log("屏幕中点pos位置:" + this.screencenterpos + 'px');
this.upDataScrollviewLayout(this.activeviewindex);
},
activeviewindex() {
this.$emit('scrollerItem', this.images[this.activeviewindex])
}
},
computed: {
// imagedomiant
bkstyle() {
// return `radial-gradient(circle,${this.bkstartcolor}, ${this.bkendcolor})`
},
},
methods: {
SetBkRightAnimate: function(startcolor) {
var that = this;
var nums = 10;
//2
var colorarr = this.gradientColor(startcolor, this.bkendcolor, nums);
// console.log(colorarr)
let num = 10;
//
var i = setInterval(function() {
that.bkstartcolor = colorarr[num - 1]
num--;
//0=
if (num < (10 / 2))
clearInterval(i);
}, 50);
},
endscroll: function(e) {
// console.log('endscorll')
},
//scrol
scroll: function(e) {
// console.log('scroll ......')
var that = this;
// console.log(e)
this.newleft = e.mp.detail.scrollLeft;
this.oldleft.scrollleft = this.newleft;
//scroll+
let cenpos = e.mp.detail.scrollLeft + this.screencenterpos;
// console.log(':'+cenpos);
for (let i in this.sviewlst.imgsview) {
let item = this.sviewlst.imgsview[i];
if ((item.l <= cenpos) && (item.r >= cenpos)) {
let imgcpos = item.l + parseInt(item.w / 2);
let aoffset = cenpos - imgcpos;
this.offset = aoffset;
this.upDataScrollviewLayout(i);
break;
}
}
},
//$emit emit
clickimg(idx, imgviewobj) {
this.activeviewindex = idx
this.scrollLeft = this.sviewlst.imgsview[idx].l - parseInt(this.screencenterpos) + parseInt(this.sviewlst
.imgsview[idx].w / 2);
this.$emit('clickimg', imgviewobj)
},
touchStartHandle(e) {
//
this.istouchmove = false;
this.isEndTouch = false;
},
touchMoveHandle(e) {
//
this.istouchmove = true;
},
touchEndHandle(e) {
//
this.isEndTouch = true;
},
animationstartHandle() {
// css
// console.log('animate is start')
},
animationendHandle() {
//(right)
let color = this.sviewlst.imgsview[this.activeviewindex].dominant;
//
this.SetBkRightAnimate(color);
},
//Scrollviewview
//offset: ,2(,)
// offset scrollview offset
// offset, 线 offset
//
// ,index ,
// 0,
// ,index
upDataScrollviewLayout(activeindex) {
console.log('检测到 initScrollviewLayout');
var that = this;
this.upbkcolor = false;
var that = this;
if (this.images.length <= 0) {
return
};
var offset = this.offset;
//view
//1view
var lview = {}
lview.dec = "left view"
lview.w = this.screencenterpos;
lview.h = this.imgviewheight;
lview.l = 0;
lview.r = lview.l + lview.w;
//2imagelist
//2.1imageview
var arrimgview = [];
var i = 0;
while (i <= this.images.length - 1) {
let obj = {
index: i,
url: '', //
dec: '', //
badeg: '', //
badegcolor: this.badegcolor, //
dominant: this.bkstartcolor, //
w: 0, //view
h: 0, //view
l: 0, //viewscroll
r: 0, //viewscroll
}
//image
let imgview = Object.assign(obj, this.images[i]);
//
imgview.w = this.imgviewwidth;
imgview.h = this.imgviewheight;
if (i == 0) {
imgview.l = lview.r + 0;
} else {
imgview.l = arrimgview[i - 1].r + 0;
}
imgview.r = imgview.l + imgview.w;
arrimgview.push(imgview);
i++;
};
//3view
let rview = {}
rview.dec = "right view"
//使
rview.w = this.screencenterpos;
rview.h = this.imgviewheight;
if (arrimgview.length <= 0) {
rview.l = lview.r + 0;
} else {
rview.l = arrimgview[arrimgview.length - 1].r + 0;
}
rview.r = rview.l + rview.w;
//
var leftaf = 1;
var rightaf = 1;
var activeaf = 1;
var af = 0.18;
// 退2
if (arrimgview.length > 0) {
let aindex = activeindex;
let lindex = parseInt(aindex) - 1;
let rindex = parseInt(aindex) + 1;
//imgview(1.18)
let lw = (this.imgviewwidth * 1.18) / 2
//
let bl = Math.abs(offset) / lw
// 1.18
if (offset == 0) {
activeaf = 1.18;
leftaf = 1;
rightaf = 1;
}
if (offset > 0) {
activeaf = 1 + 0.18 * (1 - bl / 2)
rightaf = 1 + (1.18 - activeaf)
leftaf = 1;
}
if (offset < 0) {
activeaf = 1 + 0.18 * (1 - bl / 2)
leftaf = 1 + (1.18 - activeaf)
rightaf = 1;
}
//
if (aindex >= 0 && aindex <= arrimgview.length - 1) {
arrimgview[aindex].w = this.imgviewwidth * activeaf;
arrimgview[aindex].h = this.imgviewheight * activeaf;
} else {
console.log("焦点图越界");
return;
};
// offset0,
if (offset < 0) {
if (lindex >= 0) {
arrimgview[lindex].w = this.imgviewwidth * leftaf;
arrimgview[lindex].h = this.imgviewheight * leftaf;
}
}
// offset0,
if (offset > 0) {
if (rindex <= arrimgview.length - 1) {
arrimgview[rindex].w = this.imgviewwidth * rightaf;
arrimgview[rindex].h = this.imgviewheight * rightaf;
}
}
}
// lveiw rview
if (arrimgview.length > 0) {
lview.w = lview.w - (arrimgview[0].w / 2);
lview.r = lview.l + lview.w;
for (let i = 0; i <= arrimgview.length - 1; i++) {
if (i == 0) {
arrimgview[i].l = lview.r + 0;
} else {
arrimgview[i].l = arrimgview[i - 1].r + 0;
}
arrimgview[i].r = arrimgview[i].l + arrimgview[i].w;
};
rview.w = rview.w - (arrimgview[arrimgview.length - 1].w / 2) + 0;
rview.l = arrimgview[arrimgview.length - 1].r + 0;
rview.r = rview.l + rview.w;
}
//data template vue
var obj = {
'leftview': lview,
'rightview': rview,
'imgsview': arrimgview
};
this.activeviewindex = activeindex;
this.sviewlst = obj;
this.$nextTick(function() {
var that = this
if (this.istouchmove == true) {
clearTimeout(that.TTT);
var ai = that.activeviewindex;
var TTT = setTimeout(function() {
if (that.activeviewindex == ai) {
that.$emit('clickimg', that.sviewlst.imgsview[that.activeviewindex]);
}
}, 300)
}
})
},
/* 2
// startColorhex
// endColor hex
// count :
// sample: colorarr = gradientColor(startcolor,endcolor,5); 5
*/
gradientColor(startColor, endColor, count) {
let startRGB = this.colorToRgb(startColor); //rgb
let startR = startRGB[0];
let startG = startRGB[1];
let startB = startRGB[2];
let endRGB = this.colorToRgb(endColor);
let endR = endRGB[0];
let endG = endRGB[1];
let endB = endRGB[2];
let sR = (endR - startR) / count; //
let sG = (endG - startG) / count;
let sB = (endB - startB) / count;
var colorArr = [];
for (var i = 0; i < count; i++) {
//hex
var hex = this.colorToHex('rgb(' + parseInt((sR * i + startR)) + ',' + parseInt((sG * i + startG)) +
',' +
parseInt((sB * i + startB)) + ')');
colorArr.push(hex);
}
return colorArr;
},
// hexrgb(rgb)
colorToRgb(sColor) {
// <http://www.w3.org/TR/css3-color/#svg-color>
var names = {
aliceblue: "f0f8ff",
antiquewhite: "faebd7",
aqua: "0ff",
aquamarine: "7fffd4",
azure: "f0ffff",
beige: "f5f5dc",
bisque: "ffe4c4",
black: "000",
blanchedalmond: "ffebcd",
blue: "00f",
blueviolet: "8a2be2",
brown: "a52a2a",
burlywood: "deb887",
burntsienna: "ea7e5d",
cadetblue: "5f9ea0",
chartreuse: "7fff00",
chocolate: "d2691e",
coral: "ff7f50",
cornflowerblue: "6495ed",
cornsilk: "fff8dc",
crimson: "dc143c",
cyan: "0ff",
darkblue: "00008b",
darkcyan: "008b8b",
darkgoldenrod: "b8860b",
darkgray: "a9a9a9",
darkgreen: "006400",
darkgrey: "a9a9a9",
darkkhaki: "bdb76b",
darkmagenta: "8b008b",
darkolivegreen: "556b2f",
darkorange: "ff8c00",
darkorchid: "9932cc",
darkred: "8b0000",
darksalmon: "e9967a",
darkseagreen: "8fbc8f",
darkslateblue: "483d8b",
darkslategray: "2f4f4f",
darkslategrey: "2f4f4f",
darkturquoise: "00ced1",
darkviolet: "9400d3",
deeppink: "ff1493",
deepskyblue: "00bfff",
dimgray: "696969",
dimgrey: "696969",
dodgerblue: "1e90ff",
firebrick: "b22222",
floralwhite: "fffaf0",
forestgreen: "228b22",
fuchsia: "f0f",
gainsboro: "dcdcdc",
ghostwhite: "f8f8ff",
gold: "ffd700",
goldenrod: "daa520",
gray: "808080",
green: "008000",
greenyellow: "adff2f",
grey: "808080",
honeydew: "f0fff0",
hotpink: "ff69b4",
indianred: "cd5c5c",
indigo: "4b0082",
ivory: "fffff0",
khaki: "f0e68c",
lavender: "e6e6fa",
lavenderblush: "fff0f5",
lawngreen: "7cfc00",
lemonchiffon: "fffacd",
lightblue: "add8e6",
lightcoral: "f08080",
lightcyan: "e0ffff",
lightgoldenrodyellow: "fafad2",
lightgray: "d3d3d3",
lightgreen: "90ee90",
lightgrey: "d3d3d3",
lightpink: "ffb6c1",
lightsalmon: "ffa07a",
lightseagreen: "20b2aa",
lightskyblue: "87cefa",
lightslategray: "789",
lightslategrey: "789",
lightsteelblue: "b0c4de",
lightyellow: "ffffe0",
lime: "0f0",
limegreen: "32cd32",
linen: "faf0e6",
magenta: "f0f",
maroon: "800000",
mediumaquamarine: "66cdaa",
mediumblue: "0000cd",
mediumorchid: "ba55d3",
mediumpurple: "9370db",
mediumseagreen: "3cb371",
mediumslateblue: "7b68ee",
mediumspringgreen: "00fa9a",
mediumturquoise: "48d1cc",
mediumvioletred: "c71585",
midnightblue: "191970",
mintcream: "f5fffa",
mistyrose: "ffe4e1",
moccasin: "ffe4b5",
navajowhite: "ffdead",
navy: "000080",
oldlace: "fdf5e6",
olive: "808000",
olivedrab: "6b8e23",
orange: "ffa500",
orangered: "ff4500",
orchid: "da70d6",
palegoldenrod: "eee8aa",
palegreen: "98fb98",
paleturquoise: "afeeee",
palevioletred: "db7093",
papayawhip: "ffefd5",
peachpuff: "ffdab9",
peru: "cd853f",
pink: "ffc0cb",
plum: "dda0dd",
powderblue: "b0e0e6",
purple: "800080",
rebeccapurple: "663399",
red: "f00",
rosybrown: "bc8f8f",
royalblue: "4169e1",
saddlebrown: "8b4513",
salmon: "fa8072",
sandybrown: "f4a460",
seagreen: "2e8b57",
seashell: "fff5ee",
sienna: "a0522d",
silver: "c0c0c0",
skyblue: "87ceeb",
slateblue: "6a5acd",
slategray: "708090",
slategrey: "708090",
snow: "fffafa",
springgreen: "00ff7f",
steelblue: "4682b4",
tan: "d2b48c",
teal: "008080",
thistle: "d8bfd8",
tomato: "ff6347",
turquoise: "40e0d0",
violet: "ee82ee",
wheat: "f5deb3",
white: "fff",
whitesmoke: "f5f5f5",
yellow: "ff0",
yellowgreen: "9acd32"
};
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
var sColor = sColor.toLowerCase();
//
if (sColor.slice(0, 1) != "#") {
for (var name in names) {
if (name == sColor) {
var sColor = "#" + names[name];
}
}
}; {
if (sColor && reg.test(sColor)) {
if (sColor.length === 4) {
var sColorNew = "#";
for (var i = 1; i < 4; i += 1) {
sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
}
sColor = sColorNew;
}
//6
var sColorChange = [];
for (var i = 1; i < 7; i += 2) {
sColorChange.push(parseInt("0x" + sColor.slice(i, i + 2)));
}
return sColorChange;
} else {
return sColor;
}
}
},
// rgbhex
colorToHex(rgb) {
var _this = rgb;
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
if (/^(rgb|RGB)/.test(_this)) {
var aColor = _this.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
var strHex = "#";
for (var i = 0; i < aColor.length; i++) {
var hex = Number(aColor[i]).toString(16);
hex = hex < 10 ? 0 + '' + hex : hex; // rgb2
if (hex === "0") {
hex += hex;
}
strHex += hex;
}
if (strHex.length !== 7) {
strHex = _this;
}
return strHex;
} else if (reg.test(_this)) {
var aNum = _this.replace(/#/, "").split("");
if (aNum.length === 6) {
return _this;
} else if (aNum.length === 3) {
var numHex = "#";
for (var i = 0; i < aNum.length; i += 1) {
numHex += (aNum[i] + aNum[i]);
}
return numHex;
}
} else {
return _this;
}
},
},
}
</script>
<style lang="scss" scoped="">
//
.canvas-box {
margin-left: 500upx;
width: 0;
height: 0;
overflow: hidden
}
// template
.gallerypanel {
.scroll-view {
.scroll-view-panle {
display: flex;
height: 100%;
width: 100%;
white-space: nowrap;
.leftview {
//
}
.imgviewpanel {
.角标 {}
.imgview {
.图片 {}
}
.描述 {
.文本 {}
}
}
.rightview {
//
}
}
}
}
// hbx1.8 main.wsxx
// .gallerypanel ::-webkit-scrollbar {display: none;}
// .scroll-view ::-webkit-scrollbar {
// display: none;
// }
.roundbadge {
z-index: 2;
display: flex;
align-self: flex-end;
align-items: center;
justify-content: center;
font-size: 12px;
color: white;
border-radius: 8px;
min-width: 12px;
min-height: 12px;
max-height: 12px;
padding: 3px 5px;
margin-bottom: -17px; //17=12+5 12 5
margin-right: 3px; //5px 3
}
* {
-webkit-overflow-scrolling: touch;
}
//
@keyframes living {
0% {
// transform-origin:'center bottom';
transform: scale(1);
opacity: 1;
}
50% {
// transform-origin:'center bottom';
transform: scale(1.05);
opacity: 1;
/*圆形放大的同时透明度逐渐减小为0*/
}
100% {
// transform-origin:'center bottom';
transform: scale(1);
opacity: 1;
}
}
.trans-fadeout {
// -webkit-transition:all 0.2s linear;
// -moz-transition:all 0.2s linear;
// -ms-transition:all 0.2s linear;
// -o-transition:all 0.2s linear;
animation: living 1s ease-in-out 1;
}
</style>

View File

@ -0,0 +1,219 @@
<template>
<view class="content" :style="{'--padding':index == 0?'56rpx':'20rpx'}">
<image v-if="index == 0" class="First-Img" src="https://img.agrimedia.cn/chwl/v2/20220909-164805.png" mode="">
</image>
<view class="shop-box" @click="goShop">
<view class="flex flex-space-between">
<view class="flex">
<view class="">
<u-image :src="goodsInfo.store_img" radius="10rpx" width="200rpx" height="200rpx"></u-image>
</view>
<view v-if="dataType == 0" class="" style="margin-left: 20rpx;">
<u-text size="30rpx" :bold="true" :text="goodsInfo.store_name" :lines="1"></u-text>
<u-text size="22rpx" color="#999"
:text="(goodsInfo.goods_sales == null?0:goodsInfo.goods_sales) + '销量'"></u-text>
<view class="">
<u-gap height="20rpx"></u-gap>
<view class="flex" v-for="(item1,index1) in goodsInfo.goods" :key="index1">
<view class="">
<u-text lineHeight="40rpx" :bold="true" size="30rpx" color="#FF4D03"
:text="'¥'+item1.price/100"></u-text>
</view>
<view class="" style="margin: 10rpx;">
<u-text lineHeight="40rpx" decoration="line-through" size="22rpx" color="#999"
:text="'¥'+item1.originalPrice/100"></u-text>
</view>
<view class="">
<u-text lineHeight="40rpx" lines="1" size="30rpx" :text="item1.goodsTitle"></u-text>
</view>
</view>
</view>
<!-- <view class="">
<text class="check-shop" @click="goShop">查看店铺</text>
</view> -->
</view>
<view v-if="dataType == 1" class="" style="margin-left: 20rpx;">
<u-text size="30rpx" :bold="true" :text="goodsInfo.goodsTitle" :lines="1"></u-text>
<u-gap height="10rpx"></u-gap>
<view v-if="active == 0" class="flex flex-space-between">
<view class="" style="width: 100%;">
<!-- <u-line-progress height="18rpx" activeColor="#F14E10" inactiveColor="#FE8D3D" :percentage="70" :showText="true">
</u-line-progress> -->
<u-gap height="10rpx"></u-gap>
<progress backgroundColor="#FE8D3D" activeColor="#F14E10"
:percent="goodsInfo.sales_num/goodsInfo.num" border-radius="40rpx" font-size="20rpx"
active stroke-width="3" />
</view>
<view class="flex" style="width: 180rpx;">
<view class="">
<u-text size="20rpx" text="已抢%"></u-text>
</view>
<u-count-to fontSize="20rpx" :startVal="0" :endVal="goodsInfo.sales_num/goodsInfo.num">
</u-count-to>
</view>
</view>
<view v-else class="flex flex-space-between">
<u-gap height="26rpx"></u-gap>
</view>
<!-- <u-line-progress height="18rpx" activeColor="#F14E10" inactiveColor="#FE8D3D" :percentage="20" :showText="true">
<view class="" solt="default" style="font-size: 18rpx;line-height: 18rpx;">
已抢20%
</view>
</u-line-progress> -->
<u-text size="22rpx" lines="1" color="#999" :text="goodsInfo.address"></u-text>
<u-gap height="10"></u-gap>
<view class="">
<view class="flex">
<view class="">
<u-text lineHeight="40rpx" color="#FE2825" size="30rpx" text="秒杀价"></u-text>
</view>
<view class="">
<u-text lineHeight="40rpx" :bold="true" size="36rpx" color="#FF4D03"
:text="'¥'+goodsInfo.seckill_price/100"></u-text>
</view>
</view>
</view>
<view class="">
<u-text lineHeight="40rpx" size="24rpx" color="#666666" :text="'即将恢复¥'+goodsInfo.price/100"></u-text>
</view>
</view>
</view>
<view v-if="dataType == 0">
<u-text align="center" size="22rpx" color="#999" :text="goodsInfo.distance + 'km'"></u-text>
</view>
<view v-if="dataType== 1" class="" style="min-width: 130rpx;">
<u-gap height="44rpx"></u-gap>
<u-text align="center" size="22rpx" color="#999"
:text="active==0?'已抢'+ goodsInfo.sales_num +'件':' '"></u-text>
<u-text align="center" size="22rpx" color="#999"
:text="(goodsInfo.distance > 999?'999+':goodsInfo.distance)+'km'"></u-text>
<u-gap height="60rpx"></u-gap>
<view style="text-align: center;">
<text @click.stop="goGoodsinfo(goodsInfo.goods_id)" v-if="active == 0"
style="margin: 0 auto;color:#ffffff;text-align: center;padding: 0 20rpx;border-radius: 20rpx;font-size: 24rpx;background-color: #FF7B2D;">抢购</text>
<view class="begin" v-else>
<image class="begin_image" src="../../static/image/begin.png"></image>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: "goods-item",
props: {
index: {
type: Number,
default: 0
},
dataType: {
type: Number,
default: 0
},
active: {
type: Number,
default: 0
},
goodsInfo: {
type: Object,
default: {
store_img: '',
store_name: '',
goods_sales: 0,
goods: [],
goodsTitle: '',
sales_num: 0,
num: 0,
address: '',
seckill_price: 0,
price: 0,
distance: '',
goods_id: 0
}
}
},
data() {
return {
};
},
methods: {
goGoodsinfo(item_id) {
uni.navigateTo({
url: '../../pages/goodsInfo/goodsInfo?goods_id=' + item_id
})
},
goShop() {
uni.navigateTo({
url: '/pages/shop/shop?store_id=' + this.goodsInfo.store_id
})
}
}
}
</script>
<style lang="scss">
.check-shop {
background-color: #FF4D02;
color: #FFFFFF;
font-size: 24rpx;
padding: 4rpx 20rpx;
border-radius: 20rpx;
}
.content {
background-color: #ffffff;
border-radius: 20rpx;
padding: var(--padding) 20rpx 20rpx 20rpx;
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
margin-bottom: 20rpx;
position: relative;
}
.First-Img {
width: 322rpx;
height: 86rpx;
position: absolute;
top: -30rpx;
left: 50%;
transform: translateX(-50%);
&::after {
content: '';
position: absolute;
right: 0;
top: 8rpx;
width: 0;
height: 0;
border-left: 28rpx solid transparent;
border-right: 10rpx solid transparent;
border-bottom: 21rpx solid #DD6409;
z-index: -1;
}
&::before {
content: '';
position: absolute;
left: 0;
top: 8rpx;
width: 0;
height: 0;
border-left: 12rpx solid transparent;
border-right: 10rpx solid transparent;
border-bottom: 21rpx solid #DD6409;
z-index: -1;
}
}
.begin_image {
width: 184rpx;
height: 54rpx;
}
</style>

37
components/jb30/jb30.vue Normal file
View File

@ -0,0 +1,37 @@
<template>
<view>
<view class="jianbian">
<view v-if="showRadius" class="mt-30 yj-box"></view>
</view>
</view>
</template>
<script>
export default {
name:"jb30",
props:{
showRadius:{
type:Boolean,
default:true
}
},
data() {
return {
};
}
}
</script>
<style>
.jianbian{
height: 30rpx;
background: linear-gradient(#FE8D3D, #ffffff);
}
.yj-box{
height: 30rpx;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
background-color: #FFFFFF;
}
</style>

View File

@ -0,0 +1,301 @@
<template>
<u-popup :show="show" overlayOpacity="0" :overlay="false" @close="close" @open="open">
<view class="keyboardbox">
<view class="numkeyboard" v-if="type===1">
<view class="num-area">
<view class="row" v-for="(item,index) in numKeybordList" :key="index">
<view :class="['item',ite===0?'z':'',(disableDot && ite==='.')?'disabled':'']" v-for="(ite,idx) in item"
hover-class="active" :hover-start-time="0" :hover-stay-time="5" :key="idx" @tap="input(ite)">{{ite}}</view>
</view>
</view>
<view class="btn-area">
<view :class="['item','del']" hover-class="active" :hover-start-time="0" :hover-stay-time="5" @tap="deleteVal">
删除
</view>
<view class="confirem item" hover-class="active" :hover-start-time="0" :hover-stay-time="5" @tap="confirm">
确定
</view>
</view>
</view>
<view class="numkeyboard" v-if="type===2">
<view class="num-area">
<view class="row" v-for="(item,index) in idCardList" :key="index">
<view :class="['item',ite===0?'z':'',(disableDot && ite==='.')?'disabled':'']" v-for="(ite,idx) in item"
hover-class="active" :hover-start-time="0" :hover-stay-time="5" :key="idx" @tap="input(ite)">{{ite}}</view>
</view>
</view>
<view class="btn-area">
<view :class="['item','del']" hover-class="active" :hover-start-time="0" :hover-stay-time="5" @tap="deleteVal">
删除
</view>
<view class="confirem item" hover-class="active" :hover-start-time="0" :hover-stay-time="5" @tap="confirm">
确定
</view>
</view>
</view>
<view class="platenumber" v-if="type===3">
<view class="header">
<view @tap="active=active===1?2:1" hover-class="active" :hover-start-time="0" :hover-stay-time="5">{{active===1?'地区':'车牌号'}}</view>
<view hover-class="active" :hover-start-time="0" :hover-stay-time="5" @tap="confirm">完成</view>
</view>
<view class="main">
<view class="normal" v-if="active===1">
<view class="row" v-for="(item,index) in EngKeyBoardList" :key="index">
<view class="item" v-for="(ite,idx) in item" :key="idx" hover-class="active" :hover-start-time="0" :hover-stay-time="5" @tap="input(ite)">
{{ite}}
</view>
<view class="item img" v-if="index===EngKeyBoardList.length-1" hover-class="active" :hover-start-time="0" :hover-stay-time="5" @tap="deleteVal">
<image src="/static/delete.png" mode=""></image>
</view>
</view>
</view>
<view class="area" v-if="active===2">
<view class="row" v-for="(item,index) in areaList" :key="index">
<view class="item" v-for="(ite,idx) in item" :key="idx" hover-class="active" :hover-start-time="0" :hover-stay-time="5" @tap="input(ite)">
{{ite}}
</view>
<view class="item img" v-if="index===EngKeyBoardList.length-1" hover-class="active" :hover-start-time="0" :hover-stay-time="5" @tap="deleteVal">
<image src="/static/delete.png" mode=""></image>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="safe-area" v-if="safeAreaInsetBottom"></view>
</u-popup>
</template>
<script>
export default {
props: {
type: {
type: Number, // 1- 2- -
default: 1
},
safeAreaInsetBottom: { //
type: Boolean,
default: true
},
disableDot: { //.typenumber
type: Boolean,
default: false
},
show: { //.typenumber
type: Boolean,
default: false
},
timer:null
},
data() {
return {
numKeybordList: [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
[0, '.']
],
idCardList: [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
[0, 'X']
],
areaList: [
['京', '沪', '粤', '津', '冀', '豫', '云', '辽', '黑', '湘'],
['皖', '鲁', '苏', '浙', '赣', '鄂', '桂', '甘', '晋', '陕'],
['蒙', '吉', '闽', '贵', '渝', '川', '青', '琼', '宁'],
['藏', '新', '使', '港', '澳', '学']
],
EngKeyBoardList: [
[1, 2, 3, 4, 5, 6, 7, 8, 9, 0],
['Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P'],
['A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L'],
['Z', 'X', 'C', 'V', 'B', 'N', 'M']
],
active: 1
};
},
methods: {
open() {
this.$emit('open')
},
confirm() {
this.close();
this.$emit('onConfirm');
},
deleteVal() {
this.$emit('onDelete');
this.input('')
},
input(val) {
if (val === '.' && this.disableDot) return;
this.$emit('input', val);
},
close() {
this.$emit('closeTable')
}
}
}
</script>
<style lang="scss" scoped>
.keyboardbox {
background-color: #FFFFFF;
.numkeyboard {
height: 432rpx;
display: flex;
background-color: #ebedf0;
.btn-area {
width: 180rpx;
height: 100%;
display: flex;
flex-direction: column;
.item {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
flex-grow: 1;
}
.del {
background-color: #ebedf0;
color: #333;
&.active {
background-color: #f1f3f5;
}
}
.confirem {
background-color: #1989fa;
color: #FFFFFF;
&.active {
background-color: #0570db;
}
}
}
.num-area {
flex-grow: 1;
display: flex;
flex-wrap: wrap;
.row {
width: 100%;
height: 25%;
display: flex;
margin-top: 1px;
.item {
flex-grow: 1;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background-color: #FFFFFF;
border-right: 1px solid #ebedf0;
width: 33.33%;
&.active {
background-color: #ebedf0;
}
&.z {
flex-grow: 2;
width: 66.66%;
}
&.disabled {
background: #FFFFFF;
color: #B9B9B9;
}
}
}
}
}
}
.safe-area {
padding-bottom: 0rpx;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.platenumber {
background-color: #f5f5f5;
.header {
height: 76rpx;
background-color: #FFFFFF;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 28rpx;
border-top: 1px solid #f5f5f5;
&>view {
padding: 0 45rpx;
color: #00a7ea;
height: 100%;
display: flex;
align-items: center;
&.active {
background-color: #ebedf0;
}
}
}
.main {
height: 435rpx;
.row {
margin: 13rpx 0;
display: flex;
justify-content: center;
align-items: center;
.item {
width: 56rpx;
height: 94rpx;
display: flex;
justify-content: center;
align-items: center;
background-color: #FFFFFF;
border-radius: 6rpx;
margin: 0 7rpx;
font-size: 24rpx;
&.active {
background-color: #ebedf0;
}
&.img {
background-color: #c2cacc;
width: 94rpx;
&.active {
background-color: #ddd;
}
&>image {
width: 49rpx;
height: 48rpx;
}
}
}
}
}
}
</style>

View File

@ -0,0 +1,187 @@
<template>
<view v-if="showPopup" class="uni-popup">
<view :class="[ani, animation ? 'ani' : '', !custom ? 'uni-custom' : '']" class="uni-popup__mask" @click="close(true)" />
<view :class="[type, ani, animation ? 'ani' : '', !custom ? 'uni-custom' : '']" class="uni-popup__wrapper" @click="close(true)">
<view class="uni-popup__wrapper-box" @click.stop="clear">
<slot />
</view>
</view>
</view>
</template>
<script>
export default {
name: 'UniPopup',
props: {
//
animation: {
type: Boolean,
default: true
},
// top: bottomcenter
type: {
type: String,
default: 'center'
},
//
custom: {
type: Boolean,
default: false
},
// maskClick
maskClick: {
type: Boolean,
default: true
},
show: {
type: Boolean,
default: true
}
},
data() {
return {
ani: '',
showPopup: false
}
},
watch: {
show(newValue) {
if (newValue) {
this.open()
} else {
this.close()
}
}
},
created() {},
methods: {
clear() {},
open() {
this.$emit('change', {
show: true
})
this.showPopup = true
this.$nextTick(() => {
setTimeout(() => {
this.ani = 'uni-' + this.type
}, 30)
})
},
close(type) {
if (!this.maskClick && type) return
this.$emit('change', {
show: false
})
this.ani = ''
this.$nextTick(() => {
setTimeout(() => {
this.showPopup = false
}, 300)
})
}
}
}
</script>
<style>
@charset "UTF-8";
.uni-popup {
position: fixed;
top: 0;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 99999;
overflow: hidden
}
.uni-popup__mask {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 998;
/* background: rgba(0, 0, 0, .4); */
opacity: 0
}
.uni-popup__mask.ani {
transition: all .3s
}
.uni-popup__mask.uni-bottom,
.uni-popup__mask.uni-center,
.uni-popup__mask.uni-top {
opacity: 1
}
.uni-popup__wrapper {
position: absolute;
z-index: 999;
box-sizing: border-box
}
.uni-popup__wrapper.ani {
transition: all .3s
}
.uni-popup__wrapper.top {
top: 0;
left: 0;
width: 100%;
transform: translateY(-100%)
}
.uni-popup__wrapper.bottom {
bottom: 0;
left: 0;
width: 100%;
transform: translateY(100%)
}
.uni-popup__wrapper.center {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
transform: scale(1.2);
opacity: 0
}
.uni-popup__wrapper-box {
position: relative;
box-sizing: border-box
}
.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
padding: 30upx;
background: #fff
}
.uni-popup__wrapper.uni-custom.center .uni-popup__wrapper-box {
position: relative;
max-width: 80%;
max-height: 80%;
overflow-y: scroll
}
.uni-popup__wrapper.uni-custom.bottom .uni-popup__wrapper-box,
.uni-popup__wrapper.uni-custom.top .uni-popup__wrapper-box {
width: 100%;
max-height: 500px;
overflow-y: scroll
}
.uni-popup__wrapper.uni-bottom,
.uni-popup__wrapper.uni-top {
transform: translateY(0)
}
.uni-popup__wrapper.uni-center {
transform: scale(1);
opacity: 1
}
</style>

View File

@ -0,0 +1,227 @@
> 插件来源:[https://ext.dcloud.net.cn/plugin?id=3594](https://ext.dcloud.net.cn/plugin?id=3594)
##### 以下是作者写的插件介绍:
# Clipper 图片裁剪
> uniapp 图片裁剪,可用于图片头像等裁剪处理
> [查看更多](http://liangei.gitee.io/limeui/#/clipper) <br>
> Q群458377637
## 平台兼容
| H5 | 微信小程序 | 支付宝小程序 | 百度小程序 | 头条小程序 | QQ 小程序 | App |
| --- | ---------- | ------------ | ---------- | ---------- | --------- | --- |
| √ | √ | √ | 未测 | √ | √ | √ |
## 代码演示
### 基本用法
`@success` 事件点击 👉 **确定** 后会返回生成的图片信息,包含 `url`、`width`、`height`
```html
<image :src="url" v-if="url" mode="widthFix"></image>
<l-clipper v-if="show" @success="url = $event.url; show = false" @cancel="show = false" ></l-clipper>
<button @tap="show = true">裁剪</button>
```
```js
// 非uni_modules引入
import lClipper from '@/components/lime-clipper/'
// uni_modules引入
import lClipper from '@/uni_modules/lime-clipper/components/lime-clipper/'
export default {
components: {lClipper},
data() {
return {
show: false,
url: '',
}
}
}
```
### 传入图片
`image-url`可传入**相对路径**、**临时路径**、**本地路径**、**网络图片**<br>
* **当为网络地址时**
* H5👉 需要解决跨域问题。 <br>
* 小程序:👉 需要配置 downloadFile 域名 <br>
```html
<image :src="url" v-if="url" mode="widthFix"></image>
<l-clipper v-if="show" :image-url="imageUrl" @success="url = $event.url; show = false" @cancel="show = false" ></l-clipper>
<button @tap="show = true">裁剪</button>
```
```js
export default {
components: {lClipper},
data() {
return {
imageUrl: 'https://img12.360buyimg.com/pop/s1180x940_jfs/t1/97205/26/1142/87801/5dbac55aEf795d962/48a4d7a63ff80b8b.jpg',
show: false,
url: '',
}
}
}
```
### 确定按钮颜色
样式变量名:`--l-clipper-confirm-color`
可放到全局样式的 `page` 里或节点的 `style`
```html
<l-clipper class="clipper" style="--l-clipper-confirm-color: linear-gradient(to right, #ff6034, #ee0a24)" ></l-clipper>
```
```css
// css 中为组件设置 CSS 变量
.clipper {
--l-clipper-confirm-color: linear-gradient(to right, #ff6034, #ee0a24)
}
// 全局
page {
--l-clipper-confirm-color: linear-gradient(to right, #ff6034, #ee0a24)
}
```
### 使用插槽
共五个插槽 `cancel` 取消按钮、 `photo` 选择图片按钮、 `rotate` 旋转按钮、 `confirm` 确定按钮和默认插槽。
```html
<image :src="url" v-if="url" mode="widthFix"></image>
<l-clipper
v-if="show"
:isLockWidth="isLockWidth"
:isLockHeight="isLockHeight"
:isLockRatio="isLockRatio"
:isLimitMove="isLimitMove"
:isDisableScale="isDisableScale"
:isDisableRotate="isDisableRotate"
:isShowCancelBtn="isShowCancelBtn"
:isShowPhotoBtn="isShowPhotoBtn"
:isShowRotateBtn="isShowRotateBtn"
:isShowConfirmBtn="isShowConfirmBtn"
@success="url = $event.url; show = false"
@cancel="show = false" >
<!-- 四个基本按钮插槽 -->
<view slot="cancel">取消</view>
<view slot="photo">选择图片</view>
<view slot="rotate">旋转</view>
<view slot="confirm">确定</view>
<!-- 默认插槽 -->
<view class="tools">
<view>显示取消按钮
<switch :checked="isShowCancelBtn" @change="isShowCancelBtn = $event.target.value" ></switch>
</view>
<view>显示选择图片按钮
<switch :checked="isShowPhotoBtn" @change="isShowPhotoBtn = $event.target.value" ></switch>
</view>
<view>显示旋转按钮
<switch :checked="isShowRotateBtn" @change="isShowRotateBtn = $event.target.value" ></switch>
</view>
<view>显示确定按钮
<switch :checked="isShowConfirmBtn" @change="isShowConfirmBtn = $event.target.value" ></switch>
</view>
<view>锁定裁剪框宽度
<switch :checked="isLockWidth" @change="isLockWidth = $event.target.value" ></switch>
</view>
<view>锁定裁剪框高度
<switch :checked="isLockHeight" @change="isLockHeight = $event.target.value" ></switch>
</view>
<view>锁定裁剪框比例
<switch :checked="isLockRatio" @change="isLockRatio = $event.target.value" ></switch>
</view>
<view>限制移动范围
<switch :checked="isLimitMove" @change="isLimitMove = $event.target.value" ></switch>
</view>
<view>禁止缩放
<switch :checked="isDisableScale" @change="isDisableScale = $event.target.value" ></switch>
</view>
<view>禁止旋转
<switch :checked="isDisableRotate" @change="isDisableRotate = $event.target.value" ></switch>
</view>
</view>
</l-clipper>
<button @tap="show = true">裁剪</button>
```
```js
export default {
components: {lClipper},
data() {
return {
show: false,
url: '',
isLockWidth: false,
isLockHeight: false,
isLockRatio: true,
isLimitMove: false,
isDisableScale: false,
isDisableRotate: false,
isShowCancelBtn: true,
isShowPhotoBtn: true,
isShowRotateBtn: true,
isShowConfirmBtn: true
}
}
}
```
## API
### Props
| 参数 | 说明 | 类型 | 默认值 |
| ------------- | ------------ | ---------------- | ------------ |
| image-url | 图片路径 | <em>string</em> | |
| quality | 图片的质量,取值范围为 [0, 1]不在范围内时当作1处理 | <em>number</em> | `1` |
| source | `{album: '从相册中选择'}`key为图片来源类型value为选项说明 | <em>Object</em> | |
| width | 裁剪框宽度,单位为 `rpx` | <em>number</em> | `400` |
| height | 裁剪框高度 | <em>number</em> | `400` |
| min-width | 裁剪框最小宽度 | <em>number</em> | `200` |
| min-height |裁剪框最小高度 | <em>number</em> | `200` |
| max-width | 裁剪框最大宽度 | <em>number</em> | `600` |
| max-height | 裁剪框最大宽度 | <em>number</em> | `600` |
| min-ratio | 图片最小缩放比 | <em>number</em> | `0.5` |
| max-ratio | 图片最大缩放比 | <em>number</em> | `2` |
| rotate-angle | 旋转按钮每次旋转的角度 | <em>number</em> | `90` |
| scale-ratio | 生成图片相对于裁剪框的比例, **比例越高生成图片越清晰** | <em>number</em> | `1` |
| is-lock-width | 是否锁定裁剪框宽度 | <em>boolean</em> | `false` |
| is-lock-height | 是否锁定裁剪框高度上 | <em>boolean</em> | `false` |
| is-lock-ratio | 是否锁定裁剪框比例 | <em>boolean</em> | `true` |
| is-disable-scale | 是否禁止缩放 | <em>boolean</em> | `false` |
| is-disable-rotate | 是否禁止旋转 | <em>boolean</em> | `false` |
| is-limit-move | 是否限制移动范围 | <em>boolean</em> | `false` |
| is-show-photo-btn | 是否显示选择图片按钮 | <em>boolean</em> | `true` |
| is-show-rotate-btn | 是否显示转按钮 | <em>boolean</em> | `true` |
| is-show-confirm-btn | 是否显示确定按钮 | <em>boolean</em> | `true` |
| is-show-cancel-btn | 是否显示关闭按钮 | <em>boolean</em> | `true` |
### 事件 Events
| 事件名 | 说明 | 回调 |
| ------- | ------------ | -------------- |
| success | 生成图片成功 | {`width`, `height`, `url`} |
| fail | 生成图片失败 | `error` |
| cancel | 关闭 | `false` |
| ready | 图片加载完成 | {`width`, `height`, `path`, `orientation`, `type`} |
| change | 图片大小改变时触发 | {`width`, `height`} |
| rotate | 图片旋转时触发 | `angle` |
## 常见问题
> 1、H5端使用网络图片需要解决跨域问题。<br>
> 2、小程序使用网络图片需要去公众平台增加下载白名单二级域名也需要配<br>
> 3、H5端生成图片是base64有时显示只有一半可以使用原生标签`<IMG/>`<br>
> 4、IOS APP 请勿使用HBX2.9.3.20201014的版本!这个版本无法生成图片。<br>
> 5、APP端无成功反馈、也无失败反馈时请更新基座和HBX。<br>
## 打赏
如果你觉得本插件,解决了你的问题,赠人玫瑰,手留余香。<br>
![输入图片说明](https://images.gitee.com/uploads/images/2020/1122/222521_bb543f96_518581.jpeg "微信图片编辑_20201122220352.jpg")

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve">
<style type="text/css">
.st0{fill:#606060;}
.st1{fill:none;stroke:#FFFFFF;stroke-width:2.4306;stroke-miterlimit:10;}
.st2{fill:#FFFFFF;}
</style>
<g>
<path class="st2" d="M11.6,11c0.4,0.4,0.6,0.9,0.6,1.5c0,0.6-0.2,1.1-0.6,1.4c-0.4,0.4-0.9,0.6-1.5,0.6c-0.6,0-1.1-0.2-1.5-0.6
c-0.4-0.4-0.6-0.9-0.6-1.4s0.2-1.1,0.6-1.5c0.4-0.4,0.9-0.6,1.5-0.6C10.8,10.4,11.2,10.6,11.6,11z M24.6,18.4V6.7H5.4v12l1.8-1.8
c0.3-0.3,0.6-0.4,1-0.4c0.4,0,0.7,0.1,1,0.4l1.8,1.8l5.8-7c0.3-0.3,0.6-0.5,1.1-0.5c0.4,0,0.8,0.2,1.1,0.5
C18.8,11.6,24.6,18.4,24.6,18.4z M25.6,5.7C25.9,6,26,6.3,26,6.7v16.1c0,0.4-0.1,0.7-0.4,1c-0.3,0.3-0.6,0.4-1,0.4H5.4
c-0.4,0-0.7-0.1-1-0.4c-0.3-0.3-0.4-0.6-0.4-1V6.7c0-0.4,0.1-0.7,0.4-1c0.3-0.3,0.6-0.4,1-0.4h19.3C25,5.3,25.3,5.4,25.6,5.7z"/>
<path class="st1" d="M24.3,21.5H5.7c-0.2,0-0.3-0.2-0.3-0.3V7c0-0.2,0.2-0.3,0.3-0.3h18.6c0.2,0,0.3,0.2,0.3,0.3v14.2
C24.6,21.3,24.5,21.5,24.3,21.5z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="30px" height="30px" viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;stroke:#FFFFFF;stroke-width:2.4306;stroke-miterlimit:10;}
.st1{fill:#FFFFFF;}
</style>
<g>
<path class="st0" d="M17.1,24.2h-12c-0.2,0-0.3-0.2-0.3-0.3v-9.3c0-0.2,0.2-0.3,0.3-0.3h12c0.2,0,0.3,0.2,0.3,0.3v9.3
C17.5,24.1,17.3,24.2,17.1,24.2z"/>
<path class="st0" d="M16.6,5.4c4.8,0,8.7,3.9,8.7,8.7"/>
<polyline class="st0" points="19.3,10.1 14.9,5.6 19.3,1.2 "/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 806 B

View File

@ -0,0 +1,160 @@
.flex-auto {
flex: auto;
}
.bg-transparent {
background-color: rgba(0,0,0,0.9);
transition-duration: 0.35s;
}
.l-clipper {
width: 100vw;
height: calc(100vh - var(--window-top));
background-color: rgba(0,0,0,0.9);
position: fixed;
top: var(--window-top);
left: 0;
z-index: 1;
}
.l-clipper-mask {
position: relative;
z-index: 2;
pointer-events: none;
}
.l-clipper__content {
pointer-events: none;
position: absolute;
border: 1rpx solid rgba(255,255,255,0.3);
box-sizing: border-box;
box-shadow: rgba(0,0,0,0.5) 0 0 0 80vh;
background: transparent;
}
.l-clipper__content::before,
.l-clipper__content::after {
content: '';
position: absolute;
border: 1rpx dashed rgba(255,255,255,0.3);
}
.l-clipper__content::before {
width: 100%;
top: 33.33%;
height: 33.33%;
border-left: none;
border-right: none;
}
.l-clipper__content::after {
width: 33.33%;
left: 33.33%;
height: 100%;
border-top: none;
border-bottom: none;
}
.l-clipper__edge {
position: absolute;
width: 34rpx;
height: 34rpx;
border: 6rpx solid #fff;
pointer-events: auto;
}
.l-clipper__edge::before {
content: '';
position: absolute;
width: 40rpx;
height: 40rpx;
background-color: transparent;
}
.l-clipper__edge:nth-child(1) {
left: -6rpx;
top: -6rpx;
border-bottom-width: 0 !important;
border-right-width: 0 !important;
}
.l-clipper__edge:nth-child(1):before {
top: -50%;
left: -50%;
}
.l-clipper__edge:nth-child(2) {
right: -6rpx;
top: -6rpx;
border-bottom-width: 0 !important;
border-left-width: 0 !important;
}
.l-clipper__edge:nth-child(2):before {
top: -50%;
left: 50%;
}
.l-clipper__edge:nth-child(3) {
left: -6rpx;
bottom: -6rpx;
border-top-width: 0 !important;
border-right-width: 0 !important;
}
.l-clipper__edge:nth-child(3):before {
bottom: -50%;
left: -50%;
}
.l-clipper__edge:nth-child(4) {
right: -6rpx;
bottom: -6rpx;
border-top-width: 0 !important;
border-left-width: 0 !important;
}
.l-clipper__edge:nth-child(4):before {
bottom: -50%;
left: 50%;
}
.l-clipper-image {
width: 100%;
border-style: none;
position: absolute;
top: 0;
left: 0;
z-index: 1;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
transform-origin: center;
}
.l-clipper-canvas {
position: fixed;
z-index: 10;
left: -200vw;
top: -200vw;
pointer-events: none;
}
.l-clipper-tools {
position: fixed;
left: 0;
bottom: 10px;
width: 100%;
z-index: 99;
color: #fff;
}
.l-clipper-tools__btns {
font-weight: bold;
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
padding: 20rpx 40rpx;
box-sizing: border-box;
}
.l-clipper-tools__btns .cancel {
width: 112rpx;
height: 60rpx;
text-align: center;
line-height: 60rpx;
}
.l-clipper-tools__btns .confirm {
width: 112rpx;
height: 60rpx;
line-height: 60rpx;
background-color: #07c160;
border-radius: 6rpx;
text-align: center;
}
.l-clipper-tools__btns image {
display: block;
width: 60rpx;
height: 60rpx;
}
.l-clipper-tools__btns {
flex-direction: row;
}

View File

@ -0,0 +1,817 @@
<template>
<view class="l-clipper" :class="{open: value}" disable-scroll :style="'z-index: ' + zIndex + ';' + customStyle">
<view class="l-clipper-mask" @touchstart.stop.prevent="clipTouchStart" @touchmove.stop.prevent="clipTouchMove" @touchend.stop.prevent="clipTouchEnd">
<view class="l-clipper__content" :style="clipStyle"><view class="l-clipper__edge" v-for="(item, index) in [0, 0, 0, 0]" :key="index"></view></view>
</view>
<image
class="l-clipper-image"
@error="imageLoad"
@load="imageLoad"
@touchstart.stop.prevent="imageTouchStart"
@touchmove.stop.prevent="imageTouchMove"
@touchend.stop.prevent="imageTouchEnd"
:src="image"
:mode="imageWidth == 'auto' ? 'widthFix' : ''"
v-if="image"
:style="imageStyle"
/>
<canvas
:canvas-id="canvasId"
id="l-clipper"
disable-scroll
:style="'width: ' + canvasWidth * scaleRatio + 'px; height:' + canvasHeight * scaleRatio + 'px;'"
class="l-clipper-canvas"
></canvas>
<view class="l-clipper-tools">
<view class="l-clipper-tools__btns">
<view v-if="isShowCancelBtn" @tap="cancel">
<slot name="cancel" v-if="$slots.cancel" />
<view v-else class="cancel">取消</view>
</view>
<view v-if="isShowPhotoBtn" @tap="uploadImage">
<slot name="photo" v-if="$slots.photo" />
<image v-else src="@/static/limeClipper/photo.svg" />
</view>
<view v-if="isShowRotateBtn" @tap="rotate">
<slot name="rotate" v-if="$slots.rotate" />
<image v-else src="@/static/limeClipper/rotate.svg" data-type="inverse" />
</view>
<view v-if="isShowConfirmBtn" @tap="confirm">
<slot name="confirm" v-if="$slots.confirm" />
<view v-else class="confirm">确定</view>
</view>
</view>
<slot></slot>
</view>
</view>
</template>
<script>
import { determineDirection, calcImageOffset, calcImageScale, calcImageSize, calcPythagoreanTheorem, clipTouchMoveOfCalculate, imageTouchMoveOfCalcOffset } from './utils';
const cache = {}
export default {
// version: '0.6.3',
name: 'l-clipper',
props: {
value: {
type: Boolean,
default: true
},
// #ifdef MP-WEIXIN
type: {
type: String,
default: '2d'
},
// #endif
customStyle: {
type: String,
},
canvasId: {
type: String,
default: 'l-clipper'
},
zIndex: {
type: Number,
default: 99
},
imageUrl: {
type: String
},
fileType: {
type: String,
default: 'png'
},
quality: {
type: Number,
default: 1
},
width: {
type: Number,
default: 400
},
height: {
type: Number,
default: 400
},
minWidth: {
type: Number,
default: 200
},
maxWidth: {
type: Number,
default: 600
},
minHeight: {
type: Number,
default: 200
},
maxHeight: {
type: Number,
default: 600
},
isLockWidth: {
type: Boolean,
default: false
},
isLockHeight: {
type: Boolean,
default: false
},
isLockRatio: {
type: Boolean,
default: true
},
scaleRatio: {
type: Number,
default: 1
},
minRatio: {
type: Number,
default: 0.5
},
maxRatio: {
type: Number,
default: 2
},
isDisableScale: {
type: Boolean,
default: false
},
isDisableRotate: {
type: Boolean,
default: false
},
isLimitMove: {
type: Boolean,
default: false
},
isShowPhotoBtn: {
type: Boolean,
default: true
},
isShowRotateBtn: {
type: Boolean,
default: true
},
isShowConfirmBtn: {
type: Boolean,
default: true
},
isShowCancelBtn: {
type: Boolean,
default: true
},
rotateAngle: {
type: Number,
default: 90
},
source: {
type: Object,
default: () => ({
album: '从相册中选择',
camera: '拍照',
// #ifdef MP-WEIXIN
message: '从微信中选择'
// #endif
})
}
},
data() {
return {
canvasWidth: 0,
canvasHeight: 0,
clipX: 0,
clipY: 0,
clipWidth: 0,
clipHeight: 0,
animation: false,
imageWidth: 0,
imageHeight: 0,
imageTop: 0,
imageLeft: 0,
scale: 1,
angle: 0,
image: this.imageUrl,
sysinfo: {},
throttleTimer: null,
throttleFlag: true,
timeClipCenter: null,
flagClipTouch: false,
flagEndTouch: false,
clipStart: {},
animationTimer: null,
touchRelative: [{x: 0,y: 0}],
hypotenuseLength: 0,
ctx: null
};
},
computed: {
clipStyle() {
const {clipWidth, clipHeight, clipY, clipX, animation} = this
return `
width: ${clipWidth}px;
height:${clipHeight}px;
transition-property: ${animation ? '' : 'background'};
left: ${clipX}px;
top: ${clipY}px
`
},
imageStyle() {
const {imageWidth, imageHeight, imageLeft, imageTop, animation, scale, angle} = this
return `
width: ${imageWidth ? imageWidth + 'px' : 'auto'};
height: ${imageHeight ? imageHeight + 'px' : 'auto'};
transform: translate3d(${imageLeft - imageWidth / 2}px, ${imageTop - imageHeight / 2}px, 0) scale(${scale}) rotate(${angle}deg);
transition-duration: ${animation ? 0.35 : 0}s
`
},
clipSize() {
const { clipWidth, clipHeight } = this;
return { clipWidth, clipHeight };
},
clipPoint() {
const { clipY, clipX } = this;
return { clipY, clipX };
}
},
watch: {
value(val) {
if(!val) {
this.animation = 0
this.angle = 0
} else {
if(this.imageUrl) {
const {imageWidth, imageHeight, imageLeft, imageTop, scale, clipX, clipY, clipWidth, clipHeight, path} = cache?.[this.imageUrl] || {}
if(path != this.image) {
this.image = this.imageUrl;
} else {
this.setDiffData({imageWidth, imageHeight, imageLeft, imageTop, scale, clipX, clipY, clipWidth, clipHeight})
}
}
}
},
imageUrl(url) {
this.image = url
},
image:{
handler: async function(url) {
this.getImageInfo(url)
},
// immediate: true,
},
clipSize({ widthVal, heightVal }) {
let { minWidth, minHeight } = this;
minWidth = minWidth / 2;
minHeight = minHeight / 2;
if (widthVal < minWidth) {
this.setDiffData({clipWidth: minWidth})
}
if (heightVal < minHeight) {
this.setDiffData({clipHeight: minHeight})
}
this.calcClipSize();
},
angle(val) {
this.animation = true;
this.moveStop();
const { isLimitMove } = this;
if (isLimitMove && val % 90) {
this.setDiffData({
angle: Math.round(val / 90) * 90
})
}
this.imgMarginDetectionScale();
},
animation(val) {
clearTimeout(this.animationTimer);
if (val) {
let animationTimer = setTimeout(() => {
this.setDiffData({
animation: false
})
}, 260);
this.setDiffData({animationTimer})
this.animationTimer = animationTimer;
}
},
isLimitMove(val) {
if (val) {
if (this.angle % 90) {
this.setDiffData({
angle : Math.round(this.angle / 90) * 90
})
}
this.imgMarginDetectionScale();
}
},
clipPoint() {
this.cutDetectionPosition();
},
width(width, oWidth) {
if (width !== oWidth) {
this.setDiffData({
clipWidth: width / 2
})
}
},
height(height, oHeight) {
if (height !== oHeight) {
this.setDiffData({
clipHeight: height / 2
})
}
}
},
mounted() {
const sysinfo = uni.getSystemInfoSync();
this.sysinfo = sysinfo;
this.setClipInfo();
if(this.image) {
this.getImageInfo(this.image)
}
this.setClipCenter();
this.calcClipSize();
this.cutDetectionPosition();
},
methods: {
setDiffData(data) {
Object.keys(data).forEach(key => {
if (this[key] !== data[key]) {
this[key] = data[key];
}
});
},
getImageInfo(url) {
if (!url) return;
if(this.value) {
uni.showLoading({
title: '请稍候...',
mask: true
});
}
uni.getImageInfo({
src: url,
success: res => {
this.imgComputeSize(res.width, res.height);
this.image = res.path;
if (this.isLimitMove) {
this.imgMarginDetectionScale();
this.$emit('ready', res);
}
const {imageWidth, imageHeight, imageLeft, imageTop, scale, clipX, clipY, clipWidth, clipHeight} = this
cache[url] = Object.assign(res, {imageWidth, imageHeight, imageLeft, imageTop, scale, clipX, clipY, clipWidth, clipHeight});
},
fail: (err) => {
this.imgComputeSize();
if (this.isLimitMove) {
this.imgMarginDetectionScale();
}
}
});
},
setClipInfo() {
const { width, height, sysinfo, canvasId } = this;
const clipWidth = width / 2;
const clipHeight = height / 2;
const clipY = (sysinfo.windowHeight - clipHeight) / 2;
const clipX = (sysinfo.windowWidth - clipWidth) / 2;
const imageLeft = sysinfo.windowWidth / 2;
const imageTop = sysinfo.windowHeight / 2;
this.ctx = uni.createCanvasContext(canvasId, this);
this.clipWidth = clipWidth;
this.clipHeight = clipHeight;
this.clipX = clipX;
this.clipY = clipY;
this.canvasHeight = clipHeight;
this.canvasWidth = clipWidth;
this.imageLeft = imageLeft;
this.imageTop = imageTop;
},
setClipCenter() {
const { sysInfo, clipHeight, clipWidth, imageTop, imageLeft } = this;
let sys = sysInfo || uni.getSystemInfoSync();
let clipY = (sys.windowHeight - clipHeight) * 0.5;
let clipX = (sys.windowWidth - clipWidth) * 0.5;
this.imageTop = imageTop - this.clipY + clipY;
this.imageLeft = imageLeft - this.clipX + clipX;
this.clipY = clipY;
this.clipX = clipX;
},
calcClipSize() {
const { clipHeight, clipWidth, sysinfo, clipX, clipY } = this;
if (clipWidth > sysinfo.windowWidth) {
this.setDiffData({
clipWidth: sysinfo.windowWidth
})
} else if (clipWidth + clipX > sysinfo.windowWidth) {
this.setDiffData({
clipX: sysinfo.windowWidth - clipX
})
}
if (clipHeight > sysinfo.windowHeight) {
this.setDiffData({
clipHeight: sysinfo.windowHeight
})
} else if (clipHeight + clipY > sysinfo.windowHeight) {
this.clipY = sysinfo.windowHeight - clipY;
this.setDiffData({
clipY: sysinfo.windowHeight - clipY
})
}
},
cutDetectionPosition() {
const { clipX, clipY, sysinfo, clipHeight, clipWidth } = this;
let cutDetectionPositionTop = () => {
if (clipY < 0) {
this.setDiffData({clipY: 0})
}
if (clipY > sysinfo.windowHeight - clipHeight) {
this.setDiffData({clipY: sysinfo.windowHeight - clipHeight})
}
},
cutDetectionPositionLeft = () => {
if (clipX < 0) {
this.setDiffData({clipX: 0})
}
if (clipX > sysinfo.windowWidth - clipWidth) {
this.setDiffData({clipX: sysinfo.windowWidth - clipWidth})
}
};
if (clipY === null && clipX === null) {
let newClipY = (sysinfo.windowHeight - clipHeight) * 0.5;
let newClipX = (sysinfo.windowWidth - clipWidth) * 0.5;
this.setDiffData({
clipX: newClipX,
clipY: newClipY
})
} else if (clipY !== null && clipX !== null) {
cutDetectionPositionTop();
cutDetectionPositionLeft();
} else if (clipY !== null && clipX === null) {
cutDetectionPositionTop();
this.setDiffData({
clipX: (sysinfo.windowWidth - clipWidth) / 2
})
} else if (clipY === null && clipX !== null) {
cutDetectionPositionLeft();
this.setDiffData({
clipY: (sysinfo.windowHeight - clipHeight) / 2
})
}
},
imgComputeSize(width, height) {
const { imageWidth, imageHeight } = calcImageSize(width, height, this);
this.imageWidth = imageWidth;
this.imageHeight = imageHeight;
},
imgMarginDetectionScale(scale) {
if (!this.isLimitMove) return;
const currentScale = calcImageScale(this, scale);
this.imgMarginDetectionPosition(currentScale);
},
imgMarginDetectionPosition(scale) {
if (!this.isLimitMove) return;
const { scale: currentScale, left, top } = calcImageOffset(this, scale);
this.setDiffData({
imageLeft: left,
imageTop: top,
scale: currentScale
})
},
throttle() {
this.setDiffData({
throttleFlag: true
})
},
moveDuring() {
clearTimeout(this.timeClipCenter);
},
moveStop() {
clearTimeout(this.timeClipCenter);
const timeClipCenter = setTimeout(() => {
if (!this.animation) {
this.setDiffData({animation: true})
}
this.setClipCenter();
}, 800);
this.setDiffData({timeClipCenter})
},
clipTouchStart(event) {
// #ifdef H5
event.preventDefault()
// #endif
if (!this.image) {
uni.showToast({
title: '请选择图片',
icon: 'none'
});
return;
}
const currentX = event.touches[0].clientX;
const currentY = event.touches[0].clientY;
const { clipX, clipY, clipWidth, clipHeight } = this;
const corner = determineDirection(clipX, clipY, clipWidth, clipHeight, currentX, currentY);
this.moveDuring();
if(!corner) {return}
this.clipStart = {
width: clipWidth,
height: clipHeight,
x: currentX,
y: currentY,
clipY,
clipX,
corner
};
this.flagClipTouch = true;
this.flagEndTouch = true;
},
clipTouchMove(event) {
// #ifdef H5
event.stopPropagation()
event.preventDefault()
// #endif
if (!this.image) {
uni.showToast({
title: '请选择图片',
icon: 'none'
});
return;
}
//
if (event.touches.length !== 1) {
return;
}
const { flagClipTouch, throttleFlag } = this;
if (flagClipTouch && throttleFlag) {
const { isLockRatio, isLockHeight, isLockWidth } = this;
if (isLockRatio && (isLockWidth || isLockHeight)) return;
this.setDiffData({
throttleFlag: false
})
this.throttle();
const clipData = clipTouchMoveOfCalculate(this, event);
if(clipData) {
const { width, height, clipX, clipY } = clipData;
if (!isLockWidth && !isLockHeight) {
this.setDiffData({
clipWidth: width,
clipHeight: height,
clipX,
clipY
})
} else if (!isLockWidth) {
this.setDiffData({
clipWidth: width,
clipX
})
} else if (!isLockHeight) {
this.setDiffData({
clipHeight: height,
clipY
})
}
this.imgMarginDetectionScale();
}
}
},
clipTouchEnd() {
this.moveStop();
this.flagClipTouch = false;
},
imageTouchStart(e) {
// #ifdef H5
event.preventDefault()
// #endif
this.flagEndTouch = false;
const { imageLeft, imageTop } = this;
const clientXForLeft = e.touches[0].clientX;
const clientYForLeft = e.touches[0].clientY;
let touchRelative = [];
if (e.touches.length === 1) {
touchRelative[0] = {
x: clientXForLeft - imageLeft,
y: clientYForLeft - imageTop
};
this.touchRelative = touchRelative;
} else {
const clientXForRight = e.touches[1].clientX;
const clientYForRight = e.touches[1].clientY;
let width = Math.abs(clientXForLeft - clientXForRight);
let height = Math.abs(clientYForLeft - clientYForRight);
const hypotenuseLength = calcPythagoreanTheorem(width, height);
touchRelative = [
{
x: clientXForLeft - imageLeft,
y: clientYForLeft - imageTop
},
{
x: clientXForRight - imageLeft,
y: clientYForRight - imageTop
}
];
this.touchRelative = touchRelative;
this.hypotenuseLength = hypotenuseLength;
}
},
imageTouchMove(e) {
// #ifdef H5
event.preventDefault()
// #endif
const { flagEndTouch, throttleFlag } = this;
if (flagEndTouch || !throttleFlag) return;
const clientXForLeft = e.touches[0].clientX;
const clientYForLeft = e.touches[0].clientY;
this.setDiffData({throttleFlag: false})
this.throttle();
this.moveDuring();
if (e.touches.length === 1) {
const { left: imageLeft, top: imageTop} = imageTouchMoveOfCalcOffset(this, clientXForLeft, clientYForLeft);
this.setDiffData({
imageLeft,
imageTop
})
this.imgMarginDetectionPosition();
} else {
const clientXForRight = e.touches[1].clientX;
const clientYForRight = e.touches[1].clientY;
let width = Math.abs(clientXForLeft - clientXForRight),
height = Math.abs(clientYForLeft - clientYForRight),
hypotenuse = calcPythagoreanTheorem(width, height),
scale = this.scale * (hypotenuse / this.hypotenuseLength);
if (this.isDisableScale) {
scale = 1;
} else {
scale = scale <= this.minRatio ? this.minRatio : scale;
scale = scale >= this.maxRatio ? this.maxRatio : scale;
this.$emit('change', {
width: this.imageWidth * scale,
height: this.imageHeight * scale
});
}
this.imgMarginDetectionScale(scale);
this.hypotenuseLength = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
this.scale = scale;
}
},
imageTouchEnd() {
this.setDiffData({
flagEndTouch: true
})
this.moveStop();
},
uploadImage() {
const itemList = Object.entries(this.source)
const sizeType = ['original', 'compressed']
const success = ({tempFilePaths:a, tempFiles: b}) => {
this.image = a ? a[0] : b[0].path
};
const _uploadImage = (type) => {
if(type !== 'message') {
uni.chooseImage({
count: 1,
sizeType,
sourceType: [type],
success
});
}
// #ifdef MP-WEIXIN
if(type == 'message') {
wx.chooseMessageFile({
count: 1,
type: 'image',
success
})
}
// #endif
}
if(itemList.length > 1) {
uni.showActionSheet({
itemList: itemList.map(v => v[1]),
success: ({tapIndex: i}) => {
_uploadImage(itemList[i][0])
}
})
} else {
_uploadImage(itemList[0][0])
}
},
imageReset() {
const sys = this.sysinfo || uni.getSystemInfoSync();
this.scale = 1;
this.angle = 0;
this.imageTop = sys.windowHeight / 2;
this.imageLeft = sys.windowWidth / 2;
},
imageLoad(e) {
this.imageReset();
uni.hideLoading();
this.$emit('ready', e.detail);
},
rotate(event) {
if (this.isDisableRotate) return;
if (!this.image) {
uni.showToast({
title: '请选择图片',
icon: 'none'
});
return;
}
const { rotateAngle } = this;
const originAngle = this.angle
const type = event.currentTarget.dataset.type;
if (type === 'along') {
this.angle = originAngle + rotateAngle
} else {
this.angle = originAngle - rotateAngle
}
this.$emit('rotate', this.angle);
},
confirm() {
if (!this.image) {
uni.showToast({
title: '请选择图片',
icon: 'none'
});
return;
}
uni.showLoading({
title: '加载中'
});
const { canvasHeight, canvasWidth, clipHeight, clipWidth, ctx, scale, imageLeft, imageTop, clipX, clipY, angle, scaleRatio: dpr, image, quality, fileType, type: imageType, canvasId } = this;
const draw = () => {
const imageWidth = this.imageWidth * scale * dpr;
const imageHeight = this.imageHeight * scale * dpr;
const xpos = imageLeft - clipX;
const ypos = imageTop - clipY;
ctx.translate(xpos * dpr, ypos * dpr);
ctx.rotate((angle * Math.PI) / 180);
ctx.drawImage(image, -imageWidth / 2, -imageHeight / 2, imageWidth, imageHeight);
ctx.draw(false, () => {
const width = clipWidth * dpr
const height = clipHeight * dpr
let params = {
x: 0,
y: 0,
width,
height,
destWidth: width,
destHeight: height,
canvasId: canvasId,
fileType,
quality,
success: (res) => {
console.log( res.tempFilePath,' res.tempFilePath')
data.url = res.tempFilePath;
uni.hideLoading();
this.$emit('success', data);
this.$emit('input', false)
},
fail: (error) => {
console.error('error', error)
this.$emit('fail', error);
this.$emit('input', false)
}
};
let data = {
url: '',
width,
height
};
uni.canvasToTempFilePath(params, this)
});
};
if (canvasWidth !== clipWidth || canvasHeight !== clipHeight) {
this.canvasWidth = clipWidth;
this.canvasHeight = clipHeight;
ctx.draw();
this.$nextTick(() => {
setTimeout(() => {
draw();
}, 100);
})
} else {
draw();
}
},
cancel() {
this.$emit('cancel', false)
this.$emit('input', false)
},
}
};
</script>
<style scoped>
@import './index'
</style>

View File

@ -0,0 +1,244 @@
/**
* 判断手指触摸位置
*/
export function determineDirection(clipX, clipY, clipWidth, clipHeight, currentX, currentY) {
/*
* (右下>>1 右上>>2 左上>>3 左下>>4)
*/
let corner;
/**
* 思路利用直角坐标系
* 1.找出裁剪框中心点
* 2.如点击坐标在上方点与左方点区域内则点击为左上角
* 3.如点击坐标在下方点与右方点区域内则点击为右下角
* 4.其他角同理
*/
const mainPoint = [clipX + clipWidth / 2, clipY + clipHeight / 2]; // 中心点
const currentPoint = [currentX, currentY]; // 触摸点
if (currentPoint[0] <= mainPoint[0] && currentPoint[1] <= mainPoint[1]) {
corner = 3; // 左上
} else if (currentPoint[0] >= mainPoint[0] && currentPoint[1] <= mainPoint[1]) {
corner = 2; // 右上
} else if (currentPoint[0] <= mainPoint[0] && currentPoint[1] >= mainPoint[1]) {
corner = 4; // 左下
} else if (currentPoint[0] >= mainPoint[0] && currentPoint[1] >= mainPoint[1]) {
corner = 1; // 右下
}
return corner;
}
/**
* 图片边缘检测检测时计算图片偏移量
*/
export function calcImageOffset(data, scale) {
let left = data.imageLeft;
let top = data.imageTop;
scale = scale || data.scale;
let imageWidth = data.imageWidth;
let imageHeight = data.imageHeight;
if ((data.angle / 90) % 2) {
imageWidth = data.imageHeight;
imageHeight = data.imageWidth;
}
const {
clipX,
clipWidth,
clipY,
clipHeight
} = data;
// 当前图片宽度/高度
const currentImageSize = (size) => (size * scale) / 2;
const currentImageWidth = currentImageSize(imageWidth);
const currentImageHeight = currentImageSize(imageHeight);
left = clipX + currentImageWidth >= left ? left : clipX + currentImageWidth;
left = clipX + clipWidth - currentImageWidth <= left ? left : clipX + clipWidth - currentImageWidth;
top = clipY + currentImageHeight >= top ? top : clipY + currentImageHeight;
top = clipY + clipHeight - currentImageHeight <= top ? top : clipY + clipHeight - currentImageHeight;
return {
left,
top,
scale
};
}
/**
* 图片边缘检测时计算图片缩放比例
*/
export function calcImageScale(data, scale) {
scale = scale || data.scale;
let {
imageWidth,
imageHeight,
clipWidth,
clipHeight,
angle
} = data
if ((angle / 90) % 2) {
imageWidth = imageHeight;
imageHeight = imageWidth;
}
if (imageWidth * scale < clipWidth) {
scale = clipWidth / imageWidth;
}
if (imageHeight * scale < clipHeight) {
scale = Math.max(scale, clipHeight / imageHeight);
}
return scale;
}
/**
* 计算图片尺寸
*/
export function calcImageSize(width, height, data) {
let imageWidth = width,
imageHeight = height;
let {
clipWidth,
clipHeight,
sysinfo,
width: originWidth,
height: originHeight
} = data
if (imageWidth && imageHeight) {
if (imageWidth / imageHeight > (clipWidth || originWidth) / (clipWidth || originHeight)) {
imageHeight = clipHeight || originHeight;
imageWidth = (width / height) * imageHeight;
} else {
imageWidth = clipWidth || originWidth;
imageHeight = (height / width) * imageWidth;
}
} else {
let sys = sysinfo || uni.getSystemInfoSync();
imageWidth = sys.windowWidth;
imageHeight = 0;
}
return {
imageWidth,
imageHeight
};
}
/**
* 勾股定理求斜边
*/
export function calcPythagoreanTheorem(width, height) {
return Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
}
/**
* 拖动裁剪框时计算
*/
export function clipTouchMoveOfCalculate(data, event) {
const clientX = event.touches[0].clientX;
const clientY = event.touches[0].clientY;
let {
clipWidth,
clipHeight,
clipY: oldClipY,
clipX: oldClipX,
clipStart,
isLockRatio,
maxWidth,
minWidth,
maxHeight,
minHeight
} = data;
maxWidth = maxWidth / 2;
minWidth = minWidth / 2;
minHeight = minHeight / 2;
maxHeight = maxHeight / 2;
let width = clipWidth,
height = clipHeight,
clipY = oldClipY,
clipX = oldClipX,
// 获取裁剪框实际宽度/高度
// 如果大于最大值则使用最大值
// 如果小于最小值则使用最小值
sizecorrect = () => {
width = width <= maxWidth ? (width >= minWidth ? width : minWidth) : maxWidth;
height = height <= maxHeight ? (height >= minHeight ? height : minHeight) : maxHeight;
},
sizeinspect = () => {
sizecorrect();
if ((width > maxWidth || width < minWidth || height > maxHeight || height < minHeight) && isLockRatio) {
return false;
} else {
return true;
}
};
//if (clipStart.corner) {
height = clipStart.height + (clipStart.corner > 1 && clipStart.corner < 4 ? 1 : -1) * (clipStart.y - clientY);
//}
switch (clipStart.corner) {
case 1:
width = clipStart.width - clipStart.x + clientX;
if (isLockRatio) {
height = width / (clipWidth / clipHeight);
}
if (!sizeinspect()) return;
break;
case 2:
width = clipStart.width - clipStart.x + clientX;
if (isLockRatio) {
height = width / (clipWidth / clipHeight);
}
if (!sizeinspect()) {
return;
} else {
clipY = clipStart.clipY - (height - clipStart.height);
}
break;
case 3:
width = clipStart.width + clipStart.x - clientX;
if (isLockRatio) {
height = width / (clipWidth / clipHeight);
}
if (!sizeinspect()) {
return;
} else {
clipY = clipStart.clipY - (height - clipStart.height);
clipX = clipStart.clipX - (width - clipStart.width);
}
break;
case 4:
width = clipStart.width + clipStart.x - clientX;
if (isLockRatio) {
height = width / (clipWidth / clipHeight);
}
if (!sizeinspect()) {
return;
} else {
clipX = clipStart.clipX - (width - clipStart.width);
}
break;
default:
break;
}
return {
width,
height,
clipX,
clipY
};
}
/**
* 单指拖动图片计算偏移
*/
export function imageTouchMoveOfCalcOffset(data, clientXForLeft, clientYForLeft) {
let left = clientXForLeft - data.touchRelative[0].x,
top = clientYForLeft - data.touchRelative[0].y;
return {
left,
top
};
}

View File

@ -0,0 +1,536 @@
<template>
<div class="wrapper" :style="'top:'+statusBarHeight+'px'">
<div class="header">
<view class="back_div" v-if="inputActive">
<image class="back_img" @click="back_city()" src="https://img.agrimedia.cn/chwl%2Fv2%2Fsearch.png" mode=""></image>
</view>
<input :class="inputActive? 'input':'input inputActive'" @input="onInput" placeholder="搜索城市名" v-model="searchValue" />
</div>
<scroll-view class="calendar-list" scroll-y="true" :scroll-into-view="scrollIntoId">
<view v-if="disdingwei" id="hot">
<!-- 定位模块 -->
<view class="dingwei">
<view class="dingwei_Tips">
当前城市
</view>
<view class="dingwei_city">
<view class="dingwei_city_one" @click="AtCity">
{{UserFilmArae['cityName']?UserFilmArae['cityName']:UserArae2['city']}}
</view>
</view>
</view>
<!-- 最近模块 -->
<view class="dingwei" v-if="Visit.length>=0">
<view class="dingwei_Tips">
最近搜索
</view>
<view class="dingwei_city dingwei_city_zuijin">
<view class="dingwei_city_one toright" v-for="(item,index) in Visit" :key="index" v-if="index<2" @click="back_city(item)">
{{item.cityName}}
</view>
</view>
</view>
</view>
<!-- 城市列表 -->
<view v-if="searchValue == ''" v-for="(item, index) in list" :id="getId(index)" :key="index">
<view class="letter-header">{{ getId(index) }}</view>
<view class="city-div" v-for="(city, i) in item" :key="i">
<view class="regionName" @click="back_city(city)">
{{city.cityName}}
</view>
</view>
</view>
<!-- 搜索结果 -->
<view class="city-div" v-for="(item, index) in searchList" :key="item.cityId">
<view class="regionName" @click="back_city(item)">
{{item.cityName}}
</view>
</view>
</view>
</scroll-view>
<!-- 右侧字母 -->
<view class="letters" v-if="searchValue == ''">
<view class="letters-item" v-for="item in letter" :key="item" @click="scrollTo(item)">{{ item }}</view>
</view>
<!-- 选中之后字母 -->
<view class="mask" v-if="showMask">
<view class="mask-r">{{selectLetter}}</view>
</view>
</div>
</template>
<script>
import { getFilmCity} from '@/request/film/index.js';
import { mapGetters} from 'vuex';
import Citys from '../city.js';
import { mapMutations } from 'vuex';
export default {
components: {},
props: {},
data() {
return {
statusBarHeight: this.statusBarHeight,
ImgUrl: this.ImgUrl,
letter: [],
selectLetter: '',
searchValue: '',
scrollIntoId: '',
list: [],
tId: null,
searchList: [],
showMask: false,
disdingwei: true,
Visit: [], //访
position: '',
longitude: '', //
latitude: '', //
seconds: 3,
po_tips: '重新定位',
citys:[],
hotCity:[],
inputActive: true
}
},
computed: {
...mapGetters({
//
UserFilmArae: 'GetFilmData',
//
UserArae2: 'GetcityInfor',
}),
},
created() {
getFilmCity().then(data=>{
this['citys'] = data['data'];
//访
var that = this
uni.getStorage({
key: 'Visit_key',
success: function(res) {
that.Visit = res.data
}
});
// this.position = this['getCityName'];
//
// that.getWarpweft()
//city.js
var mu = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'w', 'x', 'y', 'z'];
var tmp = [];
for (var i = 0; i < mu.length; i++) {
var item = mu[i];
for (var j = 0; j < this.citys.length; j++) {
var py = this.citys[j].firstLetter;
if (py.toLowerCase().substring(0, 1) == item) {
if (tmp.indexOf(item) == -1) {
this.list[i] = [this.citys[j]];
tmp.push(item);
this.letter.push(item.toUpperCase());
} else {
this.list[i].push(this.citys[j]);
}
}
}
}
})
},
methods: {
...mapMutations({
SETFILMDATA: 'SETFILMDATA',
}),
getId(index) {
return this.letter[index];
},
scrollTo(letter) {
this.showMask = true
this.selectLetter = letter == 'hot' ? '最' : letter
setTimeout(() => {
this.showMask = false
}, 300);
this.scrollIntoId = letter;
},
query(source, text) {
let res = [];
var self = this;
res = source.filter(item => {
const arr = [];
let isHave = false;
Object.keys(item).forEach(prop => {
const itemStr = item[prop];
self.isString(itemStr) &&
itemStr.split(',').forEach(val => {
arr.push(val);
});
});
arr.some(val => {
isHave = new RegExp('^' + text).test(val);
return isHave;
});
return isHave;
});
console.log(JSON.stringify(res));
return res;
},
isString(obj) {
return typeof obj === 'string';
},
onInput(e) {
const value = e.target.value;
console.log(value, '值');
if (value !== '' && this.citys && this.citys.length > 0) {
const queryData = this.query(this.citys, String(value).trim());
this.searchList = queryData;
this.disdingwei = false;
this.inputActive = false;
} else {
this.searchList = [];
this.disdingwei = true;
this.inputActive = true;
}
},
back_city(item, ind) {
if (item) {
const FilmCity = {
cityId: item.cityId,
cityName: item.cityName,
regionName: "",
regionId: ""
}
//unshift push
if(this.Visit == null){
this.Visit = []
}
this.Visit.unshift(FilmCity)
this.searchValue = "";
this.disdingwei = true
var arr = this.Visit
//
function distinct(arr) {
let newArr = []
for (let i = 0; i < arr.length; i++) {
if (newArr.indexOf(arr[i]) < 0) {
newArr.push(arr[i])
}
}
return newArr
}
this.Visit = distinct(arr)
console.log(this.Visit, "---最近访问")
uni.setStorage({
key: 'Visit_key',
data: this.Visit
});
this.SETFILMDATA(FilmCity);
// 退
uni.navigateBack({
delta: 1
});
}
},
AtCity() {
uni.navigateBack({
delta: 1
});
},
getWarpweft() {
this.po_tips = '定位中'
this.$store.dispatch('location/getLocation').then(res => {
console.log(res,'locationinfo')
if(res != undefined){
this.$store.dispatch('location/getCityName2').then(res => {
this.po_tips = '重新定位';
// this.position = this['getCityName'];
})
}else{
this.po_tips = '定位失败'
}
})
return
var that = this
that.po_tips = '定位中...'
let qqmapsdk = new qqMap({
key: 'DABBZ-UVV33-TN63X-3YGRM-2L562-NHFGO' // key
})
this.$store.dispatch('location/getLocation').then(res => {
qqmapsdk.reverseGeocoder({
location: {
latitude: res.latitude,
longitude: res.longitude
},
success(res) {
console.log(res)
that.position = res.result.address_component.city
that.po_tips = '重新定位'
},
fail(err) {
console.log(err)
}
})
})
}
}
};
</script>
<style lang="scss" scoped>
.wrapper {
position: fixed;
z-index: 999999;
background: #F5F5F5;
height: 100%;
width: 100%;
top: 0px;
left: 0px;
}
.mask {
position: absolute;
bottom: 0upx;
top: 83upx;
left: 0upx;
right: 0upx;
width: 750upx;
display: flex;
justify-content: center;
align-items: center;
background: rgba(0, 0, 0, 0);
}
.mask-r {
height: 120upx;
width: 120upx;
border-radius: 60upx;
display: flex;
background: rgba(0, 0, 0, 0.5);
justify-content: center;
align-items: center;
font-size: 40upx;
color: #FFFFFF
}
.content {
height: 100%;
width: 100%;
background-color: #ffffff;
}
.header {
height: 85upx;
display: flex;
justify-content: flex-start;
align-items: center;
display: flex;
}
.back_div {
width: 35rpx;
height: 35rpx;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 24rpx;
left: 280rpx;
}
.back_img {
width: 35rpx;
height: 35rpx;
}
.input {
font-size: 24upx;
width: 720rpx;
height: 60rpx;
border-radius: 40upx;
background-color: #FFFFFF;
padding-left: 20upx;
padding-right: 20upx;
box-sizing: border-box;
border: 2rpx solid #DEDEDE;
text-align: center;
margin: 0 auto;
color: #999;
}
.inputActive {
text-align: left !important;
}
.title {
font-size: 30upx;
color: white;
}
.show {
left: 0;
width: 100%;
transition: left 0.3s ease;
}
.hide {
left: 100%;
width: 100%;
transition: left 0.3s ease;
}
.title {
font-size: 30upx;
color: white;
}
.calendar-list {
position: absolute;
top: 83upx;
bottom: 0upx;
width: 100%;
}
.letters {
position: absolute;
right: 30upx;
bottom: 0px;
width: 50upx;
top: 260upx;
color: #2f9bfe;
text-align: center;
font-size: 24upx;
}
.letters-item {
margin-bottom: 5upx;
color: #666666;
}
.letter-header {
height: 45upx;
font-size: 22upx;
color: #333333;
padding-left: 24upx;
box-sizing: border-box;
display: flex;
align-items: center;
/* background-color: #ebedef; */
}
.city-div {
width: 100%;
padding: 0rpx 50rpx 0rpx 20rpx;
border-bottom-width: 0.5upx;
border-bottom-color: #ebedef;
border-bottom-style: solid;
align-items: center;
margin-right: 35upx;
.regionName {
width: 100%;
padding: 20rpx 30rpx;
margin: 0upx 24upx;
align-items: center;
font-size: 24rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
line-height: 34rpx;
}
}
.city {
padding-left: 30upx;
font-size: 24rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #333333;
line-height: 34rpx;
}
.dingwei {
width: 100%;
padding-top: 25upx;
box-sizing: border-box;
margin-bottom: 26upx;
}
.dingwei_Tips {
margin-left: 24upx;
margin-bottom: 24upx;
font-size: 24upx;
color: #A5A5A5;
}
.dingwei_refresh {
width: 44rpx;
height: 44rpx;
}
.dingwei_city {
width: 100%;
padding-left: 55upx;
padding-right: 70upx;
box-sizing: border-box;
display: flex;
}
.dingwei_city_one {
width: 218rpx;
height: 80rpx;
line-height: 80rpx;
font-size: 24rpx;
color: #333333;
display: flex;
justify-content: center;
align-items: center;
background: #DEDEDE;
border-radius: 44rpx;
margin-right: 6rpx;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow:ellipsis;
text-align: center;
padding: 0rpx 20rpx;
}
.dingweis_div {
display: flex;
align-content: flex-end;
align-items: center;
font-size: 24upx;
color: #FD5745;
}
.dingweis {
width: 32upx;
height: 32upx;
}
.dingwei_city_zuijin {
display: flex;
justify-content: flex-start;
}
.toright {
margin-right: 25upx;
}
</style>

View File

@ -0,0 +1,507 @@
<template>
<div class="wrapper" :style="'top:'+statusBarHeight+'px'">
<div class="header">
<view class="back_div" v-if="inputActive">
<!-- <image class="back_img" @click="back_city()" src="" mode=""></image> -->
<image class="back_img" @click="back_city()" src="https://img.agrimedia.cn/refresh.png" mode=""></image>
</view>
<input :class="inputActive? 'input':'input inputActive'" @input="onInput" placeholder="搜索城市名" v-model="searchValue" />
</div>
<scroll-view class="calendar-list" scroll-y="true" :scroll-into-view="scrollIntoId">
<view v-if="disdingwei" id="hot">
<!-- 定位模块 -->
<view class="dingwei">
<view class="dingwei_Tips">
当前城市
</view>
<view class="dingwei_city">
<view class="dingwei_city_one">
{{getCityName}}
</view>
<view class="dingweis_div" @click="getWarpweft">
<image class="dingweis" src="https://img.agrimedia.cn/refresh.png" mode=""></image>
<!-- <text>{{po_tips}}</text> -->
</view>
</view>
</view>
<!-- 最近模块 -->
<view class="dingwei" v-if="Visit.length>=0">
<view class="dingwei_Tips">
最近搜索
</view>
<view class="dingwei_city dingwei_city_zuijin">
<view class="dingwei_city_one toright" v-for="(item,index) in Visit" :key="index" v-if="index<2" @click="back_city(item)">
{{item.cityName}}
</view>
</view>
</view>
</view>
<!-- 城市列表 -->
<view v-if="searchValue == ''" v-for="(item, index) in list" :id="getId(index)" :key="index">
<view class="letter-header">{{ getId(index) }}</view>
<view class="city-div" v-for="(city, i) in item" :key="i" @click="back_city(city)">
<text class="city">{{ city.cityName }}</text>
</view>
</view>
<!-- 搜索结果 -->
<view class="city-div" v-for="(item, index) in searchList" :key="index" @click="back_city(item)">
<text class="city">{{ item.cityName }}</text>
</view>
</scroll-view>
<!-- 右侧字母 -->
<view class="letters" v-if="searchValue == ''">
<!-- <view class="letters-item" @click="scrollTo('hot')">最近</view> -->
<view class="letters-item" v-for="item in letter" :key="item" @click="scrollTo(item)">{{ item }}</view>
</view>
<!-- 选中之后字母 -->
<view class="mask" v-if="showMask">
<view class="mask-r">{{selectLetter}}</view>
</view>
</div>
</template>
<script>
let qqMap = require("@/utils/qqmap-wx-jssdk.min.js");
import { cityList} from '@/common/api/api.js'
import { mapGetters} from 'vuex'
import Citys from '../city.js';
export default {
components: {},
props: {},
computed: {
...mapGetters({
getCityName:'location/getCityName'
})
},
data() {
return {
statusBarHeight: this.statusBarHeight,
ImgUrl: this.ImgUrl,
letter: [],
selectLetter: '',
searchValue: '',
scrollIntoId: '',
list: [],
tId: null,
searchList: [],
showMask: false,
disdingwei: true,
Visit: [], //访
position: '',
longitude: '', //
latitude: '', //
seconds: 3,
po_tips: '重新定位',
citys:[],
hotCity:[],
inputActive: true
}
},
created() {
cityList().then(data=>{
this['citys'] = data['cities'];
this['hotCity'] = data['hotCity'];
//访
var that = this
uni.getStorage({
key: 'Visit_key',
success: function(res) {
that.Visit = res.data
}
});
// this.position = this['getCityName'];
//
// that.getWarpweft()
//city.js
var mu = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'w', 'x', 'y',
'z'
];
var tmp = [];
for (var i = 0; i < mu.length; i++) {
var item = mu[i];
for (var j = 0; j < this.citys.length; j++) {
var py = this.citys[j].py;
if (py.substring(0, 1) == item) {
if (tmp.indexOf(item) == -1) {
this.list[i] = [this.citys[j]];
tmp.push(item);
this.letter.push(item.toUpperCase());
} else {
this.list[i].push(this.citys[j]);
}
}
}
}
console.log(this.citys)
})
},
methods: {
getId(index) {
return this.letter[index];
},
scrollTo(letter) {
this.showMask = true
this.selectLetter = letter == 'hot' ? '最' : letter
setTimeout(() => {
this.showMask = false
}, 300);
this.scrollIntoId = letter;
},
query(source, text) {
let res = [];
var self = this;
res = source.filter(item => {
const arr = [];
let isHave = false;
Object.keys(item).forEach(prop => {
const itemStr = item[prop];
self.isString(itemStr) &&
itemStr.split(',').forEach(val => {
arr.push(val);
});
});
arr.some(val => {
isHave = new RegExp('^' + text).test(val);
return isHave;
});
return isHave;
});
console.log(JSON.stringify(res));
return res;
},
isString(obj) {
return typeof obj === 'string';
},
onInput(e) {
const value = e.target.value;
console.log(value);
if (value !== '' && this.citys && this.citys.length > 0) {
const queryData = this.query(this.citys, String(value).trim());
this.searchList = queryData;
this.disdingwei = false;
this.inputActive = false;
} else {
this.searchList = [];
this.disdingwei = true;
this.inputActive = true;
}
},
back_city(item) {
if (item) {
//unshift push
console.log(this.Visit,'visit')
if(this.Visit == null){
this.Visit = []
}
this.Visit.unshift(item)
this.searchValue = "";
this.disdingwei = true
var arr = this.Visit
//
function distinct(arr) {
let newArr = []
for (let i = 0; i < arr.length; i++) {
if (newArr.indexOf(arr[i]) < 0) {
newArr.push(arr[i])
}
}
return newArr
}
this.Visit = distinct(arr)
console.log(this.Visit, "---最近访问")
uni.setStorage({
key: 'Visit_key',
data: this.Visit
});
this.$store.commit('location/setCityName',item.cityName)
this.$emit('back_city', item);
// this.$emit('updateData')
}
// else {
// this.$emit('back_city', 'no');
// }
},
getWarpweft() {
this.po_tips = '定位中'
this.$store.dispatch('location/getLocation').then(res => {
console.log(res,'locationinfo')
if(res != undefined){
this.$store.dispatch('location/getCityName2').then(res => {
this.po_tips = '重新定位';
// this.position = this['getCityName'];
})
}else{
this.po_tips = '定位失败'
}
})
return
var that = this
that.po_tips = '定位中...'
let qqmapsdk = new qqMap({
key: 'DABBZ-UVV33-TN63X-3YGRM-2L562-NHFGO' // key
})
this.$store.dispatch('location/getLocation').then(res => {
qqmapsdk.reverseGeocoder({
location: {
latitude: res.latitude,
longitude: res.longitude
},
success(res) {
console.log(res)
that.position = res.result.address_component.city
that.po_tips = '重新定位'
},
fail(err) {
console.log(err)
}
})
})
}
}
};
</script>
<style scoped>
.wrapper {
position: fixed;
z-index: 999999;
background: #F5F5F5;
height: 100%;
width: 100%;
top: 0px;
left: 0px;
}
.mask {
position: absolute;
bottom: 0upx;
top: 83upx;
left: 0upx;
right: 0upx;
width: 750upx;
display: flex;
justify-content: center;
align-items: center;
background: rgba(0, 0, 0, 0);
}
.mask-r {
height: 120upx;
width: 120upx;
border-radius: 60upx;
display: flex;
background: rgba(0, 0, 0, 0.5);
justify-content: center;
align-items: center;
font-size: 40upx;
color: #FFFFFF
}
.content {
height: 100%;
width: 100%;
background-color: #ffffff;
}
.header {
height: 85upx;
display: flex;
justify-content: flex-start;
align-items: center;
display: flex;
}
.back_div {
width: 35rpx;
height: 35rpx;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 30rpx;
left: 280rpx;
}
.back_img {
width: 35rpx;
height: 35rpx;
}
.input {
font-size: 24upx;
width: 720rpx;
height: 60rpx;
border-radius: 40upx;
background-color: #FFFFFF;
padding-left: 20upx;
padding-right: 20upx;
box-sizing: border-box;
border: 2rpx solid #DEDEDE;
text-align: center;
margin: 0 auto;
color: #999;
}
.inputActive {
text-align: left !important;
}
.title {
font-size: 30upx;
color: white;
}
.show {
left: 0;
width: 100%;
transition: left 0.3s ease;
}
.hide {
left: 100%;
width: 100%;
transition: left 0.3s ease;
}
.title {
font-size: 30upx;
color: white;
}
.calendar-list {
position: absolute;
top: 83upx;
bottom: 0upx;
width: 100%;
}
.letters {
position: absolute;
right: 30upx;
bottom: 0px;
width: 50upx;
top: 260upx;
color: #2f9bfe;
text-align: center;
font-size: 24upx;
}
.letters-item {
margin-bottom: 5upx;
color: #666666;
}
.letter-header {
height: 45upx;
font-size: 22upx;
color: #333333;
padding-left: 24upx;
box-sizing: border-box;
display: flex;
align-items: center;
/* background-color: #ebedef; */
}
.city-div {
width: 660upx;
height: 85upx;
margin-left: 24upx;
border-bottom-width: 0.5upx;
border-bottom-color: #ebedef;
border-bottom-style: solid;
display: flex;
align-items: center;
margin-right: 35upx;
}
.city {
padding-left: 30upx;
font-size: 24rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #333333;
line-height: 34rpx;
}
.dingwei {
width: 100%;
padding-top: 25upx;
box-sizing: border-box;
margin-bottom: 26upx;
}
.dingwei_Tips {
margin-left: 24upx;
margin-bottom: 24upx;
font-size: 24upx;
color: #A5A5A5;
}
.dingwei_refresh {
width: 44rpx;
height: 44rpx;
}
.dingwei_city {
width: 100%;
padding-left: 55upx;
padding-right: 70upx;
box-sizing: border-box;
display: flex;
}
.dingwei_city_one {
width: 218rpx;
height: 80rpx;
line-height: 80rpx;
font-size: 24rpx;
color: #333333;
display: flex;
justify-content: center;
align-items: center;
background: #DEDEDE;
border-radius: 44rpx;
margin-right: 6rpx;
}
.dingweis_div {
display: flex;
align-content: flex-end;
align-items: center;
font-size: 24upx;
color: #FD5745;
}
.dingweis {
width: 32upx;
height: 32upx;
}
.dingwei_city_zuijin {
display: flex;
justify-content: flex-start;
}
.toright {
margin-right: 25upx;
}
</style>

View File

@ -0,0 +1,42 @@
<template>
<view>
<u-icon v-if="showLeftLabel" name="arrow-down" label="天津市" labelPos="left"></u-icon>
<u-line v-if="showLeftLabel" direction="col" margin="20rpx -5rpx 20rpx 20rpx" color="#666" length="30rpx"></u-line>
<u-search bgColor="#f2f2f2" :showAction="isShowAction" :disabled="true" :placeholder="placeholderValue"
v-model="keyword"></u-search>
</view>
</template>
<script>
export default {
name:"localSearch",
props:{
showLeftLabel:{
type:Boolean,
default:false
},
placeholderValue:{
type:String,
default:"请输入商品名称"
},
isShowAction:{
type:Boolean,
default:false
},
keyword:{
type:String,
default:"请输入商品名称"
}
},
data() {
return {
};
}
}
</script>
<style>
</style>

View File

@ -0,0 +1,227 @@
<template>
<view class="serach">
<view class="content" :style="{'border-radius':radius+'px'}">
<!-- HM修改 增加进入输入状态的点击范围 -->
<view class="content-box" :class="{'center':mode === 2}" >
<text class="icon icon-serach"></text>
<!-- HM修改 增加placeholder input confirm-type confirm-->
<input :placeholder="placeholder" @input="inputChange" confirm-type="search" @confirm="triggerConfirm" class="input" :class="{'center':!active && mode === 2}" :focus="isFocus" v-model="inputVal" @focus="focus" @blur="blur"/>
<!-- <view v-if="!active && mode === 2" class="input sub" @click="getFocus">请输入搜索内容</view> -->
<!-- HM修改 @click换成@click.stop阻止冒泡 -->
<text v-if="isDelShow" class="icon icon-del" @click.stop="clear"></text>
</view>
<view v-show="(active&&show&&button === 'inside')||(isDelShow && button === 'inside')" class="serachBtn" @click="search">
搜索
</view>
</view>
<view v-if="button === 'outside'" class="button" :class="{'active':show||active}" @click="search">
<view class="button-item">{{!show?searchName:'搜索'}}</view>
</view>
</view>
</template>
<script>
export default {
props: {
mode: {
value: Number,
default: 1
},
//HM ()
placeholder:{
value: String,
default: '请输入搜索内容'
},
value: {
type: String,
default:false
},
button: {
value: String,
default: 'outside'
},
show: {
value: Boolean,
default: true
},
radius: {
value: String,
default: 60
}
},
data() {
return {
active: false,
inputVal: '',
searchName: '取消',
isDelShow: false,
isFocus: true
};
},
methods: {
//HM confirm
triggerConfirm(){
this.$emit('confirm', false);
},
//HM input
inputChange(event){
var keyword = event.detail.value;
this.$emit('input', keyword);
if (this.inputVal) {
this.isDelShow = true;
}
},
focus() {
this.active = true;
//HM
if (this.inputVal) {
this.isDelShow = true;
}
},
blur() {
console.log('blur');
this.isFocus = false;
if (!this.inputVal) {
this.active = false;
}
},
clear() {
//HM
uni.hideKeyboard();
this.isFocus = false;
this.inputVal = '';
this.active = false;
//HM input
this.$emit('input', '');
//this.$emit('search', '');//HM
},
getFocus() {
if(!this.isFocus){
this.isFocus = true;
}
},
search() {
//HM 退
if (!this.inputVal) {
if(!this.show&&this.searchName == '取消'){
uni.hideKeyboard();
this.isFocus = false;
this.active = false;
return;
}
}
console.log(this.inputVal);
this.$emit('search', this.inputVal?this.inputVal:this.placeholder);
}
},
watch: {
inputVal(newVal) {
if (newVal) {
this.searchName = '搜索';
//this.isDelShow = true; //HM
} else {
this.searchName = '取消';
this.isDelShow = false;
}
},
//HM
value(val) {
this.inputVal = val;
},
}
};
</script>
<style lang="scss">
.serach {
display: flex;
width: 100%;
//border-bottom: 1px #f5f5f5 solid; //HM
box-sizing: border-box;
font-size: $uni-font-size-base;
.content {
display: flex;
align-items: center;
width: 100%;
height: 60upx;
//border: 1px #ccc solid; //HM
background: #fff;
overflow: hidden;
transition: all 0.2s linear;
border-radius: 30px;
.content-box {
width: 100%;
display: flex;
align-items: center;
&.center {
justify-content: center;
}
.icon {
padding: 0 15upx;
&.icon-del {
font-size: 38upx;
&:before {content:"\e644";}
}
&.icon-serach:before {content:"\e61c";}
}
.input {
width: 100%;
max-width: 100%;
line-height: 60upx;
height: 60upx;
transition: all 0.2s linear;
&.center {
width: 200upx;
}
&.sub {
// position: absolute;
width: auto;
color: grey;
}
}
}
.serachBtn {
height: 100%;
flex-shrink: 0;
padding: 0 30upx;
//HM
background:linear-gradient(to right,#ff9801,#ff570a);
//background: $uni-color-success;
line-height: 60upx;
color: #fff;
//border-left: 1px #ccc solid; //HM
transition: all 0.3s;
}
}
.button {
display: flex;
align-items: center;
justify-content: center;
position: relative;
flex-shrink: 0;
width: 0;
transition: all 0.2s linear;
white-space: nowrap;
overflow: hidden;
&.active {
padding-left: 15upx;
width: 100upx;
}
}
}
//HM
@font-face {font-family:"iconfont";src:url('data:application/x-font-woff;charset=utf-8;base64,AAEAAAALAIAAAwAwR1NVQrD+s+0AAAE4AAAAQk9TLzI8fEg3AAABfAAAAFZjbWFws6gbWQAAAeQAAAGcZ2x5ZqgAaogAAAOMAAABMGhlYWQTyEk0AAAA4AAAADZoaGVhB90DhQAAALwAAAAkaG10eBAA//8AAAHUAAAAEGxvY2EA0gBOAAADgAAAAAptYXhwARIANgAAARgAAAAgbmFtZT5U/n0AAAS8AAACbXBvc3SanfjSAAAHLAAAAEUAAQAAA4D/gABcBAD//wAABAAAAQAAAAAAAAAAAAAAAAAAAAQAAQAAAAEAAL8Cm/NfDzz1AAsEAAAAAADYVQKbAAAAANhVApv///+ABAADgQAAAAgAAgAAAAAAAAABAAAABAAqAAQAAAAAAAIAAAAKAAoAAAD/AAAAAAAAAAEAAAAKAB4ALAABREZMVAAIAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAAAAQQAAZAABQAIAokCzAAAAI8CiQLMAAAB6wAyAQgAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABA5gbmRAOA/4AAXAOBAIAAAAABAAAAAAAABAAAAAQA//8EAAAABAAAAAAAAAUAAAADAAAALAAAAAQAAAFoAAEAAAAAAGIAAwABAAAALAADAAoAAAFoAAQANgAAAAgACAACAADmBuYc5kT//wAA5gbmHOZE//8AAAAAAAAAAQAIAAgACAAAAAIAAQADAAABBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAA0AAAAAAAAAAMAAOYGAADmBgAAAAIAAOYcAADmHAAAAAEAAOZEAADmRAAAAAMAAAAAADoATgCYAAAAAv///4AEAAOAABMAHwAABQYiLwEGJCcmAjc2JBcWEgcXFhQBJiAHBhQXFiA3NjQD7RQyFMaG/sl9hw2BiQFqjXgTZccT/sBo/spoPz9oATZoPm0TE8dhDG6FAW2OhwaGfv6+h8YUMgLThoZV0FWGhlnMAAABAAD/gAMAA4EABQAACQE1CQE1AQACAP6IAXgBgP4AiAF4AXiIAAAABAAA//4DlAMnABAAIQAlACkAAAUuAzQ+AjIWFxYQBw4BAyIOAhQeAjI2NzYQJy4BFwEnAQU3AQcCAFKScz09c5Kkkjp2djqSUkiBZjU1ZoGQgTNoaDOBfP6YIAFo/qQgAVwgAgE9cpOjknM9PTl8/r18OT0C9zVmgZCBZTU1Mm4BHW0zNb/+mCABZysf/qQgAAAAAAAAEgDeAAEAAAAAAAAAFQAAAAEAAAAAAAEACAAVAAEAAAAAAAIABwAdAAEAAAAAAAMACAAkAAEAAAAAAAQACAAsAAEAAAAAAAUACwA0AAEAAAAAAAYACAA/AAEAAAAAAAoAKwBHAAEAAAAAAAsAEwByAAMAAQQJAAAAKgCFAAMAAQQJAAEAEACvAAMAAQQJAAIADgC/AAMAAQQJAAMAEADNAAMAAQQJAAQAEADdAAMAAQQJAAUAFgDtAAMAAQQJAAYAEAEDAAMAAQQJAAoAVgETAAMAAQQJAAsAJgFpCkNyZWF0ZWQgYnkgaWNvbmZvbnQKaWNvbmZvbnRSZWd1bGFyaWNvbmZvbnRpY29uZm9udFZlcnNpb24gMS4waWNvbmZvbnRHZW5lcmF0ZWQgYnkgc3ZnMnR0ZiBmcm9tIEZvbnRlbGxvIHByb2plY3QuaHR0cDovL2ZvbnRlbGxvLmNvbQAKAEMAcgBlAGEAdABlAGQAIABiAHkAIABpAGMAbwBuAGYAbwBuAHQACgBpAGMAbwBuAGYAbwBuAHQAUgBlAGcAdQBsAGEAcgBpAGMAbwBuAGYAbwBuAHQAaQBjAG8AbgBmAG8AbgB0AFYAZQByAHMAaQBvAG4AIAAxAC4AMABpAGMAbwBuAGYAbwBuAHQARwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABzAHYAZwAyAHQAdABmACAAZgByAG8AbQAgAEYAbwBuAHQAZQBsAGwAbwAgAHAAcgBvAGoAZQBjAHQALgBoAHQAdABwADoALwAvAGYAbwBuAHQAZQBsAGwAbwAuAGMAbwBtAAAAAAIAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAECAQMBBAEFAAZzb3VzdW8IamlhbnRvdTQHc2hhbmNodQAAAAAA');}
.icon {
font-family: iconfont;
font-size: 32upx;
font-style: normal;
color: #999;
}
</style>

View File

@ -0,0 +1,134 @@
<!-- 影院组件 -->
<template>
<view class="mov">
<view class="movie" @click="ToMoviesPlay()">
<!-- 名字距离 -->
<view class="movie-info">
<view class="movie-name">
{{data.cinemaName}}
</view>
<view class="movie-area">
{{data.cinemaAddress}}
</view>
</view>
<!-- 价格地址 -->
<view class="movie-address">
<view class="movie-distance">
{{data.distance}}km
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
cinemaData: {}
}
},
props: {
data: {
type: Object,
default: function () {
return {}
}
},
filmDesc: {
type: Object,
default: function () {
return {}
}
},
// or()
isFilm: {
type: Boolean,
default: function () {
return false
}
},
},
onLoad(option) {
},
methods: {
//
ToMoviesPlay() {
console.log(this.data,'-*-*-*--*');
//
if (this.isFilm) {
uni.navigateTo({
url: `../../pages/film/filmYSearch?cinemaData=${encodeURIComponent(JSON.stringify(this.data))}`,
})
} else {
//
this.cinemaData = this.data
uni.navigateTo({
url: `../../pages/film/filmPlay?cinemaData=${encodeURIComponent(JSON.stringify(this.cinemaData))}&filmData=${encodeURIComponent(JSON.stringify(this.filmDesc))}`,
})
}
}
}
}
</script>
<style lang="scss" scoped>
.mov {
padding: 0rpx 24rpx;
background-color: #FFFFFF;
}
.movie {
display: flex;
justify-content: space-between;
align-items: center;
background-color: #FFFFFF;
border-bottom: 2rpx solid #EDEDED;
box-sizing: border-box;
.movie-info {
padding-right: 20rpx;
.movie-name {
font-size: 30rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #333333;
line-height: 40rpx;
margin-bottom: 20rpx;
margin-top: 28rpx;
}
.movie-area {
font-size: 24rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 32rpx;
margin-bottom: 20rpx;
}
}
.movie-address {
.movie-money {
font-size: 24rpx;
font-family: Alibaba-PuHuiTi-H, Alibaba-PuHuiTi;
font-weight: 600;
color: #FC4B5C;
line-height: 32rpx;
margin-bottom: 20rpx;
text-align: right;
text {
font-size: 40rpx;
font-weight: 900;
}
}
.movie-distance {
font-size: 24rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #999999;
line-height: 32rpx;
text-align: right;
}
}
}
</style>

View File

@ -0,0 +1,186 @@
<template>
<view>
<!-- <view class="mt-30 order-box" @click="goOrder(InforData.order_sn)" v-for="(item,index) in collectionList" :key="index"> -->
<view class="mt-30 order-box" @click="goOrder(InforData.order_sn)">
<view class="flbtn">
<view class="lit-333">
下单时间{{InforData.create_time}}
</view>
<view class="lit-333 flex" style="color: #FF7700;" v-if="InforData.status == 0">
{{getStatusStr(InforData.status,InforData.is_evaluate)}}剩余
<u-count-down @change="onChange"
:time="((new Date(InforData.create_time).getTime()) + 30*60*1000 - new Date().getTime())"
@finish="finish">
{{minutes < 10 ?'0'+minutes:minutes}}:{{seconds < 10 ?'0'+seconds:seconds}}
</u-count-down>
<!-- <countDownCom @finish="finish" @onChange="onChange" :time="((new Date(InforData.create_time).getTime()) + 30*60*1000 - new Date().getTime())"></countDownCom> -->
</view>
<view class="lit-333" v-else>
{{getStatusStr(InforData.status,InforData.is_evaluate)}}
</view>
</view>
<view class="item-box flbtn">
<view class="flex">
<u-image width="238rpx" height="178rpx" radius="20rpx" :src="InforData.goods_img"></u-image>
<view class="item-text">
<u-text :text="InforData.goods_name" size="28rpx" color="#333333" :bold="true" lines="1">
</u-text>
<view class="lit-999">
x{{InforData.goods_count}}
</view>
<u-gap height="40rpx"></u-gap>
<view class="price-item" style="font-size: 42rpx;color: #FF2A30;">
<text style="font-size: 22rpx;"></text>{{InforData.pay_price/100}}
</view>
</view>
</view>
<view class="flex" style="align-items: flex-end;">
<view class="" v-if="InforData.status == 0">
<view class="gopay" @click.stop="goOrder(InforData.order_sn)">
去支付
</view>
<view class="gopay cancel" @click.stop="cannelOrder(InforData.order_sn)">
取消订单
</view>
</view>
<view class="" v-if="InforData.status == 1">
<view class="gopay cancel" @click.stop="goOrder(InforData.order_sn)">
查看券码
</view>
</view>
<view class="" v-if="InforData.status == 5 && InforData.is_evaluate == 0">
<view class="gopay" @click.stop="goevaluated(InforData.order_sn)">
去评价
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: "orderListItem",
props: {
item: {
type: Object,
default: {}
},
},
data() {
return {
minutes: 0,
seconds: 0,
InforData: {}
};
},
mounted() {
this['InforData'] = this['item'];
this['InforData']['create_time'] = this['InforData']['create_time'].replace(/-/g,"/");
},
methods: {
goevaluated(or_no) {
uni.navigateTo({
url: '/pages/evaluated/goevaluated?order_sn=' + or_no,
fail(e) {
console.log(e)
}
})
},
goOrder(order_sn) {
uni.navigateTo({
url: '/pages/Pendingpayment/paid?order_sn=' + order_sn
})
},
onChange(e) {
this.minutes = e.minutes
this.seconds = e.seconds
},
finish(e) {
console.log(this['InforData']['order_sn'],'倒计时结束');
this.InforData.status = 4
},
cannelOrder(order_sn) {
let _this = this
uni.showModal({
title: '您确定要取消订单吗',
success(confirm) {
if (confirm.confirm) {
_this.$store.dispatch('api/cancelOrder', {
order_sn: order_sn
}).then(res => {
_this['InforData']['status'] = 4;
//
_this.$emit('OrderCancel', _this['index'])
//_this.getOrder();
})
}
}
})
},
getStatusStr(status, is_evaluate) {
console.log(status, '订单状态-1');
let str = ''
switch (status) {
case 0:
str = '待支付';
break;
case 1:
str = '待使用'
break
case 3:
str = '已退款'
break
case 4:
str = '已取消'
break
case 5:
if (is_evaluate == 0) {
str = '待评价'
}
break;
}
return str;
},
}
}
</script>
<style lang="scss">
.order-box {
margin-top: 20rpx;
.item-box {
margin-top: 20rpx;
.item-text {
margin-left: 20rpx;
max-width: 260rpx;
}
}
.gopay {
font-size: 24rpx;
font-weight: bold;
color: #FF7700;
border-radius: 10rpx;
border: 2rpx solid #FF7700;
text-align: center;
width: 170rpx;
height: 58rpx;
line-height: 58rpx;
margin-bottom: 10rpx;
}
.cancel {
color: #999999;
border: 2rpx solid #999999;
font-weight: normal;
padding-bottom: 0;
}
}
</style>

View File

@ -0,0 +1,77 @@
<template>
<view class="flex" @click="copyThis(item['orderSn'])">
<view style="margin-right: 20rpx;">
<u-image width="170rpx" height="170rpx" :src="item['store_img']"></u-image>
</view>
<view style="width: 100%;">
<view class="flbtn" style="align-items:center;">
<u-text lines="1" color="#333" :text="item['store_name']"></u-text>
<view class="lit-666">
{{item['create_time']}}
</view>
</view>
<view class="flex">
<u-text lines="1" size="24rpx" color="#999" :text="'订单编号:'+item['orderSn']"></u-text>
<view class="">
<text class="iconfont icon-copy" style="margin-left: 10rpx; color: #999; font-size:26rpx;"></text>
</view>
</view>
<view class="lit-999" v-if="type == '2'">
预估佣金{{item['self_commission']}}
</view>
<view class="flbtn">
<view class="lit-999" v-if="type == '2'">
佣金状态{{item['commission_name']}}
</view>
<view class="lit-333 bold">
付款金额{{RetainDecimalPoint(item['amount'])}}
</view>
</view>
</view>
</view>
</template>
<script>
import mixin from "@/static/js/mixin/mixin.js";
export default {
mixins: [mixin],
name: "orderindex-scan-code",
props: {
type: {
type: String,
default: '1'
},
item: {
type: Object,
default: () => {}
}
},
data() {
return {
};
},
methods: {
copyThis(str) {
console.log(str)
uni.setClipboardData({
data: str, //
success: () => { //
uni.showToast({ //
title: "复制成功"
})
},
fail(e) {
console.log(e)
}
});
},
}
}
</script>
<style lang="scss">
.flex {
margin-bottom: 32rpx;
}
</style>

View File

@ -0,0 +1,137 @@
<template>
<picker mode="multiSelector"
:value="multiIndex"
:range="multiArray"
@change="handleValueChange"
@columnchange="handleColumnChange">
<slot></slot>
</picker>
</template>
<script>
const CHINA_REGIONS = require('./regions.json')
export default {
props:{
defaultRegions:{
type:Array,
default(){
return []
}
},
defaultRegionCode:{
type:String
},
defaultRegion:[String,Array]
},
data() {
return {
cityArr:CHINA_REGIONS[0].childs,
districtArr:CHINA_REGIONS[0].childs[0].childs,
multiIndex: [0, 0, 0],
isInitMultiArray:true,
}
},
watch:{
defaultRegion:{
handler(region,oldRegion){
if(Array.isArray(region)){
//
oldRegion = oldRegion || []
if(region.join('')!==oldRegion.join('')){
this.handleDefaultRegion(region)
}
}else if(region&&region.length == 6){
this.handleDefaultRegion(region)
}else{
console.warn('defaultRegion非有效格式')
}
},
immediate:true,
}
},
computed:{
multiArray(){
return this.pickedArr.map(arr=>arr.map(item=>item.name))
},
pickedArr(){
//
if(this.isInitMultiArray){
return [
CHINA_REGIONS,
CHINA_REGIONS[0].childs,
CHINA_REGIONS[0].childs[0].childs
]
}
return [CHINA_REGIONS,this.cityArr,this.districtArr];
}
},
methods: {
handleColumnChange(e){
// console.log(e);
this.isInitMultiArray = false;
const that = this;
let col = e.detail.column;
let row = e.detail.value;
that.multiIndex[col] = row;
try{
switch(col){
case 0:
if(CHINA_REGIONS[that.multiIndex[0]].childs.length==0){
that.cityArr = that.districtArr = [CHINA_REGIONS[that.multiIndex[0]]]
break;
}
that.cityArr = CHINA_REGIONS[that.multiIndex[0]].childs
that.districtArr = CHINA_REGIONS[that.multiIndex[0]].childs[that.multiIndex[1]].childs
break;
case 1:
that.districtArr = CHINA_REGIONS[that.multiIndex[0]].childs[that.multiIndex[1]].childs
break;
case 2:
break;
}
}catch(e){
// console.log(e);
that.districtArr = CHINA_REGIONS[that.multiIndex[0]].childs[0].childs
}
},
handleValueChange(e){
//
let [index0,index1,index2] = e.detail.value;
let [arr0,arr1,arr2] = this.pickedArr;
let address = [arr0[index0],arr1[index1],arr2[index2]];
// console.log(address);
this.$emit('getRegion',address)
},
handleDefaultRegion(region){
const isCode = !Array.isArray(region)
this.isInitMultiArray = false;
let children = CHINA_REGIONS
for(let i=0;i<3;i++){
for(let j=0;j<children.length;j++){
let condition = isCode?children[j].code==region.slice(0,(i+1)*2):children[j].name.includes(region[i]);
if(condition){
//
// console.log(i,j,children.length-1);
children = children[j].childs;
if(i==0){
this.cityArr = children
}else if(i==1){
this.districtArr = children
}
this.$set(this.multiIndex,i,j)
// console.log(this.multiIndex);
break;
}else{
//
// console.log(i,j,children.length-1);
if(i==0 && j==(children.length-1)){
this.isInitMultiArray = true;
}
}
}
}
}
},
}
</script>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,109 @@
<template>
<picker @change="bindPickerChange" @columnchange="columnchange" :range="array" range-key="name" :value="value" mode="multiSelector">
<slot></slot>
</picker>
</template>
<script>
// import AllAddress from '../../static/js/data.js';
let AllAddress;
let selectVal = ['','','']
import { regionList } from "@/common/api/api.js"
export default {
data() {
return{
value: [0,0,0],
array: [],
index: 0
}
},
created() {
regionList().then(res=>{
AllAddress = res;
console.log(AllAddress,'AllAddress');
this.initSelect()
})
},
methods:{
//
initSelect() {
this.updateSourceDate() //
.updateAddressDate() //
.$forceUpdate() //
},
//
columnchange(d) {
this.updateSelectIndex(d.detail.column, d.detail.value) //
.updateSourceDate() //
.updateAddressDate() //
.$forceUpdate() //
},
/**
* 更新源数据
* */
updateSourceDate() {
this.array = []
this.array[0] = AllAddress.map(obj => {
return {
name: obj.name
}
})
this.array[1] = AllAddress[this.value[0]].city.map(obj => {
return {
name: obj.name
}
})
this.array[2] = AllAddress[this.value[0]].city[this.value[1]].area.map(obj => {
return {
name: obj
}
})
return this
},
/**
* 更新索引
* */
updateSelectIndex(column, value){
let arr = JSON.parse(JSON.stringify(this.value))
arr[column] = value
if(column === 0 ) {
arr[1] = 0
arr[2] = 0
}
if(column === 1 ) {
arr[2] = 0
}
this.value = arr
return this
},
/**
* 更新结果数据
* */
updateAddressDate() {
selectVal[0] = this.array[0][this.value[0]].name
selectVal[1] = this.array[1][this.value[1]].name
selectVal[2] = this.array[2][this.value[2]].name
return this
},
/**
* 点击确定
* */
bindPickerChange(e) {
this.$emit('change', {
index: this.value,
data: selectVal
})
return this
}
}
}
</script>
<style>
</style>

View File

@ -0,0 +1,140 @@
<template>
<view>
<view v-show="ifshow" @tap="ableClose" @touchmove.stop.prevent class="popup-layer" >
</view>
<view ref="popRef" class="popup-content" @tap.stop="stopEvent" :style="_location">
<slot></slot>
</view>
</view>
</template>
<script>
export default {
name: 'popup-layer',
model: {
prop: "showPop",
event: "change"
},
props: {
showPop:{
type:Boolean,
default:false,
},
direction: {
type: String,
default: 'top', // topbottomleftright
},
autoClose: {
type: Boolean,
default: true,
}
},
data() {
return {
ifshow: false, // ,
translateValue: -100, //
site:-100,
timer: null,
iftoggle: false,
};
},
computed: {
_translate() {
const transformObj = {
'top': `transform:translateY(${-this.translateValue}%)`,
'bottom': `transform:translateY(${this.translateValue}%)`,
'left': `transform:translateX(${-this.translateValue}%)`,
'right': `transform:translateX(${this.translateValue}%)`
};
return transformObj[this.direction]
},
_location() {
const positionValue = {
'top': `bottom:${this.site}%;width:100%;`,
'bottom': `top:${this.site}%;width:100%;`,
'left': `right:0px;top:0;height:100%;`,
'right': `left:0px;top:0;height:100%;`,
};
return positionValue[this.direction]+ this._translate;
}
},
mounted(){
if(this.showPop){
// console.log(222);
this.show();
}
},
watch:{
showPop(value){
console.log(value)
if(value){
this.show();
}else{
this.close();
}
}
},
methods: {
stopMove(event){
return;
},
show(events) {
this.ifshow = true;
this.site=0;
let _open = setTimeout(() => {
this.translateValue = 0;
_open = null;
}, 100)
let _toggle = setTimeout(() => {
this.iftoggle = true;
_toggle = null;
}, 300);
},
close() {
if (this.timer !== null || !this.iftoggle) {
return;
}
this.translateValue = -100;
this.timer = setTimeout(() => {
this.ifshow = false;
this.timer = null;
this.iftoggle = false;
this.$emit('closeCallBack', null);
this.$emit('change',false)
}, 300);
},
ableClose() {
if (this.autoClose) {
this.close();
}
},
stopEvent(event) {},
doSome(){
}
}
}
</script>
<style lang="scss">
.popup-layer {
position: fixed;
z-index: 999999;
// background: rgba(0, 0, 0, .3);
height: 100%;
width: 100%;
top: 0px;
left: 0px;
overflow: hidden;
}
.popup-content {
position: fixed;
z-index: 1000000;
background: #FFFFFF;
transition: transform .2s ease;
overflow: hidden;
}
</style>

View File

@ -0,0 +1,62 @@
<template>
<view>
<u-modal :show=showModal :showConfirmButton="false" >
<image src='https://img.agrimedia.cn/rechareImg.png'></image>
<text @click="know" class="knowSty">我知道了</text>
</u-modal>
</view>
</template>
<script>
export default {
name:"rechareModal",
data() {
return {
}
},
props:{
showModal:{
type:Boolean,
},
},
data() {
return {
};
},
methods:{
know(e){
this.$emit('knowClick',e)
}
}
}
</script>
<style scoped lang="scss">
/deep/ .u-modal__content{
flex-direction: column;
image{
width: 100%;
height: 540rpx
}
.knowSty{
width: 272rpx;
height: 88rpx;
line-height: 88rpx;
background: linear-gradient(180deg, #FFAF00 0%, #FF7700 100%);
border-radius: 44rpx;
font-size: 28rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #FFFFFF;
position: absolute;
bottom: 60rpx;
left: 50%;
transform: translateX(-50%);
text-align: center;
}
}
</style>

View File

@ -0,0 +1,59 @@
<template>
<view class="recharge-Service">
<view class="recharge-Service-Logo">
<image class="img" :src="logo" mode=""></image>
</view>
<view class="recharge-Service-Title">
{{title}}
</view>
</view>
</template>
<script>
/**
* @param { logo } 服务商logo
* @param { title } 服务商名称
* */
export default {
name: "recharge-Service",
props: {
logo: {
type: String,
default: "http://b2dfdc47e670.66bbn.com/uploads/20210323/33f88897865b9a85c1ac16faa388cd2e.png"
},
title: {
type: String,
default: "爱奇艺视频"
}
},
data() {
return {};
}
}
</script>
<style lang="scss" scoped>
.recharge-Service {
background: linear-gradient(90deg, #FFFDF8, #F9EECC);
height: 200rpx;
padding: 0 20rpx;
display: flex;
align-items: center;
&-Logo {
width: 100rpx;
height: 100rpx;
.img {
width: 100%;
height: 100%;
}
}
&-Title {
font-size: 40rpx;
font-weight: bold;
padding-left: 20rpx;
}
}
</style>

View File

@ -0,0 +1,43 @@
<template>
<view class="recharge-Type">
<view class="recharge-Type-Tile flbtn">
<view class="big-333 bold">
{{title}}
</view>
</view>
<!-- <view class="goods-type" style="padding-top: 20rpx;">
<view :class="'title '+ (v == activeName?'active':'')" v-for="(v,index) in spce" :key="index"
@click="activeType(index,v)">
{{v}}
</view>
</view> -->
</view>
</template>
<script>
export default {
name: "recharge-Type",
props: {
title: {
type: String,
default: '充值类型'
}
},
data() {},
watch: {}
}
</script>
<style lang="scss" scoped>
.recharge-Type {
background-color: #fff;
padding: 20rpx;
margin-top: 20rpx;
// display: grid;
// grid-template-columns: auto auto;
// grid-gap: 20rpx;
&-Tile {}
}
</style>

View File

@ -0,0 +1,77 @@
<template>
<view class="recharge-User">
<view class="recharge-User-Title flbtn">
<view class="big-333 bold">
{{text}}
</view>
<view class="recharge-User-Hint lit-333">
*请确认账号信息充值成功后不支持退换
</view>
</view>
<view class="" style="padding-top: 20rpx;">
<u-input fontSize="46rpx" :type="inputtype" border="none" v-model="modelvalue" :placeholder="placeholder"></u-input>
</view>
</view>
</template>
<script>
/**
* @param { value } 组件接收值
* @param { placeholder } 组件占位文字
* */
export default {
name: "recharge-User",
props: {
value: {
type: [String,Number],
default: ''
},
placeholder: {
type: String,
default: ''
},
inputtype:{
type:String,
default:'text'
},
//
text:{
type:String,
default:'充值账号'
}
},
data() {
return {
account: ''
};
},
computed: {
modelvalue:{
get() {
return this['value'];
},
set(value) {
this.$emit('input', value)
}
}
},
}
</script>
<style lang="scss" scoped>
.recharge-User {
background-color: #fff;
padding: 20rpx;
margin-top: 20rpx;
&-Title {
padding-bottom: 20rpx;
border-bottom: 2rpx solid #EDEDED;
}
&-Hint {
color: #FF2A30 !important;
}
}
</style>

View File

@ -0,0 +1,6 @@
# recharge组件文件说明
## 该组件文件存储的是充值模块的组件
## 充值服务商组件 Recharge-Service
## 充值面额 Recharge-Amount
## 充值类型 Recharge-Type
## 充值账号输入 Recharge-User

View File

@ -0,0 +1,680 @@
<template>
<view class="common-car">
<view class="empty-shop-car" v-if="isEmpty">
<image src="../../static/empty_shop_car.png" class="empty-shop-car-image" mode=""></image>
<text>当前您的购物车是空的</text>
<view class="empty-shop-car-btn" @click="goIndex">
<text style="color: #fff;">去逛逛</text>
</view>
</view>
<view class="shop-car" v-else>
<view class="shop-car-header">
<text @tap="cut">{{isCut?'管理':'完成'}}</text>
</view>
<view class="store-box" v-for="(itemq,indexq) in datas" :key="indexq">
<view class="store-header">
<image src="../../static/selects.png" v-if="itemq.checked == 2" class="checked-image" mode=""
@tap="storeCheck(indexq,itemq.checked)"></image>
<image src="../../static/not_select.png" v-else class="checked-image" mode=""
@tap="storeCheck(indexq,itemq.checked)">
</image>
<text class="shop_title">{{itemq.name}}</text>
<image src="../../static/youjiantou1.png" class="label" mode=""></image>
</view>
<view class="goodsInfo" v-for="(itemw,indexw) in itemq.goods" :key="indexw">
<image src="../../static/selects.png" v-if="itemw.checked == 2" class="checked-image" mode=""
@tap="goodsCheck(indexq,indexw,itemw.checked)"></image>
<image src="../../static/not_select.png" v-else class="checked-image" mode=""
@tap="goodsCheck(indexq,indexw,itemw.checked)"></image>
<view class="goodsInfo-right">
<image :src="itemw.img" class="goods-image"></image>
<view class="goodsInfo-box">
<view class="goods-mid">
<view class="goods-name">{{itemw.title}}</view>
<view class="goods-price">
<text>¥{{itemw.price/100}}</text>
<text class="goods-original">{{itemw.originalPrice/100}}</text>
</view>
</view>
<!-- <text class="spe">规格{{itemw.remark}}</text> -->
<view class="goods-box">
<view class="goods-num-box">
<view class="goods-image" @tap="sub(indexq,indexw,itemw.number,itemw.goods_id)">
<text :class="itemw.number == 1? 'goods-ban':''">-</text>
</view>
<view class="goods-num">
<text>{{itemw.number}}</text>
</view>
<view class="goods-image" @tap="add(indexq,indexw,itemw.number,itemw.goods_id)">
<text>+</text>
</view>
</view>
</view>
</view>
<view class="icon" v-if="itemw.is_kill == -1000">
<u-icon width="60rpx" height="60rpx" name="https://img.agrimedia.cn/chwl/v2/seckill-icon.png"></u-icon>
</view>
</view>
</view>
<!-- <u-gap height="100rpx"></u-gap> -->
</view>
<view class="statistics-box">
<view class="statistics">
<view class="statistics-left" v-if="statisticsIndex" @tap="allCheck">
<image src="../../static/selects.png" class="checked-image" mode="">
</image>
<text class="all-check">全选</text>
</view>
<view class="statistics-left" v-else @tap="allCheck">
<image src="../../static/not_select.png" class="checked-image" mode="">
</image>
<text class="all-check">全选</text>
</view>
<view class="statistics-right" v-if="isCut" @tap="accounts">
<view class="">
<text class="all">总计</text>
<text class="text-icon">¥</text>
<text class="text-color">{{total/100}}</text>
</view>
<view class="btn">
<text>结算</text>
</view>
</view>
<view class="statistics-right" v-else @tap="delect">
<view class="btn">
<text>删除</text>
</view>
</view>
</view>
<view class="gap"></view>
</view>
</view>
<slot></slot>
</view>
</template>
<script>
export default {
name: "commonCar",
data() {
return {
// isEmpty: true,
iPhoneX: false,
statisticsIndex: false,
total: 0,
isCut: true,
// datas:[]
}
},
props: {
list: {
type: [Object, Array],
default: {}
}
},
computed: {
isEmpty() {
return this.list.length == 0
},
datas: {
get() {
return this.list
},
set(e) {
console.log(e)
}
}
},
created() {
// console.log(this.list,'this list')
// if (this.list.length == 0) {
// this.isEmpty = true
// } else {
// this.datas = this.list
// this.isEmpty = false
// }
// console.log(this.list,'this list')
// console.log(this.datas,'this datas')
},
methods: {
goIndex(){
this.$store.commit('tabbar/setCurrent',0)
uni.reLaunch({
url:"/pages/index/index"
})
},
//
goodsCheck(storeIndex, goodsIndex, goodsChecked) {
if (goodsChecked == 1) {
this.datas[storeIndex].goods[goodsIndex].checked = 2
} else {
this.datas[storeIndex].goods[goodsIndex].checked = 1
}
//
let storeChecked = true
this.datas[storeIndex].goods.map((item, index) => {
if (item.checked == 1) {
storeChecked = false
}
})
if (storeChecked == false) {
this.datas[storeIndex].checked = 1
} else {
this.datas[storeIndex].checked = 2
}
//
let statisticsIndex = true
this.datas.find((item, index) => {
if (item.checked == 1) {
statisticsIndex = false
}
})
if (statisticsIndex == false) {
this.statisticsIndex = false
} else {
this.statisticsIndex = true
}
this.statistics()
},
//
storeCheck(storeIndex, storeCheck) {
if (storeCheck == 1) {
this.datas[storeIndex].checked = 2
this.datas[storeIndex].goods.find((item, index) => {
item.checked = 2
})
} else {
this.datas[storeIndex].checked = 1
this.datas[storeIndex].goods.find((item, index) => {
item.checked = 1
})
}
//
let statisticsIndex = true
this.datas.find((item, index) => {
if (item.checked == 1) {
statisticsIndex = false
}
})
if (statisticsIndex == false) {
this.statisticsIndex = false
} else {
this.statisticsIndex = true
}
this.statistics()
},
//
sub(storeIndex, goodsIndex, goodsnum,goods_id) {
if (goodsnum == 1) {
return
} else {
this.$store.dispatch('api/goodsAddCart',{
goods_id:goods_id,
num:(goodsnum-1)
}).then(res => {
this.datas[storeIndex].goods[goodsIndex].number--
})
}
this.statistics()
},
//
add(storeIndex, goodsIndex, goodsnum,goods_id) {
this.$store.dispatch('api/goodsAddCart',{
goods_id:goods_id,
num:(goodsnum+1)
}).then(res => {
this.datas[storeIndex].goods[goodsIndex].number++
})
this.statistics()
},
//
allCheck() {
if (this.statisticsIndex) {
this.datas.find((item, index) => {
item.checked = 1
item.goods.find((itemq, indexq) => {
itemq.checked = 1
})
})
this.statisticsIndex = false
} else {
this.datas.find((item, index) => {
item.checked = 2
item.goods.find((itemq, indexq) => {
itemq.checked = 2
})
})
this.statisticsIndex = true
}
this.statistics()
},
//
statistics() {
let total = 0
console.log(this.datas, 'this data')
this.datas.find((item, index) => {
item.goods.find((itemq, indexq) => {
if (itemq.checked == 2) {
total = total + itemq.price * itemq.number
}
})
})
this.total = total.toFixed(2)
},
cut() {
this.isCut = !this.isCut
this.statisticsIndex = true
this.allCheck()
},
accounts() {
let judge = this.judgeSelect()
if (judge) {
this.$emit('accounts', this.datas)
} else {
uni.showToast({
title: '您当前未选择任何商品,结算失败',
icon: 'none'
})
}
},
delect() {
let judge = this.judgeSelect()
if (judge) {
let ids = this.checkedIds()
this.$store.dispatch('api/delCartGoods',{
cart_ids:ids
}).then(res => {
this.$emit('delect', this.datas)
})
} else {
uni.showToast({
title: '您当前未选择任何商品,删除失败',
icon: 'none'
})
}
},
checkedIds(){
let arr = []
this.datas.find((item, index) => {
item.goods.find((itemq, indexq) => {
if (itemq.checked == 2) {
arr.push(itemq.cart_id)
}
})
})
return arr
},
judgeSelect() {
let judge = false
this.datas.find((item, index) => {
item.goods.find((itemq, indexq) => {
if (itemq.checked == 2) {
judge = true
}
})
})
return judge
}
}
}
</script>
<style lang="scss" scoped>
.common-car {
width: 750rpx;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
background: #F5F5F5;
}
.empty-shop-car {
width: 750rpx;
min-height: 680rpx;
display: flex;
flex-direction: column;
align-items: center;
.empty-shop-car-image {
width: 340rpx;
height: 278rpx;
margin-top: 102rpx;
}
text {
margin-top: 40rpx;
font-size: 28rpx;
font-weight: 400;
color: #666666;
}
.empty-shop-car-btn {
width: 240rpx;
height: 90rpx;
background: #FF4D02;
border-radius: 200rpx;
margin-top: 40rpx;
text-align: center;
line-height: 90rpx;
font-size: 30rpx;
font-weight: 400;
color: #313133;
}
}
.shop-car {
width: 750rpx;
display: flex;
flex-direction: column;
align-items: center;
.shop-car-header {
width: 690rpx;
height: 80rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
text {
font-size: 28rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #666666;
line-height: 40rpx;
}
}
.store-box {
width: 690rpx;
margin-bottom: 20rpx;
display: flex;
flex-direction: column;
align-items: center;
background-color: #FFFFFF;
border-radius: 20rpx;
.store-header {
width: 690rpx;
height: 78rpx;
padding: 0 30rpx;
display: flex;
flex-direction: row;
align-items: center;
font-size: 28rpx;
font-weight: 400;
color: #313133;
.checked-image {
width: 36rpx;
height: 36rpx;
flex-shrink: 0;
}
text {
font-size: 28rpx;
font-weight: 400;
color: #313133;
margin-left: 20rpx;
}
.label {
width: 14rpx;
height: 24rpx;
margin-left: 10rpx;
margin-top: 5rpx;
}
.shop_title {
font-size: 32rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #333333;
line-height: 44rpx;
letter-spacing: 2rpx;
}
}
.goodsInfo {
width: 100%;
height: 246rpx;
display: flex;
flex-direction: row;
align-items: center;
padding: 0rpx 20rpx;
&:nth-last-child(1) {
border: none;
}
.checked-image {
width: 36rpx;
height: 36rpx;
border-radius: 10rpx;
flex-shrink: 0;
}
.goodsInfo-right {
width: 634rpx;
height: 246rpx;
margin-left: 20rpx;
display: flex;
flex-direction: row;
align-items: center;
position: relative;
.icon{
width: 60rpx;
height: 60rpx;
border-radius: 50%;
position: absolute;
left: 0rpx;
top: 40rpx;
}
.goods-image {
width: 180rpx;
height: 180rpx;
border-radius: 20rpx;
flex-shrink: 0;
}
.goodsInfo-box {
width: 428rpx;
margin-left: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
.goods-name {
// width: 428rpx;
font-size: 28rpx;
font-weight: 400;
color: #313133;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #333333;
letter-spacing: 2rpx;
margin-bottom: 32rpx;
}
.goods-price {
font-size: 28rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #FF2A30;
line-height: 40rpx;
letter-spacing: 2rpx;
.goods-original {
font-size: 24rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 34rpx;
padding-left: 12rpx;
text-decoration:line-through;
}
}
.spe {
width: 428rpx;
margin-top: 10rpx;
font-size: 24rpx;
font-weight: 400;
color: #919298;
}
.goods-box {
// width: 428rpx;
margin-top: 18rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
margin-left: 10rpx;
.goods-num-box {
width: 168rpx;
height: 46rpx;
display: flex;
flex-direction: row;
align-items: center;
margin-right: 20rpx;
.goods-image {
width: 44rpx;
height: 44rpx;
background: #F6F6F6;
border-radius: 10rpx;
line-height: 38rpx;
text-align: center;
text {
color: #666666;
}
.goods-ban {
color: #C7C7C7;
}
}
.goods-num {
width: 76rpx;
height: 44rpx;
font-size: 28rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
line-height: 40rpx;
letter-spacing: 2rpx;
text-align: center;
color: #333333;
}
}
}
}
}
}
}
.statistics-box {
width: 750rpx;
display: flex;
flex-direction: column;
align-items: center;
background-color: #FFFFFF;
position: fixed;
bottom: 82rpx;
.statistics {
width: 720rpx;
padding: 0 0 0 30rpx;
height: 132rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
.statistics-left {
width: 120rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
image {
width: 36rpx;
height: 36rpx;
}
text {
font-size: 30rpx;
font-weight: 400;
color: #313133;
}
.all-check {
font-size: 28rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #666666;
line-height: 40rpx;
letter-spacing: 2rpx;
}
}
.statistics-right {
width: 600rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
.all {
font-size: 28rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #666666;
line-height: 40rpx;
letter-spacing: 2rpx;
}
.btn {
width: 176rpx;
height: 88rpx;
background: #FF7700;
border-radius: 20rpx;
text-align: center;
color: #FFFFFF;
font-size: 28rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
line-height: 88rpx;
margin-left: 20rpx;
}
text {
font-size: 30rpx;
font-weight: 400;
color: #fff;
}
.text-icon {
font-size: 22rpx;
color: rgba(242, 18, 18, 1);
}
.text-color {
color: rgba(242, 18, 18, 1);
font-size: 44rpx;
font-weight: 600;
}
}
}
.gap {
width: 750rpx;
height: 40rpx;
}
}
}
</style>

View File

@ -0,0 +1,33 @@
<template>
<view>
<u-gap height="20"></u-gap>
<u-skeleton title loading titleWidth="20%"></u-skeleton>
<u-gap height="20"></u-gap>
<u-skeleton title loading titleWidth="100%" titleHeight="400rpx"></u-skeleton>
<view class="flex flex-space-between" style="padding: 30rpx;" v-for="(v,i) in ['1','1']" :key="i">
<view class="" style="width: 15%;" v-for="(item,index) in ['1','1','1','1','1']" :key="index">
<view style="padding-left: 14rpx;">
<u-skeleton avatarSize="80rpx" loading avatar :title="false">
</u-skeleton>
</view>
<u-gap height="10"></u-gap>
<u-skeleton title loading titleWidth="100%"></u-skeleton>
</view>
</view>
</view>
</template>
<script>
export default {
name:"skeleton-index",
data() {
return {
};
}
}
</script>
<style>
</style>

View File

@ -0,0 +1,23 @@
<template>
<view>
<view style="margin-left: 20rpx;" @click="showPopup = true">
<u-icon width="40rpx" height="40rpx" name="https://img.agrimedia.cn/chwl%2Findex%2Fshaixuan.png">
</u-icon>
</view>
</view>
</template>
<script>
export default {
name:"startEndTime",
data() {
return {
};
}
}
</script>
<style>
</style>

View File

@ -0,0 +1,212 @@
<template>
<div class="account-wrap">
<!-- 登陆 -->
<div class="login-box">
<div class="list" >
<div class="name">国家和地区</div>
<div class="value">中国大陆</div>
</div>
<div class="list" @tap="focus('phone')">
<div class="name">+86</div>
<div class="value">
<text :class="{'show-bl':borderFor=='phone' && !login.phone, 'show-br':borderFor=='phone' && login.phone}">{{login.phone || '请输入手机号'}}</text>
</div>
</div>
<div class="list" @tap="focus('idcard')">
<div class="name">身份证号</div>
<div class="value">
<text :class="{'show-bl':borderFor=='idcard' && !login.idcard, 'show-br':borderFor=='idcard' && login.idcard}">{{login.idcard || '请输入身份证'}}</text>
</div>
</div>
<div class="list" @tap="focus('plateNumber')">
<div class="name">车牌号</div>
<div class="value">
<text :class="{'show-bl':borderFor=='plateNumber' && !login.plateNumber, 'show-br':borderFor=='plateNumber' && login.plateNumber}">{{login.plateNumber || '请输入车牌号'}}</text>
</div>
</div>
<div class="list" @tap="focus('checkcode')">
<div class="name">验证码</div>
<div class="value flex">
<text :class="{'show-bl':borderFor=='checkcode' && !login.checkcode, 'show-br':borderFor=='checkcode' && login.checkcode}">{{login.checkcode || '请输入验证码'}}</text>
<div class="send-btn" :class="{sending:loginCodeText!=='发送验证码'}" @tap="sendMsg(0)" v-text="loginCodeText=='发送验证码' ? loginCodeText : loginCodeText+'(s)'"></div>
</div>
</div>
<div class="submit" @tap="submit(0)" >登陆</div>
<!-- <div class="login-type">
<p>使用第三方登录</p>
<image src="/static/img/qq.png" @tap="login"></image>
<image src="/static/img/wechat.png"></image>
</div> -->
</div>
<keyboard-package :disableDot="true" :type="keyboardType" @input="inputVal" ref="keyboard"></keyboard-package>
</div>
</template>
<script>
// import { loginByPhone, getCode } from '@/api/api.js'
import keyboardPackage from '@/components/keyboard-package/keyboard-package.vue'
export default {
components:{keyboardPackage},
data () {
return {
borderFor:false, //
keyboardFor: false, //
loginCodeText:'发送验证码',
keyboardType: 1, // 1- 2- 3-
timer:false, //
login:{
classfy:1,
type:1,
idcard:'',
phone:'', //
checkcode:'' ,//
plateNumber:'' //
},
}
},
methods: {
focus ( type ) {
let typeArr = {
phone: 1,
checkcode:1,
idcard: 2,
plateNumber: 3
}
if(this.borderFor != type) {
this.keyboardFor = type
this.keyboardType = typeArr[type]
clearInterval(this.timer)
this.timer = setInterval(()=>{
this.borderFor = this.borderFor == type ? false : type
},500)
}
this.$refs.keyboard.open()
},
inputVal ( val ) {
val = val.toString()
let key = this.keyboardFor
let _this = this
const writeValue = (key, maxlength)=>{
let len = _this.login[key].length
if(!val){
_this.login[key] = _this.login[key].substring(0, len-1)
return
}
if(len === maxlength) return
_this.login[key] += val
}
const funArr = {
phone () {
writeValue (key, 11)
},
idcard () {
writeValue (key, 18)
},
plateNumber () {
writeValue (key, 7)
},
checkcode () {
writeValue (key, 6)
}
}
funArr[key]()
},
//
sendMsg ( type ) {
//
let regPhone = /^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/
if( !regPhone.test(this.login.phone) ){
uni.showToast({
title:'您的手机号输入不合法',
icon:'none'
})
return
}
// getCode({userid:this.login.phone,classfy:1})
// .then(res=>{
// this.log(res)
// let icon = 'none'
// let title = res.msg
// if( res.code === '200' ){
// icon = 'succes'
// title = ''
// this.loginCodeText = 60
// this.timer = setInterval(()=> {
// this.loginCodeText -= 1
// if( this.loginCodeText === 0){
// clearInterval(this.timer)
// this.loginCodeText = ''
// }
// }, 1000)
// }
// uni.showToast({title,icon})
// })
},
//
submit ( type ) {
//
let regPhone = /^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/
if( !regPhone.test(this.login.phone) ){
uni.showToast({
title:'您的手机号输入不合法',
icon:'none'
})
return
}
let code = /^\d{6}$/
if(!this.login.checkcode || !code.test(this.login.checkcode)){
uni.showToast({
title:'验证码填写有误',
icon:'none'
})
return
}
//
}
}
}
</script>
<style scoped lang="scss">
.account-wrap{
.change-bar div{
width: 50%;text-align: center;color: #777;padding: 3px 0;
}
.login-box{
margin-top: 10px;
}
.line{
width: 40%;left: 5%;top: 45px;background:#A7CF2B;height: 2px;position: fixed;border-radius: 5px;
}
.list{
border-bottom: 1px solid #efefef;color: #777; padding: 5px 10px;margin: 5px auto;
display: flex;justify-content: space-between;align-items: center;font-size: .9rem;
.name{
width: 32%;
}
.value{
width: 68%;
text{border: 4upx solid transparent;}
.show-bl{border-left-color:#ccc}
.show-br{border-right-color:#ccc}
.send-btn{
width:50%;font-size: .8rem;text-align: center;
color: #A7CF2B;
}
.sending{color: #ccc !important;}
}
}
.submit{
width: 80%;padding: 8px 0;margin: 40px auto;background: #A7CF2B;text-align: center;
color: #fff;border-radius: 20px;box-shadow: 0 0 3px 1px #ccc;
}
.login-type{
text-align: center;color: #777;font-size: .7rem;
image{width: 30px;height: 30px;margin: 5px 10px;}
}
}
</style>

View File

@ -0,0 +1,106 @@
<template>
<view class="u-page">
<view class="u-page__item">
<u-tabbar :zIndex="99999" :value="thisChecked" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true"
activeColor="#FF4D03">
<template v-for="(item,index) in tabs">
<u-tabbar-item :key="index" :text="item['title']" :icon="item['icon']" @click="setCurrent(index)"></u-tabbar-item>
</template>
</u-tabbar>
</view>
</view>
</template>
<script>
import {
mapGetters,
mapMutations
} from 'vuex'
export default {
name: "tabbars",
data() {
return {
tabs: [{
title: '首页',
icon: 'home-fill',
url: '/pages/index/index'
},
{
title: '分类',
icon: 'grid-fill',
url: '/pages/sort/sort'
},
{
title: '购物车',
icon: 'shopping-cart-fill',
url: '/pages/myCart/myCart'
},
{
title: '我的',
icon: 'account-fill',
url: '/pages/uCenter/uCenter'
}
],
tabbarsHeight: 0,
};
},
computed: {
...mapGetters({
thisChecked: 'tabbar/thisChecked',
}),
},
mounted() {
let self = this;
// uni-appuni.createSelectorQuery,my.createSelectorQuery,使,
// #ifdef MP-ALIPAY
this.$nextTick(() => {
my.createSelectorQuery()
.select('.u-tabbar__content').boundingClientRect()
.selectViewport().scrollOffset().exec((ret) => {
console.log(ret, '信息2');
self['tabbarsHeight'] = ret[0]['height']
})
})
// #endif
},
watch:{
thisChecked(val){
uni.switchTab({
url: this['tabs'][val]['url']
});
}
},
methods: {
...mapMutations({
setCurrent: 'tabbar/setCurrent'
}),
}
}
</script>
<style lang="scss">
.u-page {
padding: 0;
&__item {
&__title {
color: $u-primary;
background-color: $u-primary;
padding: 15px;
font-size: 15px;
&__slot-title {
color: $u-primary;
font-size: 14px;
}
}
&__slot-icon {
width: 17px;
height: 17px;
}
}
}
</style>

View File

@ -0,0 +1,100 @@
<template>
<view class="u-page">
<view class="u-page__item">
<u-tabbar :zIndex="99999" :value="thisChecked" @change="changeTargets" :fixed="true" :placeholder="true"
:safeAreaInsetBottom="true" activeColor="#FF4D03">
<u-tabbar-item text="首页" icon="https://img.agrimedia.cn/chwl/v2/sy.png">
</u-tabbar-item>
<u-tabbar-item text="分类" icon="https://img.agrimedia.cn/chwl/v2/fl.png"></u-tabbar-item>
<u-tabbar-item text="购物车" icon="https://img.agrimedia.cn/chwl/v2/gwc.png"></u-tabbar-item>
<u-tabbar-item text="我的" icon="https://img.agrimedia.cn/chwl/v2/wd-active.png"></u-tabbar-item>
</u-tabbar>
</view>
</view>
</template>
<script>
import {
mapGetters,
mapMutations
} from 'vuex'
export default {
name: "tabbars",
data() {
return {
link: [
'/pages/index/index',
'/pages/sort/sort',
'/pages/myCart/myCart',
'/pages/uCenter/uCenter',
],
};
},
computed: {
...mapGetters({
thisChecked: 'tabbar/thisChecked',
}),
},
created() {
let routes = getCurrentPages(); //
let curRoute = routes[routes.length - 1].route //
if(curRoute == 'pages/index/index'){
this.setCurrent(0)
}
if(curRoute == 'pages/sort/sort'){
this.setCurrent(1)
}
if(curRoute == 'pages/myCart/myCart'){
this.setCurrent(2)
}
if(curRoute == 'pages/uCenter/uCenter'){
this.setCurrent(3)
}
console.log(curRoute,'tabbar')
},
methods: {
...mapMutations({
setCurrent: 'tabbar/setCurrent'
}),
changeTargets(e) {
console.log(e, 'changeTargets')
this.setCurrent(e)
uni.reLaunch({
url: this.link[e],
complete(res) {
console.log(res)
}
})
// name => value6 = name
}
}
}
</script>
<style lang="scss">
.u-page {
padding: 0;
&__item {
&__title {
color: $u-primary;
background-color: $u-primary;
padding: 15px;
font-size: 15px;
&__slot-title {
color: $u-primary;
font-size: 14px;
}
}
&__slot-icon {
width: 17px;
height: 17px;
}
}
}
</style>

View File

@ -0,0 +1,52 @@
<template>
<view>
<view class="top">
<u-cell-group>
<u-cell
:title="this.title"
:value="this.value"
:isLink = "this.isLink"
@click="cellClick"
></u-cell>
</u-cell-group>
</view>
</view>
</template>
<script>
export default {
name:"tagsTitle",
props:{
title:{
type:String,
default:""
},
value:{
type:String,
default:"切换"
},
isLink:{
type:Boolean,
default:true
}
},
data() {
return {
};
},
methods:{
cellClick(e){
this.$emit('cellClick',e)
}
}
}
</script>
<style>
.top{
background-color: #FFFFFF;
border-top-left-radius: 30rpx;
border-top-right-radius: 30rpx;
}
</style>

View File

@ -0,0 +1,216 @@
<template>
<view>
<view class="group-box">
<view class="flex" style="padding: 20rpx;" @click="goFansInfo">
<u-avatar size="127rpx" :src="detail.user_thumbnail"></u-avatar>
<view style="width: 100%;padding-left: 20rpx;">
<view class="flex flex-space-between">
<view class="flex" style="padding-top: 20rpx;">
<view class="big-333 bold">
{{detail.u_nickname}}
</view>
<view style="margin-left: 10rpx;padding-top: 4rpx;">
<u-image width="100rpx" height="36rpx" :src="'/static/icon/level/v'+(detail.u_level+1)+'.png'"></u-image>
</view>
</view>
<view class="lit-666" style="padding-top: 20rpx;">
{{detail.createtime?detail.createtime.substr(0,10):''}}
</view>
</view>
<u-gap height="20rpx"></u-gap>
<view class="flex flex-space-between">
<view class="tab-box">
<text v-if="isHideScan == 0">{{detail.is_scan}}</text>
<text v-if="showTj == false" @click="showTjx">推荐人</text>
</view>
<view class="">
<text class="lit-333">邀请码</text>
<text class="lit-666">{{detail.invite_code}}</text>
<text class="iconfont icon-copy" @click.stop="copyThis(detail.invite_code)"
style=" margin-left: 19rpx; color: #666; font-size:24rpx;"></text>
</view>
</view>
</view>
</view>
<view v-if="showTj" class="flex flex-space-between" style="margin: 0 60rpx;">
<view class="box-nr">
<view class="t-tt">
订单量
</view>
<view class="t-vl">
{{detail.order_count}}
</view>
</view>
<view class="box-nr">
<view class="t-tt">
下级粉丝
</view>
<view class="t-vl">
{{detail.fans_count}}
</view>
</view>
<view class="box-nr">
<view class="t-tt">
累计收益
</view>
<view class="t-vl">
{{detail.total_amount/100}}
</view>
</view>
</view>
</view>
<u-popup bgColor="transparent" :show="showPopup" @close="showPopup = false" mode="center">
<view class="alt-box">
<view class="big-333 bold">
推荐人信息
</view>
<view class="tx">
<u-image radius="50%" width="125rpx" height="125rpx" :src="u_p1Data.user_thumbnail"></u-image>
</view>
<view class="big-333 bold">
{{u_p1Data.u_nickname}}
</view>
<view class="lit-666" style="margin-top: 20rpx;">
邀请码{{u_p1Data.invite_code}}
</view>
<view class="lit-666" style="margin-top: 20rpx;">
微信号{{u_p1Data.u_wx_id}}
</view>
<view class="btn-class">
<u-button @click="copyThis(u_p1Data.u_wx_id)" color="linear-gradient(45deg,#FFAD02,#FD8F3B)" text="复制微信号"></u-button>
</view>
<view class="btn-class">
<u-button @click="showPopup = false" color="#999999" text="取消"></u-button>
</view>
</view>
</u-popup>
</view>
</template>
<script>
export default {
name: "teamGroup",
props: {
showTj: {
type: Boolean,
default: true
},
isHideScan:{
type:Number,
default:0
},
canClick: {
type: Boolean,
default: false
},
detail:{
type:Object,
default:null
},
userMember:{
typeof:Number,
default:0
}
},
data() {
return {
u_p1Data:{},
showPopup:false,
};
},
methods:{
copyThis(str) {
console.log(str)
uni.setClipboardData({
data: str, //
success: () => { //
uni.showToast({ //
title: "复制成功"
})
},
fail(e) {
console.log(e)
}
});
},
goFansInfo(){
if(!this.canClick){
return ;
}
// console.log(this.userMember);return
if(this.userMember == 1){
uni.navigateTo({
url:'/b_client/member/fansInfo?u_id='+this.detail.u_id+'&is_scan=其他&isUserCenter=1'
// url: '/pages/Myteam/fansdetails?u_id='+u_id +'&orderNum='+ on+'&fans_count='+fc+'&sy='+sy
})
return
}
uni.navigateTo({
url:'/b_client/member/fansInfo?u_id='+this.detail.u_id+'&is_scan='+this.detail.is_scan
})
},
showTjx(){
// ajax
//this.$emit('getTjx',{u_p1:this.detail.u_p1})
// return
this.$store.dispatch('api/recommender',{
u_p1 :this.detail.u_p1
}).then(res => {
this.u_p1Data = res
this.showPopup = true;
})
}
}
}
</script>
<style lang="scss">
.alt-box{
background-color: #F8F8F8;
border-radius: 20rpx;
min-width: 470rpx;
text-align: center;
padding: 20rpx;
.tx{
width: 125rpx;
height: 125rpx;
margin: 20rpx auto;
border: 10rpx solid #fff;
border-radius: 50%;
}
}
.btn-class{
width: 242rpx;
margin: 20rpx auto;
}
.box-nr {
.t-tt {
color: #666666;
font-size: 24rpx;
text-align: center;
margin-top: 20rpx;
}
.t-vl {
margin-top: 10rpx;
color: #666666;
font-size: 24rpx;
text-align: center;
font-weight: bold;
}
}
.tab-box {
text {
border: 2rpx solid #999999;
border-radius: 20rpx;
font-size: 24rpx;
color: #999;
padding: 0 10rpx 5rpx 10rpx;
margin-right: 20rpx;
}
}
</style>

View File

@ -0,0 +1,46 @@
<template>
<view class="b-Bottom-Fit" :class="[Class]"></view>
</template>
<script>
export default {
name: "b-Bottom-Fit",
data() {
return {
// Class: ''
};
},
computed:{
Class(){
//
let system = uni.getSystemInfoSync();
console.log(system.platform, '设备类型');
if (system.platform === 'android' || system.platform === 'devtools') {
return 'Android';
} else if (system.platform === 'ios' || system.platform === 'devtools') {
return 'IOS';
}
}
},
mounted() {
}
}
</script>
<style lang="scss">
.b-Bottom-Fit {
width: 100%;
}
.Android {
padding-bottom: 32rpx;
box-sizing: content-box;
}
.IOS {
height: constant(safe-area-inset-bottom);
height: calc(env(safe-area-inset-bottom));
box-sizing: content-box;
}
</style>

View File

@ -0,0 +1,918 @@
<template>
<view class="b-Shopping-Cart">
<template v-if="BrandInfor['brand_id'] == 1">
<!-- 购物车 -->
<view class="shoppingcart">
<view class="left">
<view class="left-img">
<image class="img" @tap="Shoplength > 0?shoppingshow = !shoppingshow:''"
:src="qnyurl('gouwuceicon.png')" mode="aspectFill">
</image>
<u-badge type="error" v-if="Shoplength > 0" absolute :value="Shoplength" :offset="[0,5]">
</u-badge>
</view>
<view class="price">
<text class="yang"></text>
<text class="amount">{{RetainDecimalPoint(totalPrice)}}</text>
</view>
</view>
<view class="right" @tap="create" :class="[Shoplength > 0?'right2':'']">
{{Shoplength > 0?'选好了':'未选择商品'}}
</view>
</view>
<!-- 购物车弹框 -->
<u-popup :round="15" :overlayStyle="{bottom:'100rpx'}" bottom="100rpx" closeOnClickOverlay
@close="shoppingshow = false" :show="shoppingshow" mode="bottom">
<view class="popupcontent">
<scroll-view :scroll-top="0" scroll-y style="height: 642rpx;">
<template v-for="(item,index) in MealList">
<view class="popupcontent-item" :key='index'>
<!-- 商品 -->
<view class="name">
{{item['product_name']}}
</view>
<!-- 价格 -->
<view class="money">
<view class="price">
<text class="yang"></text>
<text
class="amount">{{RetainDecimalPoint(item['pay_price'] * item['num'])}}</text>
</view>
</view>
<!-- 数量 -->
<view class="quantity">
<image class="img" :src="qnyurl('jian.png')" mode="" @tap="reducecommodity(item)">
</image>
<view class="num">
{{item['num']}}
</view>
<image class="img" :src="qnyurl('jia.png')" mode="" @tap="Addcommodity(item)">
</image>
</view>
</view>
</template>
</scroll-view>
</view>
</u-popup>
</template>
<!-- 瑞幸购物车 -->
<template v-if="BrandInfor['brand_id'] == 13">
<!-- 购物车 -->
<view class="shoppingcart-rx">
<view class="shoppingcart-rx-left" @tap="Shoplength > 0?shoppingshow = !shoppingshow:''">
<view class="shoppingcart-rx-left-img">
<image class="img" :src="qnyurl('shopping.png','rx')" mode="aspectFill">
</image>
<u-badge type="error" v-if="Shoplength > 0" absolute :value="Shoplength" :offset="[0,5]">
</u-badge>
</view>
<view class="shoppingcart-rx-left-price">
<text class="yang"></text>
<text class="amount">{{RetainDecimalPoint(totalPrice)}}</text>
</view>
</view>
<view class="shoppingcart-rx-right" @tap="create" :class="[Shoplength > 0?'right2':'']">
{{Shoplength > 0?'结算':'未选择商品'}}
</view>
</view>
<!-- 购物车弹框 -->
<u-popup :round="15" :overlayStyle="{bottom:'100rpx'}" bottom="100rpx" closeOnClickOverlay
@close="shoppingshow = false" :show="shoppingshow" mode="bottom">
<view class="popupcontent-rx">
<scroll-view :scroll-top="0" scroll-y style="height: 642rpx;">
<view class="popupcontent-rx-top">
<view class="text">
已选商品
</view>
<view class="popupcontent-rx-top-empty" @tap="EMPTY(GetShopInfor['restaurant_id'])">
<image class="img" :src="qnyurl('qingkong.png','rx')" mode=""></image>
<text>清空购物车</text>
</view>
</view>
<template v-for="(item,index) in MealList">
<view class="popupcontent-rx-item" :key='index'>
<view class="popupcontent-rx-item-commodity">
<view class="popupcontent-rx-item-commodity-img">
<image class="img" :src="item['product_img']" mode=""></image>
</view>
<view class="popupcontent-rx-item-commodity-infor">
<!-- 商品 -->
<view class="popupcontent-rx-item-commodity-infor-name">
{{item['product_name']}}
</view>
<view class="popupcontent-rx-item-commodity-infor-sku">
{{item['sku'].join('/')}}
</view>
<!-- 价格 -->
<view class="popupcontent-rx-item-commodity-infor-money">
<view class="popupcontent-rx-item-commodity-infor-money-price">
<text
class="popupcontent-rx-item-commodity-infor-money-yang"></text>
<text
class="popupcontent-rx-item-commodity-infor-money-amount">{{RetainDecimalPoint(item['pay_price'] * item['num'])}}</text>
</view>
</view>
</view>
</view>
<!-- 数量 -->
<view class="quantity">
<image class="img" :src="qnyurl('reduce.png','rx')" mode=""
@tap="reducecommodity(item)">
</image>
<view class="num">
{{item['num']}}
</view>
<image class="img" :src="qnyurl('add.png','rx')" mode="" @tap="Addcommodity(item)">
</image>
</view>
</view>
</template>
</scroll-view>
</view>
</u-popup>
</template>
<template v-if="BrandInfor['brand_id'] == 10">
<!-- 购物车 -->
<view class="shoppingcart-xbk">
<view class="shoppingcart-xbk-left" @tap="Shoplength > 0?shoppingshow = !shoppingshow:''">
<view class="shoppingcart-xbk-left-img">
<image class="img" :src="qnyurl('shopping.png','xbk')" mode="heightFix">
</image>
<u-badge type="error" v-if="Shoplength > 0" absolute :value="Shoplength" :offset="[0,5]">
</u-badge>
</view>
<view class="shoppingcart-xbk-left-price">
<text class="yang"></text>
<text class="amount">{{RetainDecimalPoint(totalPrice)}}</text>
</view>
</view>
<view class="shoppingcart-xbk-right" @tap="create" :class="[Shoplength > 0?'right2':'']">
{{Shoplength > 0?'结算':'未选择商品'}}
</view>
</view>
<!-- 购物车弹框 -->
<u-popup :round="15" :overlayStyle="{bottom:'100rpx'}" bottom="100rpx" closeOnClickOverlay
@close="shoppingshow = false" :show="shoppingshow" mode="bottom">
<view class="popupcontent-xbk">
<scroll-view :scroll-top="0" scroll-y style="height: 642rpx;">
<view class="popupcontent-xbk-top">
<view class="text">
已选商品
</view>
<view class="popupcontent-xbk-top-empty" @tap="EMPTY(GetShopInfor['restaurant_id'])">
<image class="img" :src="qnyurl('qingkong.png','xbk')" mode=""></image>
<text>清空购物车</text>
</view>
</view>
<template v-for="(item,index) in MealList">
<view class="popupcontent-xbk-item" :key='index'>
<view class="popupcontent-xbk-item-commodity">
<view class="popupcontent-xbk-item-commodity-img">
<image class="img" :src="item['product_img']" mode=""></image>
</view>
<view class="popupcontent-xbk-item-commodity-infor">
<!-- 商品 -->
<view class="popupcontent-xbk-item-commodity-infor-name">
{{item['product_name']}}
</view>
<view class="popupcontent-xbk-item-commodity-infor-sku">
{{item['sku'].join('/')}}
</view>
<!-- 价格 -->
<view class="popupcontent-xbk-item-commodity-infor-money">
<view class="popupcontent-xbk-item-commodity-infor-money-price">
<text
class="popupcontent-xbk-item-commodity-infor-money-yang"></text>
<text
class="popupcontent-xbk-item-commodity-infor-money-amount">{{RetainDecimalPoint((item['pay'] * item['num']))}}</text>
</view>
</view>
</view>
</view>
<!-- 数量 -->
<view class="quantity">
<image class="img" :src="qnyurl('reduce.png','xbk')" mode=""
@tap="reducecommodity(item)">
</image>
<view class="num">
{{item['num']}}
</view>
<image class="img" :src="qnyurl('add.png','xbk')" mode="" @tap="Addcommodity(item)">
</image>
</view>
</view>
</template>
</scroll-view>
</view>
</u-popup>
</template>
</view>
</template>
<script>
// vuex
// import {
// mapGetters,
// mapMutations,
// mapActions
// } from 'vuex';
//
import mixin from '@/static/js/mixin/mixin.js';
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
export default {
mixins: [mixin,restaurantmixins],
name: "b-Shopping-Cart",
props:{
tabbar:{
type:Array,
default:()=>[],
}
},
data() {
return {
//
MealList: [],
//
totalPrice: 0,
//
shoppingshow: false
};
},
computed: {
// ...mapGetters({
// // Id
// BrandInfor: 'shopping/BrandInfor',
// //
// GetShopInfor: 'shopping/GetShopInfor',
// //
// GetCartList: 'shopping/GetCartList',
// }),
//
// shopCart() {
// try {
// return {
// ...this['GetCartList']
// };
// } catch (e) {
// return {}
// }
// },
//
Shoplength() {
if (this['MealList']['length'] <= 0) {
this['shoppingshow'] = false;
}
return this['MealList']['length'];
}
},
watch: {
GetCartList: {
deep: true,
immediate: true,
handler(val) {
console.log(val, 'GetCartList');
this.initCategoryNum();
}
}
},
methods: {
/**
* @本地数据与当前餐厅数格式化
* */
initCategoryNum() {
console.log(this['tabbar'],'-----------');
// ,
if (this['tabbar']['length'] <= 0) return;
console.log(this.GetCartList,'进入initCategoryNum');
console.time()
//
let shoparr = [];
let newArr = [];
let Price = 0;
this['tabbar'].map(item => {
shoparr.push(...item['foods'])
});
// id
let commodityids = shoparr.map(item => item['product_id']);
//
console.log(Object.keys(this['GetCartList']),'*********');
let list = Object.keys(this['GetCartList']);
console.log(list,'进入initCategoryNum');
for (let i = 0; i < list['length']; i++) {
console.log('*********');
// item
let id = +Object.keys(this['GetCartList'])[i];
// // commodityidsitem
let index = commodityids.indexOf(id);
// let cmr = this.screensku_xbk(shoparr[index]['details']['optional'],shoparr[index]['pay_price']);
// let newarr = this['GetCartList'][id]['sku_code'].split(',').map(item=>item.replace('_',',').split(','));
let item = {};
if (index != -1) {
item = {
// ...this['GetCartList'][id],
...shoparr[index],
num: this['GetCartList'][id]['num'],
sku: this['GetCartList'][id]['sku'],
sku_code: this['GetCartList'][id]['sku_code'],
restaurant_id: this['GetShopInfor']['restaurant_id'],
//
pay: this['GetCartList'][id]['pay'] || 0
};
// console.log(item,'itemitemitemitemitem');
// for(let i = 0; i < item['details']['optional']['length'];i++){
// for(let j = 0; i<item['details']['optional'][i]['sku_infos']['length'];j++){
// if((+item['details']['optional'][i]['id']) == (+newarr[i][j]) && (+item['details']['optional'][i]['sku_infos'][i]['id']) == (+newarr[i][j+1])){
// item['details']['optional'][i]['sku_infos'][j]['checked'] = true;
// }else{
// item['details']['optional'][i]['sku_infos'][j]['checked'] = false;
// }
// }
// }
// console.log(item,'itemitemitemitemitem');
newArr.push(item);
if(this['BrandInfor']['brand_id'] == 10){
Price += ((+item['pay']) * item['num']);
}else{
Price += ((+item['pay_price']) * item['num']);
}
//
if (this['GetCartList'][id]['Differentskulist'] && this['GetCartList'][id]['Differentskulist'][
'length'
] > 0) {
for (let i = 0; i < this['GetCartList'][id]['Differentskulist']['length']; i++) {
let _item = this['GetCartList'][id]['Differentskulist'][i];
console.log(_item);
_item = {
...shoparr[index],
num: _item['num'],
sku: _item['sku'],
sku_code: _item['sku_code'],
//
pay:_item['pay']
};
this['GetCartList'][id]['Differentskulist'][i] = _item;
};
newArr.push(...this['GetCartList'][id]['Differentskulist']);
if(this['BrandInfor']['brand_id'] == 10){
Price += this['GetCartList'][id]['Differentskulist'].map(e => e['pay'] * e['num'])
.reduce((a, b) => a + b);
}else{
Price += this['GetCartList'][id]['Differentskulist'].map(e => e['pay_price'] * e['num'])
.reduce((a, b) => a + b);
}
}
} else {
//
}
};
console.log(newArr,'newArrnewArrnewArrnewArr');
this['MealList'] = newArr;
this['totalPrice'] = Price;
console.timeEnd()
console.log('结束initCategoryNum');
},
/**
* @添加数量/增加商品
* */
Addcommodity(item) {
console.log(item);
console.log(this,'*-*-*')
this.ADD_CART({
commodity: item
})
},
/**
* @减少/删除商品
* */
reducecommodity(item) {
this.REDUCE_CART(item)
},
/**
* @创建订单页面
* */
create() {
if (this['Shoplength'] <= 0) return;
this['$parent']['loading'] = true;
let self = this;
self.SETREPLACE(self['MealList']);
switch (this['BrandInfor']['brand_id']) {
case 1:
uni.navigateTo({
url: `/pages/restaurant/order/orders-settlement/orders-settlement`,
success: () => {
this['$parent']['loading'] = false;
}
});
break;
case 13:
uni.navigateTo({
url: `/pages/restaurant/order/orders-settlement/rx-orders-settlement`,
success: () => {
this['$parent']['loading'] = false;
}
});
break;
case 10:
uni.navigateTo({
url: `/pages/restaurant/order/orders-settlement/xbk_orders_settlement`,
success: () => {
this['$parent']['loading'] = false;
}
});
break;
}
},
}
}
</script>
<style lang="scss">
//
.shoppingcart {
width: 100%;
display: flex;
justify-content: space-between;
position: relative;
z-index: 20075;
.left {
flex: 1;
height: 100rpx;
background-color: #333333;
display: flex;
align-items: center;
padding-left: 50rpx;
&-img {
position: relative;
.img {
width: 65rpx;
height: 65rpx;
margin-right: 25rpx;
}
}
.price {
color: #ffffff;
display: flex;
align-items: baseline;
.yang {
font-size: 26rpx;
}
.amount {
font-size: 50rpx;
}
}
}
//
.right {
width: 235rpx;
height: 100rpx;
background: #DFDFDF;
color: #333333;
text-align: center;
line-height: 100rpx;
}
//
.right2 {
background: #C63836 !important;
color: #ffffff !important;
}
}
.popupcontent {
width: 100%;
// padding-bottom: calc();
height: 642rpx;
background-color: #ffffff;
&-item {
width: 100%;
margin-bottom: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 32rpx;
box-sizing: border-box;
.name {
font-size: $FONTSIZE26;
max-width: 336rpx;
min-width: 336rpx;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
}
.money {
color: $THEMECOLOR1;
max-width: 115rpx;
min-width: 115rpx;
text-align: center;
.yang {
font-size: $FONTSIZE22;
}
.price {
font-size: $FONTSIZE30;
}
}
.quantity {
display: flex;
justify-content: space-between;
align-items: center;
font-size: $FONTSIZE36;
.num {
max-width: 100rpx;
min-width: 100rpx;
text-align: center;
}
.img {
width: 42rpx;
height: 42rpx;
}
}
}
}
//
.shoppingcart-rx {
width: 100%;
display: flex;
justify-content: space-between;
position: relative;
z-index: 20075;
background-color: #ffffff;
align-items: center;
padding: 0 32rpx;
&-left {
flex: 1;
height: 100rpx;
display: flex;
align-items: center;
&-img {
position: relative;
.img {
width: 65rpx;
height: 65rpx;
margin-right: 25rpx;
}
}
&-price {
color: #000000;
display: flex;
align-items: baseline;
.yang {
font-size: 26rpx;
}
.amount {
font-size: 50rpx;
}
}
}
&-right {
width: 225rpx;
height: 77rpx;
background: linear-gradient(-77deg, #4A6FE7, #83ACFF);
box-shadow: 0 6rpx 8rpx 0 rgba(74, 111, 231, 0.2300);
border-radius: 48rpx;
text-align: center;
color: #ffffff;
line-height: 77rpx;
}
}
.popupcontent-rx {
width: 100%;
// padding-bottom: calc();
height: 642rpx;
background-color: #ffffff;
.popupcontent-rx-top {
width: 100%;
height: 87rpx;
border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
padding: 0 32rpx;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 26rpx;
.text {
color: #666666;
}
&-empty {
color: #666666;
display: flex;
align-items: center;
padding: 15rpx 0 15rpx 15rpx;
.img {
width: 29rpx;
height: 31rpx;
margin-right: 15rpx;
}
}
}
&-item {
width: 100%;
margin-bottom: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 32rpx;
box-sizing: border-box;
&-commodity {
display: flex;
&-img {
width: 120rpx;
height: 120rpx;
.img {
width: 100%;
height: 100%;
border-radius: 10rpx;
}
}
&-infor {
display: flex;
flex-direction: column;
justify-content: space-between;
padding-left: 22rpx;
&-name {
font-size: $FONTSIZE30;
max-width: 336rpx;
min-width: 336rpx;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
}
&-sku {
color: #999999;
font-size: $FONTSIZE22;
}
&-money {
color: $THEMECOLOR1;
max-width: 115rpx;
min-width: 115rpx;
text-align: center;
color: #FF780F;
&-yang {
font-size: $FONTSIZE22;
}
&-price {
display: flex;
align-items: center;
font-size: $FONTSIZE30;
}
}
}
}
.quantity {
display: flex;
justify-content: space-between;
align-items: center;
font-size: $FONTSIZE36;
.num {
max-width: 100rpx;
min-width: 100rpx;
text-align: center;
}
.img {
width: 42rpx;
height: 42rpx;
}
}
}
}
//
//
.shoppingcart-xbk {
width: 100%;
display: flex;
justify-content: space-between;
position: relative;
z-index: 20075;
background-color: #ffffff;
align-items: center;
padding: 0 32rpx;
&-left {
flex: 1;
height: 100rpx;
display: flex;
align-items: center;
&-img {
position: relative;
.img {
width: 65rpx;
height: 65rpx;
margin-right: 25rpx;
}
}
&-price {
color: #000000;
display: flex;
align-items: baseline;
.yang {
font-size: 26rpx;
}
.amount {
font-size: 50rpx;
}
}
}
&-right {
width: 225rpx;
height: 77rpx;
background: #00AF66;
box-shadow: 0 6rpx 8rpx 0 rgba(74, 111, 231, 0.2300);
border-radius: 48rpx;
text-align: center;
color: #ffffff;
line-height: 77rpx;
}
}
.popupcontent-xbk {
width: 100%;
// padding-bottom: calc();
height: 642rpx;
background-color: #ffffff;
.popupcontent-xbk-top {
width: 100%;
height: 87rpx;
border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
padding: 0 32rpx;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 26rpx;
.text {
color: #666666;
}
&-empty {
color: #666666;
display: flex;
align-items: center;
padding: 15rpx 0 15rpx 15rpx;
.img {
width: 29rpx;
height: 31rpx;
margin-right: 15rpx;
}
}
}
&-item {
width: 100%;
margin-bottom: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 32rpx;
box-sizing: border-box;
&-commodity {
display: flex;
&-img {
width: 120rpx;
height: 120rpx;
.img {
width: 100%;
height: 100%;
border-radius: 10rpx;
}
}
&-infor {
display: flex;
flex-direction: column;
justify-content: space-between;
padding-left: 22rpx;
&-name {
font-size: $FONTSIZE30;
max-width: 336rpx;
min-width: 336rpx;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
}
&-sku {
color: #999999;
font-size: $FONTSIZE22;
}
&-money {
color: $THEMECOLOR1;
max-width: 115rpx;
min-width: 115rpx;
text-align: center;
color: #FF780F;
&-yang {
font-size: $FONTSIZE22;
}
&-price {
display: flex;
align-items: center;
font-size: $FONTSIZE30;
}
}
}
}
.quantity {
display: flex;
justify-content: space-between;
align-items: center;
font-size: $FONTSIZE36;
.num {
max-width: 100rpx;
min-width: 100rpx;
text-align: center;
}
.img {
width: 42rpx;
height: 42rpx;
}
}
}
}
</style>

View File

@ -0,0 +1,133 @@
<template>
<view class="b-load" :style="[Style]" v-show="display">
<view class="b-load-content">
<view class="b-load-content-Img">
<image :src="LoadImg" mode="" :style="[ImgStyle]"></image>
</view>
<view class="b-load-content-text" :style="[TextStyle]">
{{LoadText}}
</view>
</view>
</view>
</template>
<script>
/**
* 点餐加载组件
* @property { Boolean } show 组件显示
* @property { String } position 加载组件的定位对应css中的定位属性值为absolute时组件父元素必须是relative
* @property { String } background 加载组件的背景色16进的或者rgba都可以
* @property { String } img 组件加载中图片
* @property { String } type 加载组件类型
* @property { String } color 提示文字颜色
*/
// load
// close
// orders
// store
import props from './prop.js';
import mixin from '@/static/js/mixin/mixin.js'
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js'
export default {
mixins:[props,mixin,restaurantmixins],
name: "b-load",
data() {
return {
};
},
computed:{
display(){
console.log('组件状态');
return this['show']
},
GetType(){
return this['type']
},
Style(){
let style = {};
style['position'] = this['position'];
style['background-color'] = this['background'];
style['z-index'] = new Date().getTime();
return style;
},
ImgStyle() {
return {
width: `${this['width']}rpx`,
height: `${this['height']}rpx`
}
},
TextStyle(){
return {
color:this['color']
};
},
LoadText() {
if(this['text'] != ''){
return this['text'];
}
//
if (this['GetType'] == 'load') {
return '加载中,请稍后'
} else if (this['GetType'] == 'close') {
//
return '抱歉,该门店已打烊'
} else if (this['GetType'] == 'orders') {
//
return '您还没有小食订单 '
} else if (this['GetType'] == 'store') {
//
return '该地区暂无门店信息'
}
},
LoadImg() {
if(this['img'] != ''){
return this['img'];
}
//
if (this['GetType'] == 'load') {
if(this['BrandInfor']['brand_id'] == 1){
return this.qnyurl('kdjload.png')
}else if(this['BrandInfor']['brand_id'] == 10){
return this.qnyurl('load.gif', 'xbk')
}else if(this['BrandInfor']['brand_id'] == 13){
return this.qnyurl('load.png', 'rx')
}
} else if (this['GetType'] == 'close') {
//
return this.qnyurl('closureimg.png', 'rx')
} else if (this['GetType'] == 'orders') {
//
return this.qnyurl('orderno.png', 'rx')
} else if (this['GetType'] == 'store') {
//
return this.qnyurl('default.png', 'rx')
}
},
}
}
</script>
<style lang="scss">
.b-load {
width: 100%;
height: 100%;
left: 0;
top: 0;
&-content{
width: 100%;
height: 100%;
display: flex;
align-items:center;
flex-direction:column;
justify-content: center;
&-text{
margin-top: 34rpx;
font-size: 28rpx;
}
}
}
</style>

View File

@ -0,0 +1,41 @@
export default {
props:{
img:{
type:String,
default:''
},
text:{
type:String,
default:''
},
show:{
type: Boolean,
default: false
},
position: {
type: String,
default: 'fixed'
},
background:{
type:String,
default:'#FFFFFF'
},
width:{
type:String,
default:''
},
height:{
type:String,
default:''
},
type:{
type:String,
default:'load'
},
color:{
type:String,
default:'#FFFFFF'
}
}
}

View File

@ -0,0 +1,364 @@
<template>
<view class="Order-settlement">
<view class="Order-settlement-left">
<view class="Order-settlement-left-item">
原价: {{RetainDecimalPoint(InforData['original_price'])}}
</view>
<view class="Order-settlement-left-item">
消费补贴卡抵扣{{RetainDecimalPoint(InforData['deduction_amount_total'])}}
</view>
<view class="Order-settlement-left-item">
预估佣金{{InforData['self_commission']}}
</view>
</view>
<view class="Order-settlement-btn-price">
<view class="Order-settlement-btn-price-pay-price">
<text class="text1">{{InforData['status'] | OrderStateText}}</text>
<text class="text2" style="color:#DE2F2C">{{RetainDecimalPoint(InforData['pay_price'])}}</text>
</view>
<!-- 待支付 -->
<view class="Order-settlement-btn-price-operate" v-if="InforData['status'] == OrderStatus0">
<view class="btn btn1" @tap.stop="cancel(InforData['order_sn'],index)">
取消订单
</view>
<view class="btn btn2" :style="[orderStyle]" @tap.stop="payment(InforData['order_sn'],index)">
去支付
</view>
</view>
<!-- 已出餐 -->
<view class="Order-settlement-btn-price-operate" v-if="InforData['status'] == OrderStatus2">
<!-- 瑞幸-已出参订单按钮 -->
<template v-if="Brand_RX">
<view class="btn btn1" @tap.stop="service">
联系客服
</view>
<!-- <navigator hover-class="none" -->
<!-- :url="`/pages/restaurant/order/order-details/rx-orders-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn2" :style="[orderStyle]" @tap.stop="OrderDetails(shopid['RX_brand_id'])">
查看取餐码
</view>
<!-- </navigator> -->
</template>
<!-- 肯德基-已出参订单按钮 -->
<template v-if="Brand_KFC">
<!-- <navigator hover-class="none"
:url="`/pages/restaurant/order/order-details/order-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn1" :style="[orderStyle]" @tap.stop="OrderDetails(shopid['KFC_brand_id'])">
查看取餐码
</view>
<!-- </navigator> -->
</template>
<!-- 星巴克-已出参订单按钮 -->
<template v-if="Brand_XBK">
<!-- <navigator hover-class="none" -->
<!-- :url="`/pages/restaurant/order/order-details/xbk-orders-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn1" :style="[orderStyle]" @tap.stop="OrderDetails(shopid['XBK_brand_id'])">
取餐口令
</view>
<!-- </navigator> -->
</template>
</view>
<!-- 已出餐部分退款 -->
<view class="Order-settlement-btn-price-operate" v-if="InforData['status'] == OrderStatus4">
<!-- 瑞幸-已出参部分退款订单按钮 -->
<template v-if="Brand_RX">
<!-- <navigator hover-class="none" -->
<!-- :url="`/pages/restaurant/order/order-details/rx-orders-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn1" :style="[orderStyle]" @tap.stop="OrderDetails(shopid['RX_brand_id'])">
查看取餐码
</view>
<!-- </navigator> -->
</template>
<!-- 肯德基-已出参部分退款订单按钮 -->
<template v-if="Brand_KFC">
<!-- <navigator hover-class="none" -->
<!-- :url="`/pages/restaurant/order/order-details/order-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn1" :style="[orderStyle]" @tap.stop="OrderDetails(shopid['KFC_brand_id'])">
查看取餐码
</view>
<!-- </navigator> -->
</template>
<!-- 星巴克-已出参部分退款订单按钮 -->
<template v-if="Brand_XBK">
<!-- <navigator hover-class="none" -->
<!-- :url="`/pages/restaurant/order/order-details/xbk-orders-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn1" :style="[orderStyle]" @tap.stop="OrderDetails(shopid['XBK_brand_id'])">
查看口令
</view>
<!-- </navigator> -->
</template>
</view>
<!-- 待出餐/已退款订单失败就会退款 -->
<view class="Order-settlement-btn-price-operate"
v-if="InforData['status'] == OrderStatus1 || InforData['status'] == OrderStatus3">
<!-- 瑞幸-待出餐/已退款订单按钮 -->
<template v-if="Brand_RX">
<view class="btn btn1" @tap.stop="service">
联系客服
</view>
<!-- <navigator hover-class="none" -->
<!-- :url="`/pages/restaurant/order/order-details/rx-orders-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn1 btn2" @tap.stop="OrderDetails(shopid['RX_brand_id'])">
查看订单
</view>
<!-- </navigator> -->
</template>
<!-- 肯德基-待出餐/已退款订单按钮 -->
<template v-if="Brand_KFC">
<view class="btn btn1" @tap.stop="service">
联系客服
</view>
</template>
<!-- 星巴克-待出餐/已退款订单按钮 -->
<template v-if="Brand_XBK">
<!-- <navigator hover-class="none" -->
<!-- :url="`/pages/restaurant/order/order-details/xbk-orders-details?order=${InforData['order_sn']}`"> -->
<view class="btn btn1 btn2" @tap.stop="OrderDetails(shopid['XBK_brand_id'])">
查看订单
</view>
<!-- </navigator> -->
</template>
</view>
<!-- 已取消 -->
<view class="Order-settlement-btn-price-operate" v-if="InforData['status'] == OrderStatus5">
<!-- 瑞幸-已取消订单按钮 -->
<template v-if="Brand_RX">
<view class="btn btn1" @tap.stop="service">
联系客服
</view>
<view class="btn btn1 btn2" @tap.stop="OrderReorder">
再来一单
</view>
</template>
<!-- 肯德基-已取消订单按钮 -->
<template v-if="Brand_KFC">
<view class="btn btn1 btn2" @tap.stop="OrderReorder">
重新下单
</view>
</template>
<!-- 星巴克-已取消订单按钮 -->
<template v-if="Brand_XBK">
<view class="btn btn1" @tap.stop="service">
联系客服
</view>
<view class="btn btn1 btn2" @tap.stop="OrderReorder">
重新下单
</view>
</template>
</view>
</view>
</view>
</template>
<script>
import {
RXSERVICE
} from '@/static/js/serviceurl.js'
import mixin from '@/static/js/mixin/mixin.js';
import restaurantmixins from '@/static/js/mixin/restaurantmixins.js';
import {
mapGetters,
} from 'vuex'
export default {
name: 'b-order-item-settlement',
mixins: [mixin, restaurantmixins],
// ,,
inject: ["cancel", "Reorder", "payment"],
props: {
index: {
type: Number,
default: 0
},
infor: {
type: Object,
default: () => {}
}
},
computed: {
InforData() {
return this['infor']
},
//
orderStyle() {
let style = {};
switch (this['BrandInfor']['brand_id']) {
case 1:
style['color'] = uni.$u.addUnit('#C63836');
style['border'] = uni.$u.addUnit('1px solid #DC7473');
break;
case 10:
style['color'] = uni.$u.addUnit('#ffffff');
style['background-color'] = uni.$u.addUnit('#00AF66');
// style['border'] = uni.$u.addUnit('1px solid #00AF66');
break;
case 13:
style['color'] = uni.$u.addUnit('#4A6FE7');
style['border'] = uni.$u.addUnit('1px solid #4A6FE7');
break;
};
return style;
},
Brand_RX() {
return this['BrandInfor']['brand_id'] == 13;
},
Brand_KFC() {
return this['BrandInfor']['brand_id'] == 1;
},
Brand_XBK() {
return this['BrandInfor']['brand_id'] == 10;
}
},
data() {
return {
}
},
methods: {
//
OrderReorder() {
let arr = this['InforData']['goods'].map(item => {
item['restaurant_id'] = this['InforData']['restaurant_id'];
//
item['restaurant_address'] = this['InforData']['restaurant_address'];
item['restaurant_name'] = this['InforData']['restaurant_name'];
item['latitude'] = this['InforData']['lat'];
item['longitude'] = this['InforData']['lng'];
// 使num,amount
item['num'] = item['amount'];
item['pay'] = item['original_price'] / item['amount'];
// item['pay_price'] = item['original_price'];
return item
});
this.Reorder(arr);
},
OrderDetails(type) {
let url;
switch (type) {
case this['shopid']['KFC_brand_id']:
url =
`/pages/restaurant/order/order-details/order-details?order=${this['InforData']['order_sn']}`;
break;
case this['shopid']['XBK_brand_id']:
url =
`/pages/restaurant/order/order-details/xbk-orders-details?order=${this['InforData']['order_sn']}`;
break;
case this['shopid']['RX_brand_id']:
url =
`/pages/restaurant/order/order-details/rx-orders-details?order=${this['InforData']['order_sn']}`;
break;
};
uni.navigateTo({url})
},
/**
* @跳转客服
* */
service() {
uni.openCustomerServiceChat({
extInfo: {
url: RXSERVICE,
},
corpId: 'ww4f46b491a045158c',
success(e) {
console.log(e)
},
fail(e) {
console.log(e)
}
})
},
}
}
</script>
<style lang="scss">
.Order-settlement {
padding: 0 32rpx 21rpx 32rpx;
margin-top: 48rpx;
display: flex;
justify-content: space-between;
&-left {
color: #333333;
font-size: $FONTSIZE24;
&-item:nth-of-type(1) {
margin-bottom: 12rpx;
}
&-item:nth-of-type(2) {
margin-bottom: 12rpx;
}
}
&-btn-price {
display: flex;
align-items: flex-end;
flex-direction: column;
justify-content: space-between;
&-pay-price {
.text1 {
color: #333333;
font-size: $FONTSIZE24;
}
.text2 {
// color: #CE211F;
font-size: $FONTSIZE36;
}
}
&-operate {
display: flex;
.btn {
width: 160rpx;
height: 58rpx;
font-size: $FONTSIZE22;
text-align: center;
// line-height: 58rpx;
display: flex;
align-items: center;
justify-content: center;
}
.btn1 {
border: 2rpx solid #E3E3E3;
border-radius: 50rpx;
color: #666666;
}
.btn2 {
// border: 2rpx solid #C63836;
border-radius: 50rpx;
// color: #C63836;
margin-left: 20rpx;
}
}
}
}
</style>

Some files were not shown because too many files have changed in this diff Show More