Commit 4dcdc82a authored by zhengke's avatar zhengke

rrr

parents c5d70189 c32f9ecf
......@@ -104,7 +104,7 @@ export default {
font-family: "oswald";
src: url("https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/smallapp/Oswald-Regular.ttf");
}
*{
html,body{
font-family: "oswald" !important;
}
swiper{
......
<template>
<u-popup
mode="bottom"
border-radius="20"
:popup="false"
v-model="show"
:maskCloseAble="true"
length="auto"
:safeAreaInsetBottom="true"
@close="popupClose"
:z-index="9999"
close-icon="cross"
:closeable="true"
>
<view class="coupon">
<view class="title">优惠券</view>
<view class="chosentips">请选择要使用的优惠券</view>
<view class="details">
<view class="item" v-for="(x, i) in ts" :key="i">
<view class="ticket">
<view class="miane">
<view class="money">
<text class="small" v-if="x.coupon_data.type==2"></text>
<text style="font-size: 44px;">{{x.sub_price.toString().split('.')[0]}}</text>
<text class="small" v-if="x.coupon_data.type==1"></text>
</view>
<view class="tiaojian">{{x.coupon_min_price}}元可用</view>
</view>
</view>
<view class="detail">
<view class="coupond">
<view class="name">{{x.coupon_data.name}}</view>
<view class="date">{{x.start_time+"-"+x.end_time}}</view>
<view class="rule">{{x.coupon_data.rule}}</view>
</view>
<view class="chosen">
<u-radio-group v-model="currentChosen">
<u-radio
shape="circle"
:name="x.id"
:icon-size="36"
:active-color="mc"
></u-radio>
</u-radio-group>
</view>
</view>
</view>
</view>
<view class="btton-box">
<u-button
size="80"
:ripple="true"
shape="circle"
:custom-style="{
backgroundColor: mc,
height: '80rpx',
color: '#FFF',
fontSize: '14px',
margin: '0 3vw',
width: '90vw',
}"
@click="popupClose"
>确定</u-button
>
</view>
</view>
</u-popup>
</template>
<script>
export default {
props: ["list", "current"],
data() {
return {
mc: "",
show: true,
currentChosen: "",
ts:[]
};
},
mounted() {
this.mc = this.$uiConfig.mainColor;
this.currentChosen = this.current;
this.ts=this.list
this.ts.forEach(x=>{
x.start_time=x.start_time.split(' ')[0].replace(/-/g,'.')
x.end_time=x.end_time.split(' ')[0].replace(/-/g,'.')
})
},
methods: {
popupClose(){
if(this.currentChosen!=this.current){
this.$emit('close',this.currentChosen)
}else{
this.$emit('close',-1)
}
}
},
};
</script>
<style>
.coupon {
min-height: 70vh;
background: #f5f5f5;
padding-bottom: 50px;
text-align: left !important;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
overflow: hidden;
}
.coupon .title {
font-size: 22px;
color: #000;
padding: 20px;
background: #fff;
}
.coupon .chosentips {
padding: 12px 20px;
border-bottom: 1px solid #f5f5f5;
border-top: 1px solid #f5f5f5;
color: #777;
background: #fff;
font-size: 12px;
}
.coupon .details {
padding: 10px;
display: flex;
flex-direction: column;
}
.coupon .details .item {
display: flex;
margin-bottom: 10px;
align-items: flex-start;
background: #fff;
}
.coupon .details .item .ticket {
position: relative;
background-image: linear-gradient(
to bottom right,
rgb(95, 154, 220),
rgb(112, 125, 195)
);
width: 125px;
height: 100px;
display: flex;
align-items: center;
color: #fff;
}
.coupon .details .item .ticket .miane .money {
font-family: "oswald";
font-weight: bold;
size: 64px;
width: 125px;
text-align: center;
}
.coupon .details .item .ticket .miane .money .small {
font-size: 20px;
}
.coupon .details .item .ticket .miane .tiaojian {
font-size: 14px;
width: 125px;
text-align: center;
}
.coupon .details .item .detail {
width: 1px;
flex: 1;
background: #fff;
padding: 10px;
display: flex;
align-items: flex-end;
}
.coupon .details .item .detail .coupond {
flex: 1;
}
.coupon .details .item .detail .coupond .name {
font-size: 13px;
font-weight: 600;
color: #000;
}
.coupon .details .item .detail .coupond .date {
margin-top: 5px;
font-size: 11px;
color: #777;
}
.coupon .details .item .detail .coupond .rule{
font-size: 11px;
color:#777;
margin-top: 5px;
}
.coupon .details .item .detail .chosen {
width: 20px;
}
.coupon .details .item .ticket:before {
content: "";
display: block;
width: 12px;
height: 100%;
background-size: 12px 12px; /* 一个repeat的大小 */
background-repeat: repeat-y;
background-image: radial-gradient(#f5f5f5 4px, transparent 4px);
position: absolute;
top: 0;
}
.coupon .details .item .ticket:before {
left: -6px;
}
.pesongBox .btton-box {
height: 50px;
display: flex;
padding: 5px 10px;
border-top: 1px solid #f5f5f5;
position: fixed;
bottom: 0;
left: 0;
right: 0;
align-items: center;
background: #fff;
}
</style>
......@@ -6,7 +6,7 @@
v-model="value"
:maskCloseAble="maskCloseAble"
length="auto"
:safeAreaInsetBottom="safeAreaInsetBottom"
:safeAreaInsetBottom="true"
@close="popupClose"
:z-index="9999"
close-icon="cross"
......@@ -52,31 +52,31 @@
<text class="label">购买数量</text>
<u-number-box
:disabled="!skuObj"
:value="gc"
v-model="gc"
:min="1"
:max="goodamount"
@change="valChange"
></u-number-box>
</view>
</view>
<view class="btn-box">
<view style="flex: 1;" v-if="optionType != 1">
<u-button
@click="joinCar"
:ripple="true"
:hair-line="false"
:custom-style="btn1"
>加入购物车</u-button
>
</view>
<view style="flex: 1;" v-if="optionType != 0">
<u-button
@click="buy"
:ripple="true"
:hair-line="false"
:custom-style="btn2"
>立即购买</u-button
>
<view class="btn-box">
<view style="flex: 1;" v-if="optionType != 1">
<u-button
@click="joinCar"
:ripple="true"
:hair-line="false"
:custom-style="btn1"
>加入购物车</u-button
>
</view>
<view style="flex: 1;" v-if="optionType != 0">
<u-button
@click="buy"
:ripple="true"
:hair-line="false"
:custom-style="btn2"
>立即购买</u-button
>
</view>
</view>
</view>
</u-popup>
......@@ -100,7 +100,7 @@ export default {
},
safeAreaInsetBottom: {
type: Boolean,
default: false,
default: true,
},
good: {
type: Object,
......@@ -147,6 +147,20 @@ export default {
g: {},
skuObj: null,
notStockGood: [],
forms:{
list: [
{
mch_id: 0,
goods_list: [],
distance: 0,
remark: "",
order_form: [],
use_integral: 0,
user_coupon_id: 0,
},
],
address_id: 0,
}
};
},
mounted() {
......@@ -160,7 +174,7 @@ export default {
this.goodamount = this.skuObj.stock;
} else {
this.goodimage = this.g.cover_pic;
this.goodprice = this.g.price_min;
this.goodprice = this.g.price_min && this.g.price_min!="" ?this.g.price_min:this.g.price_content;
this.goodamount = this.g.goods_stock;
}
this.bian = this.$utils.is_biang;
......@@ -190,13 +204,13 @@ export default {
methods: {
joinCar() {
let h = this.apiheader();
h['content-type']='application/x-www-form-urlencoded'
h["content-type"] = "application/x-www-form-urlencoded";
if (this.skuObj && this.skuObj.id) {
this.request(
{
url: "",
data: {
r: 'api/cart/add',
r: "api/cart/add",
goods_id: this.g.id,
attr: this.skuObj.id,
num: this.gc == 0 ? 1 : this.gc,
......@@ -215,10 +229,43 @@ export default {
);
} else {
uni.showToast({
title: '请选择商品',
position:"bottom",
icon:"none",
duration: 2000
title: "请选择商品",
position: "bottom",
icon: "none",
duration: 2000,
});
}
},
buy() {
if (this.skuObj && this.skuObj.id) {
let g = {
id: this.skuObj.goods_id,
num: this.gc,
cart_id: 0,
goods_attr_id: this.skuObj.id,
attr: [],
};
this.skuObj.attr_list.forEach((x) => {
g.attr.push({
attr_id: x.attr_id,
attr_group_id: x.attr_group_id,
});
});
this.forms.list[0].goods_list.push(g)
this.forms.list[0].mch_id=this.g.mch_id
uni.navigateTo({
url:
"/pages/order-submit/order-submit?formData=" + encodeURIComponent(JSON.stringify(this.forms)),
complete(res) {
console.log(res);
},
});
} else {
uni.showToast({
title: "请选择商品",
position: "bottom",
icon: "none",
duration: 2000,
});
}
},
......@@ -256,7 +303,7 @@ export default {
this.sku = unchosen;
this.skuObj = null;
this.goodimage = this.g.cover_pic;
this.goodprice = this.g.price_min;
this.goodprice = this.g.price_min && this.g.price_min!="" ?this.g.price_min:this.g.price_content;
this.goodamount = this.g.goods_stock;
} else {
this.sku = chosen;
......@@ -439,7 +486,7 @@ export default {
width: 1px;
flex: 1;
}
.btn-box {
.goodsku .btn-box {
display: flex;
background: #fff;
height: 60px;
......
......@@ -5,37 +5,54 @@
<view class="good" @click="clickHandler(cx.page_url)">
<view class="good-img">
<image
mode="aspectFit"
mode="aspectFill"
:src="cx.cover_pic"
style="width: 100%; height: 100%;"
/>
</view>
<view class="good-name">{{ cx.name }}</view>
<view class="good-name" v-if="setting.is_show_goods_name=='1'">{{ cx.name }}</view>
<view class="good-info">
<view class="price" :style="{ color: mainColor }">{{
cx.price_content
}}</view>
<view class="sell">{{ cx.sales }}</view>
<view class="cart">
<view class="sell" v-if="setting.is_show_sales_num=='1'">{{ cx.sales }}</view>
<view v-if="setting.is_show_cart=='1'" class="cart" @click.stop="showSkuHandler(cx)">
<u-icon name="cart-o" size="40" :color="mainColor" />
</view>
</view>
</view>
</u-col>
</u-row>
<good-sku
v-if="showSku"
:option-type="2"
borderRadius="20"
v-model="showSku"
:good="sku"
></good-sku>
</view>
</template>
<script>
import goodSku from "../goods/goodsku";
export default {
components: {
goodSku,
},
props: ["list"],
data() {
return {
g: [],
showSku: false,
sku: {},
mainColor: "",
setting:{}
};
},
mounted() {
this.g = this.list;
this.mainColor = this.$uiConfig.mainColor;
this.initConfig()
},
watch: {
list: {
......@@ -43,15 +60,22 @@ export default {
immediate: true,
handler: function (newVal, oldVal) {
this.g = newVal;
}
},
},
},
methods: {
initConfig() {
this.setting = uni.getStorageSync("basedata").mall.setting
},
clickHandler(url) {
uni.navigateTo({
url: url,
});
},
showSkuHandler(g) {
this.sku = g;
this.showSku = true;
},
},
};
</script>
......
<template>
<u-popup
mode="bottom"
border-radius="20"
:popup="false"
v-model="show"
:maskCloseAble="true"
length="auto"
:safeAreaInsetBottom="true"
@close="popupClose"
:z-index="9999"
close-icon="cross"
:closeable="true"
>
<scroll-view
:scroll-y="true"
:enable-back-to-top="true"
:enable-flex="true"
class="ordergoodlist"
>
<view class="title-box">
<view class="title">商品清单</view>
<view class="tips">共6件</view>
</view>
<view class="goodbox update-goodbox" v-for="(y, i) in list" :key="i">
<image :src="y.cover_pic" mode="aspectFill" class="image" />
<view class="goodinfo">
<view class="name">{{ y.name }}</view>
<view class="attr">已选择 {{ y.attrStr }}</view>
<view class="price">
<view class="left" :style="{ color: mc }">
<text class="small"></text>
<text>{{ y.goods_attr.price.split(".")[0] }}</text>
<text class="small"
>.{{ y.goods_attr.price.split(".")[1] || "00" }}</text
>
</view>
<view class="right">x{{ y.num }}</view>
</view>
</view>
</view>
</scroll-view>
</u-popup>
</template>
<script>
export default {
props: ["list"],
data() {
return {
show: true,
mc: "",
};
},
mounted() {
this.mc = this.$uiConfig.mainColor;
},
methods: {
popupClose() {
this.$emit("close");
},
},
};
</script>
<style>
.ordergoodlist {
height: 75vh;
padding-bottom: 50px;
text-align: left !important;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
overflow-y: auto;
position: relative;
padding: 69px 10px 0 10px;
}
.ordergoodlist .title-box {
display: flex;
align-items: center;
position: fixed;
top: 0;
left: 0;
right: 0;
background: #fff;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
overflow: hidden;
z-index: 2;
}
.ordergoodlist .title-box .title {
font-size: 22px;
color: #000;
padding: 20px;
background: #fff;
flex: 1;
}
.ordergoodlist .title-box .tips {
font-size: 13px;
color: #777;
flex: 1;
text-align: right;
padding-right: 12px;
}
.ordergoodlist .goodbox.update-goodbox {
width: calc(100% - 20px);
padding-bottom: 10px;
border-bottom: 1px solid #f5f5f5;
margin-bottom: 10px;
}
.ordergoodlist .goodbox.update-goodbox:last-child {
border: none;
}
</style>
<template>
<u-popup
mode="bottom"
border-radius="20"
:popup="false"
v-model="show"
:maskCloseAble="true"
length="auto"
:safeAreaInsetBottom="true"
@close="popupClose"
:z-index="9999"
close-icon="cross"
:closeable="true"
>
<scroll-view
:scroll-y="true"
:enable-back-to-top="true"
:enable-flex="true"
class="ordergoodlist2"
style="margin-bottom: 20rpx;"
>
<view class="title-box">
<view class="title">商品清单</view>
<view class="tips">{{list.length}}</view>
</view>
<view class="goodbox update-goodbox" v-for="(cx, i) in list" :key="i">
<image :src="cx.goods_info.pic_url" style="width: 100px; height: 100px" />
<view style="width: calc(100% - 110px);height: 100px;display: flex;flex-direction: column;margin-left: 10px;justify-content: space-between;">
<Text class='topic_cont_text' >{{cx.goods_info.name}}</Text>
<view style='width: calc(100% - 110px);overflow: hidden;white-space: nowrap;text-overflow: ellipsis;'>
<view v-for="(attr, index2) in cx.goods_info.attr_list" :key="index2" >
<Text style='color: #A0A09D;font-size: 24rpx;margin-right: 5rpx;'>规格:{{attr.attr_name}}</Text>
</view>
</view>
<view style="width: 100%;display: flex;flex-direction: row;align-items:center;justify-content: space-between;">
<view class="left" :style="{ color: mc }">
<text class="small"></text>
<text style='font-size: 40rpx;'>{{ cx.unit_price.split(".")[0] }}</text>
<text class="small"
>.{{ cx.unit_price.split(".")[1] || "00" }}</text
>
</view>
<Text style='color: #A0A09D;font-size: 24rpx;'>X{{cx.num}}</Text>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
</u-popup>
</template>
<script>
export default {
props: ["list"],
data() {
return {
show: true,
mc: "",
};
},
mounted() {
this.mc = this.$uiConfig.mainColor;
console.log(this.mc)
},
methods: {
popupClose() {
this.$emit("close");
},
},
};
</script>
<style>
.ordergoodlist2 {
height: 75vh;
padding-bottom: 50px;
text-align: left !important;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
overflow-y: auto;
position: relative;
padding: 69px 10px 0 10px;
}
.ordergoodlist2 .title-box {
display: flex;
align-items: center;
position: fixed;
top: 0;
left: 0;
right: 0;
background: #fff;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
overflow: hidden;
z-index: 2;
}
.ordergoodlist2 .title-box .title {
font-size: 22px;
color: #000;
padding: 20px;
background: #fff;
flex: 1;
}
.ordergoodlist2 .title-box .tips {
font-size: 13px;
color: #777;
flex: 1;
text-align: right;
padding-right: 12px;
}
.ordergoodlist2 .goodbox.update-goodbox {
width: 100%;
padding-bottom: 10px;
border-bottom: 1px solid #f5f5f5;
margin-bottom: 10px;
display: flex;
}
.ordergoodlist2 .goodbox.update-goodbox:last-child {
border: none;
}
.ordergoodlist2 .image{
width: 160rpx;
height: 160rpx;
}
.ordergoodlist2 .topic_cont_text{
font-size: 26rpx;
max-height: 80rpx;
overflow: hidden;
word-break: break-all; /* break-all(允许在单词内换行。) */
text-overflow: ellipsis; /* 超出部分省略号 */
display: -webkit-box; /** 对象作为伸缩盒子模型显示 **/
-webkit-box-orient: vertical; /** 设置或检索伸缩盒对象的子元素的排列方式 **/
-webkit-line-clamp: 2; /** 显示的行数 **/
}
</style>
......@@ -10,7 +10,7 @@
v-for="(item, gli) in goodList"
:key="gli"
class="good-one"
@click="openGood"
@click="openGood(item.page_url)"
:style="{
border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
background:
......@@ -48,7 +48,7 @@
<span class="price" :style="{ color: mainColor }">{{
goodsInfo.showGoodsPrice ? item.price : ""
}}</span>
<span class="buy" v-if="goodsInfo.showBuyBtn">
<span class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
<u-icon
name="cart-o"
size="40"
......@@ -84,16 +84,23 @@
</div>
</div>
</div>
<good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
</div>
</template>
<script>
import goodSku from '../goods/goodsku'
export default {
components:{
goodSku
},
props: ["goodList", "goodsInfo"],
data() {
return {
mainColor: "",
activeKey: 0,
showSku:false,
sku:{}
};
},
created() {
......@@ -101,9 +108,15 @@ export default {
this.mainColor = this.$uiConfig.mainColor;
},
methods: {
openGood() {
console.log();
openGood(url) {
uni.navigateTo({
url: url
});
},
showSkuHandler(g){
this.sku=g
this.showSku=true
}
},
};
</script>
......
......@@ -13,7 +13,7 @@
v-for="(item, gli) in goodList"
:key="gli"
>
<div class="good-three" @click="openGood" :style="{
<div class="good-three" @click="openGood(item.page_url)" :style="{
border:
goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
background:
......@@ -45,7 +45,7 @@
<view class="price" :style="{'color':mainColor}">{{
goodsInfo.showGoodsPrice ? item.price : ""
}}</view>
<view class="buy" v-if="goodsInfo.showBuyBtn">
<view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
<u-icon
name="cart-o"
size="40"
......@@ -87,25 +87,38 @@
</div>
</u-col>
</u-row>
<good-sku v-if="showSku" borderRadius="20" v-model="showSku" :good="sku" :option-type="2"></good-sku>
</div>
</template>
<script>
import goodSku from '../goods/goodsku'
export default {
components:{
goodSku
},
props: ["goodList", "goodsInfo"],
data() {
return {
mainColor: "",
activeKey: 0,
showSku:false,
sku:{}
};
},
created() {
this.mainColor = this.$uiConfig.mainColor;
},
methods: {
openGood(e) {
console.log(e);
openGood(url) {
uni.navigateTo({
url: url
});
},
showSkuHandler(g){
this.sku=g
this.showSku=true
}
},
};
</script>
......
......@@ -11,7 +11,7 @@
class="good-four"
v-for="(item, gli) in goodList"
:key="gli"
@click="openGood"
@click="openGood(item.page_url)"
:style="{
border: goodsInfo.goodsStyle == 2 ? '1px solid rgb(226, 226, 226)' : '',
background:
......@@ -40,7 +40,7 @@
<view class="price" :style="{'color':mainColor}">{{
goodsInfo.showGoodsPrice ? item.price : ""
}}</view>
<view class="buy" v-if="goodsInfo.showBuyBtn">
<view class="buy" v-if="goodsInfo.showBuyBtn" @click.stop="showSkuHandler(item)">
<u-icon
name="cart-o"
size="40"
......@@ -76,16 +76,23 @@
</view>
</view>
</view>
<good-sku v-if="showSku" :option-type="2" borderRadius="20" v-model="showSku" :good="sku"></good-sku>
</view>
</template>
<script>
import goodSku from '../goods/goodsku'
export default {
components:{
goodSku
},
props: ["goodList", "goodsInfo"],
data() {
return {
mainColor: "",
activeKey: 0,
showSku:false,
sku:{}
};
},
created() {
......@@ -93,9 +100,15 @@ export default {
this.mainColor = this.$uiConfig.mainColor;
},
methods: {
openGood(e) {
console.log(e);
openGood(url) {
uni.navigateTo({
url: url
});
},
showSkuHandler(g){
this.sku=g
this.showSku=true
}
},
};
</script>
......
......@@ -9,7 +9,7 @@
:custom-style='postionStyle'
readonly
/> -->
<view class="search-box" :style="{ background: bg }">
<view class="search-box" :style="{ background: bg }" @click="goSearch">
<u-search
:placeholder="styleStr.placeholder"
v-model="val"
......@@ -51,6 +51,13 @@ export default {
// }
//console.log(this.postionStyle);
},
methods: {
goSearch(){
uni.navigateTo({
url: '/pages/search/search'
});
}
},
};
</script>
......
......@@ -22,7 +22,7 @@ export default {
};
},
created() {
this.u = wx.getStorageSync("userinfo");
this.u = uni.getStorageSync("userinfo");
if (!this.u) {
this.u = {
nickName: "未登录",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
<template>
<view class="w-picker-view">
<picker-view class="d-picker-view" :indicator-style="itemHeight" :value="pickVal" @change="handlerChange">
<picker-view-column v-for="(group,gIndex) in range" :key="gIndex">
<view class="w-picker-item" v-for="(item,index) in group" :key="index">{{item[nodeKey]}}</view>
</picker-view-column>
</picker-view>
</view>
</template>
<script>
export default {
data() {
return {
pickVal:[],
range:[],
checkObj:{}
};
},
props:{
itemHeight:{
type:String,
default:"44px"
},
value:{
type:[Array,String],
default:""
},
defaultType:{
type:String,
default:"label"
},
options:{
type:Array,
default(){
return []
}
},
defaultProps:{
type:Object,
default(){
return{
lable:"label",
value:"value",
children:"children"
}
}
},
level:{
//多级联动层级,表示几级联动
type:[Number,String],
default:2
}
},
computed:{
nodeKey(){
return this.defaultProps.label;
},
nodeVal(){
return this.defaultProps.value;
},
nodeChild(){
return this.defaultProps.children;
}
},
watch:{
value(val){
if(this.options.length!=0){
this.initData();
}
},
options(val){
this.initData();
}
},
created() {
if(this.options.length!=0){
this.initData();
}
},
methods:{
getData(){
//用来处理初始化数据
let options=this.options;
let col1={},col2={},col3={},col4={};
let arr1=options,arr2=[],arr3=[],arr4=[];
let col1Index=0,col2Index=0,col3Index=0,col4Index=0;
let a1="",a2="",a3="",a4="";
let dVal=[],obj={};
let value=this.value;
let data=[];
a1=value[0];
a2=value[1];
if(this.level>2){
a3=value[2];
}
if(this.level>3){
a4=value[3];
};
/*第1列*/
col1Index=arr1.findIndex((v)=>{
return v[this.defaultType]==a1
});
col1Index=value?(col1Index!=-1?col1Index:0):0;
col1=arr1[col1Index];
/*第2列*/
arr2=arr1[col1Index][this.nodeChild];
col2Index=arr2.findIndex((v)=>{
return v[this.defaultType]==a2
});
col2Index=value?(col2Index!=-1?col2Index:0):0;
col2=arr2[col2Index];
/*第3列*/
if(this.level>2){
arr3=arr2[col2Index][this.nodeChild];
col3Index=arr3.findIndex((v)=>{
return v[this.defaultType]==a3;
});
col3Index=value?(col3Index!=-1?col3Index:0):0;
col3=arr3[col3Index];
};
/*第4列*/
if(this.level>3){
arr4=arr3[col4Index][this.nodeChild];
col4Index=arr4.findIndex((v)=>{
return v[this.defaultType]==a4;
});
col4Index=value?(col4Index!=-1?col4Index:0):0;
col4=arr4[col4Index];
};
switch(this.level*1){
case 2:
dVal=[col1Index,col2Index];
obj={
col1,
col2
}
data=[arr1,arr2];
break;
case 3:
dVal=[col1Index,col2Index,col3Index];
obj={
col1,
col2,
col3
}
data=[arr1,arr2,arr3];
break;
case 4:
dVal=[col1Index,col2Index,col3Index,col4Index];
obj={
col1,
col2,
col3,
col4
}
data=[arr1,arr2,arr3,arr4];
break
}
return {
data,
dVal,
obj
}
},
initData(){
let dataData=this.getData();
let data=dataData.data;
let arr1=data[0];
let arr2=data[1];
let arr3=data[2]||[];
let arr4=data[3]||[];
let obj=dataData.obj;
let col1=obj.col1,col2=obj.col2,col3=obj.col3||{},col4=obj.col4||{};
let result="",value=[];
let range=[];
switch(this.level){
case 2:
value=[col1[this.nodeVal],col2[this.nodeVal]];
result=`${col1[this.nodeKey]+col2[this.nodeKey]}`;
range=[arr1,arr2];
break;
case 3:
value=[col1[this.nodeVal],col2[this.nodeVal],col3[this.nodeVal]];
result=`${col1[this.nodeKey]+col2[this.nodeKey]+col3[this.nodeKey]}`;
range=[arr1,arr2,arr3];
break;
case 4:
value=[col1[this.nodeVal],col2[this.nodeVal],col3[this.nodeVal],col4[this.nodeVal]];
result=`${col1[this.nodeKey]+col2[this.nodeKey]+col3[this.nodeKey]+col4[this.nodeKey]}`;
range=[arr1,arr2,arr3,arr4];
break;
}
this.range=range;
this.checkObj=obj;
this.$nextTick(()=>{
this.pickVal=dataData.dVal;
});
this.$emit("change",{
result:result,
value:value,
obj:obj
})
},
handlerChange(e){
let arr=[...e.detail.value];
let col1Index=arr[0],col2Index=arr[1],col3Index=arr[2]||0,col4Index=arr[3]||0;
let arr1=[],arr2=[],arr3=[],arr4=[];
let col1,col2,col3,col4,obj={};
let result="",value=[];
arr1=this.options;
arr2=(arr1[col1Index]&&arr1[col1Index][this.nodeChild])||arr1[arr1.length-1][this.nodeChild]||[];
col1=arr1[col1Index]||arr1[arr1.length-1]||{};
col2=arr2[col2Index]||arr2[arr2.length-1]||{};
if(this.level>2){
arr3=(arr2[col2Index]&&arr2[col2Index][this.nodeChild])||arr2[arr2.length-1][this.nodeChild];
col3=arr3[col3Index]||arr3[arr3.length-1]||{};
}
if(this.level>3){
arr4=(arr3[col3Index]&&arr3[col3Index][this.nodeChild])||arr3[arr3.length-1][this.nodeChild]||[];
col4=arr4[col4Index]||arr4[arr4.length-1]||{};
}
switch(this.level){
case 2:
obj={
col1,
col2
}
this.range=[arr1,arr2];
result=`${(col1[this.nodeKey]||'')+(col2[this.nodeKey]||'')}`;
value=[col1[this.nodeVal]||'',col2[this.nodeVal]||''];
break;
case 3:
obj={
col1,
col2,
col3
}
this.range=[arr1,arr2,arr3];
result=`${(col1[this.nodeKey]||'')+(col2[this.nodeKey]||'')+(col3[this.nodeKey]||'')}`;
value=[col1[this.nodeVal]||'',col2[this.nodeVal]||'',col3[this.nodeVal]||''];
break;
case 4:
obj={
col1,
col2,
col3,
col4
}
this.range=[arr1,arr2,arr3,arr4];
result=`${(col1[this.nodeKey]||'')+(col2[this.nodeKey]||'')+(col3[this.nodeKey]||'')+(col4[this.nodeKey]||'')}`;
value=[col1[this.nodeVal]||'',col2[this.nodeVal]||'',col3[this.nodeVal]||'',col4[this.nodeVal]||''];
break;
}
this.checkObj=obj;
this.pickVal=arr;
this.$emit("change",{
result:result,
value:value,
obj:obj
})
}
}
}
</script>
<style lang="scss">
@import "./w-picker.css";
</style>
This diff is collapsed.
<template>
<view class="w-picker-view">
<picker-view class="d-picker-view" :indicator-style="itemHeight" :value="pickVal" @change="handlerChange">
<picker-view-column>
<view class="w-picker-item" v-for="(item,index) in range.provinces" :key="index">{{item.label}}</view>
</picker-view-column>
<picker-view-column>
<view class="w-picker-item" v-for="(item,index) in range.citys" :key="index">{{item.label}}</view>
</picker-view-column>
<picker-view-column v-if="!hideArea">
<view class="w-picker-item" v-for="(item,index) in range.areas" :key="index">{{item.label}}</view>
</picker-view-column>
</picker-view>
</view>
</template>
<script>
import areaData from "./areadata/areadata.js"
export default {
data() {
return {
pickVal:[],
range:{
provinces:[],
citys:[],
areas:[]
},
checkObj:{}
};
},
props:{
itemHeight:{
type:String,
default:"44px"
},
value:{
type:[Array,String],
default:""
},
defaultType:{
type:String,
default:"label"
},
hideArea:{
type:Boolean,
default:false
}
},
watch:{
value(val){
this.initData();
}
},
created() {
this.initData();
},
methods:{
getData(){
//用来处理初始化数据
let provinces=areaData;
let dVal=[];
let value=this.value;
let a1=value[0];//默认值省
let a2=value[1];//默认值市
let a3=value[2];//默认值区、县
let province,city,area;
let provinceIndex=provinces.findIndex((v)=>{
return v[this.defaultType]==a1
});
provinceIndex=value?(provinceIndex!=-1?provinceIndex:0):0;
let citys=provinces[provinceIndex].children;
let cityIndex=citys.findIndex((v)=>{
return v[this.defaultType]==a2
});
cityIndex=value?(cityIndex!=-1?cityIndex:0):0;
let areas=citys[cityIndex].children;
let areaIndex=areas.findIndex((v)=>{
return v[this.defaultType]==a3;
});
areaIndex=value?(areaIndex!=-1?areaIndex:0):0;
dVal=this.hideArea?[provinceIndex,cityIndex]:[provinceIndex,cityIndex,areaIndex];
province=provinces[provinceIndex];
city=citys[cityIndex];
area=areas[areaIndex];
let obj=this.hideArea?{
province,
city
}:{
province,
city,
area
}
return this.hideArea?{
provinces,
citys,
dVal,
obj
}:{
provinces,
citys,
areas,
dVal,
obj
}
},
initData(){
let dataData=this.getData();
let provinces=dataData.provinces;
let citys=dataData.citys;
let areas=this.hideArea?[]:dataData.areas;
let obj=dataData.obj;
let province=obj.province,city=obj.city,area=this.hideArea?{}:obj.area;
let value=this.hideArea?[province.value,city.value]:[province.value,city.value,area.value];
let result=this.hideArea?`${province.label+city.label}`:`${province.label+city.label+area.label}`;
this.range=this.hideArea?{
provinces,
citys,
}:{
provinces,
citys,
areas
};
this.checkObj=obj;
this.$nextTick(()=>{
this.pickVal=dataData.dVal;
});
this.$emit("change",{
result:result,
value:value,
obj:obj
})
},
handlerChange(e){
let arr=[...e.detail.value];
let provinceIndex=arr[0],cityIndex=arr[1],areaIndex=this.hideArea?0:arr[2];
let provinces=areaData;
let citys=(provinces[provinceIndex]&&provinces[provinceIndex].children)||provinces[provinces.length-1].children||[];
let areas=this.hideArea?[]:((citys[cityIndex]&&citys[cityIndex].children)||citys[citys.length-1].children||[]);
let province=provinces[provinceIndex]||provinces[provinces.length-1],
city=citys[cityIndex]||[citys.length-1],
area=this.hideArea?{}:(areas[areaIndex]||[areas.length-1]);
let obj=this.hideArea?{
province,
city
}:{
province,
city,
area
}
if(this.checkObj.province.label!=province.label){
//当省更新的时候需要刷新市、区县的数据;
this.range.citys=citys;
if(!this.hideArea){
this.range.areas=areas;
}
}
if(this.checkObj.city.label!=city.label){
//当市更新的时候需要刷新区县的数据;
if(!this.hideArea){
this.range.areas=areas;
}
}
this.checkObj=obj;
this.$nextTick(()=>{
this.pickVal=arr;
})
let result=this.hideArea?`${province.label+city.label}`:`${province.label+city.label+area.label}`;
let value=this.hideArea?[province.value,city.value]:[province.value,city.value,area.value];
this.$emit("change",{
result:result,
value:value,
obj:obj
})
}
}
}
</script>
<style lang="scss">
@import "./w-picker.css";
</style>
<template>
<view class="w-picker-view">
<picker-view class="d-picker-view" :indicator-style="itemHeight" :value="pickVal" @change="handlerChange">
<picker-view-column>
<view class="w-picker-item" v-for="(item,index) in range" :key="index">{{item[nodeKey]}}</view>
</picker-view-column>
</picker-view>
</view>
</template>
<script>
export default {
props:{
itemHeight:{
type:String,
default:"44px"
},
options:{
type:[Array,Object],
default(){
return []
}
},
value:{
type:String,
default:""
},
defaultType:{
type:String,
default:"label"
},
defaultProps:{
type:Object,
default(){
return{
label:"label",
value:"value"
}
}
}
},
data() {
return {
pickVal:[]
};
},
computed:{
nodeKey(){
return this.defaultProps.label;
},
nodeValue(){
return this.defaultProps.value;
},
range(){
return this.options
}
},
watch:{
value(val){
if(this.options.length!=0){
this.initData();
}
},
options(val){
this.initData();
}
},
created() {
if(this.options.length!=0){
this.initData();
}
},
methods:{
initData(){
let dVal=this.value||"";
let data=this.range;
let pickVal=[0];
let cur=null;
let label="";
let value,idx;
if(this.defaultType==this.nodeValue){
value=data.find((v)=>v[this.nodeValue]==dVal);
idx=data.findIndex((v)=>v[this.nodeValue]==dVal);
}else{
value=data.find((v)=>v[this.nodeKey]==dVal);
idx=data.findIndex((v)=>v[this.nodeKey]==dVal);
}
pickVal=[idx!=-1?idx:0];
this.$nextTick(()=>{
this.pickVal=pickVal;
});
if(this.defaultType==this.nodeValue){
this.$emit("change",{
result:value?value[this.nodeKey]:data[0][this.nodeKey],
value:dVal||data[0][this.nodeKey],
obj:value?value:data[0]
})
}else{
this.$emit("change",{
result:dVal||data[0][this.nodeKey],
value:value?value[this.nodeValue]:data[0][this.nodeValue],
obj:value?value:data[0]
})
}
},
handlerChange(e){
let arr=[...e.detail.value];
let pickVal=[arr[0]||0];
let data=this.range;
let cur=data[arr[0]];
let label="";
let value="";
this.$nextTick(()=>{
this.pickVal=pickVal;
});
this.$emit("change",{
result:cur[this.nodeKey],
value:cur[this.nodeValue],
obj:cur
})
}
}
}
</script>
<style lang="scss">
@import "./w-picker.css";
</style>
<template>
<view class="w-picker-view">
<picker-view class="d-picker-view" :indicator-style="itemHeight" :value="pickVal" @change="handlerChange">
<picker-view-column>
<view class="w-picker-item" v-for="(item,index) in range.dates" :key="index">{{item.label}}</view>
</picker-view-column>
<picker-view-column>
<view class="w-picker-item" v-for="(item,index) in range.hours" :key="index">{{item.label}}</view>
</picker-view-column>
<picker-view-column>
<view class="w-picker-item" v-for="(item,index) in range.minutes" :key="index">{{item.label}}</view>
</picker-view-column>
</picker-view>
</view>
</template>
<script>
export default {
data() {
return {
pickVal:[],
range:{},
checkObj:{}
};
},
props:{
itemHeight:{
type:String,
default:"44px"
},
value:{
type:[String,Array,Number],
default:""
},
current:{//是否默认选中当前日期
type:Boolean,
default:false
},
expand:{
type:[Number,String],
default:30
}
},
watch:{
value(val){
this.initData();
}
},
created() {
this.initData();
},
methods:{
formatNum(n){
return (Number(n)<10?'0'+Number(n):Number(n)+'');
},
checkValue(value){
let strReg=/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}(:\d{2})?$/,example="2019-12-12 18:05:00或者2019-12-12 18:05";
if(!strReg.test(value)){
console.log(new Error("请传入与mode、fields匹配的value值,例value="+example+""))
}
return strReg.test(value);
},
resetData(year,month,day){
let curDate=this.getCurrenDate();
let curFlag=this.current;
let curYear=curDate.curYear;
let curMonth=curDate.curMonth;
let curDay=curDate.curDay;
let curHour=curDate.curHour;
let months=[],days=[],sections=[];
let disabledAfter=this.disabledAfter;
let monthsLen=disabledAfter?(year*1<curYear?12:curMonth):12;
let totalDays=new Date(year,month,0).getDate();//计算当月有几天;
for(let month=1;month<=monthsLen;month++){
months.push(this.formatNum(month));
};
for(let day=1;day<=daysLen;day++){
days.push(this.formatNum(day));
}
return{
months,
days,
sections
}
},
getData(dVal){
//用来处理初始化数据
let curFlag=this.current;
let disabledAfter=this.disabledAfter;
let dates=[],hours=[],minutes=[];
let curDate=new Date();
let curYear=curDate.getFullYear();
let curMonth=curDate.getMonth();
let curDay=curDate.getDate();
let aDate=new Date(curYear,curMonth,curDay);
for(let i=0;i<this.expand*1;i++){
aDate=new Date(curYear,curMonth,curDay+i);
let year=aDate.getFullYear();
let month=aDate.getMonth()+1;
let day=aDate.getDate();
let label=year+"-"+this.formatNum(month)+"-"+this.formatNum(day);
switch(i){
case 0:
label="今天";
break;
case 1:
label="明天";
break;
case 2:
label="后天";
break
}
dates.push({
label:label,
value:year+"-"+this.formatNum(month)+"-"+this.formatNum(day)
})
};
for(let i=0;i<24;i++){
hours.push({
label:this.formatNum(i),
value:this.formatNum(i)
})
}
for(let i=0;i<60;i++){
minutes.push({
label:this.formatNum(i),
value:this.formatNum(i)
})
}
return {
dates,
hours,
minutes
}
},
getDefaultDate(){
let value=this.value;
let reg=/-/g;
let defaultDate=value?new Date(value.replace(reg,"/")):new Date();
let defaultYear=defaultDate.getFullYear();
let defaultMonth=defaultDate.getMonth()+1;
let defaultDay=defaultDate.getDate();
let defaultDays=new Date(defaultYear,defaultMonth,0).getDate()*1;
return{
defaultDate,
defaultYear,
defaultMonth,
defaultDay,
defaultDays
}
},
getDval(){
let value=this.value;
let dVal=null;
let aDate=new Date();
let year=this.formatNum(aDate.getFullYear());
let month=this.formatNum(aDate.getMonth()+1);
let day=this.formatNum(aDate.getDate());
let date=this.formatNum(year)+"-"+this.formatNum(month)+"-"+this.formatNum(day);
let hour=aDate.getHours();
let minute=aDate.getMinutes();
if(value){
let flag=this.checkValue(value);
if(!flag){
dVal=[date,hour,minute]
}else{
let v=value.split(" ");
dVal=[v[0],...v[1].split(":")];
}
}else{
dVal=[date,hour,minute]
}
return dVal;
},
initData(){
let startDate,endDate,startYear,endYear,startMonth,endMonth,startDay,endDay;
let dates=[],hours=[],minutes=[];
let dVal=[],pickVal=[];
let value=this.value;
let reg=/-/g;
let range={};
let result="",full="",date,hour,minute,obj={};
let defaultDate=this.getDefaultDate();
let defaultYear=defaultDate.defaultYear;
let defaultMonth=defaultDate.defaultMonth;
let defaultDay=defaultDate.defaultDay;
let defaultDays=defaultDate.defaultDays;
let curFlag=this.current;
let disabledAfter=this.disabledAfter;
let dateData=[];
dVal=this.getDval();
dateData=this.getData(dVal);
dates=dateData.dates;
hours=dateData.hours;
minutes=dateData.minutes;
pickVal=[
dates.findIndex(n => n.value == dVal[0])!=-1?dates.findIndex(n => n.value == dVal[0]):0,
hours.findIndex(n => n.value == dVal[1])!=-1?hours.findIndex(n => n.value == dVal[1]):0,
minutes.findIndex(n => n.value == dVal[2])!=-1?minutes.findIndex(n => n.value == dVal[2]):0,
];
range={dates,hours,minutes};
date=dVal[0]?dVal[0]:dates[0].label;
hour=dVal[1]?dVal[1]:hours[0].label;
minute=dVal[2]?dVal[2]:minutes[0].label;
result=full=`${date+' '+hour+':'+minute}`;
obj={
date,
hour,
minute
}
this.range=range;
this.checkObj=obj;
this.$nextTick(()=>{
this.pickVal=pickVal;
});
this.$emit("change",{
result:result,
value:full,
obj:obj
})
},
handlerChange(e){
let arr=[...e.detail.value];
let data=this.range;
let date="",hour="",minute="";
let result="",full="",obj={};
let disabledAfter=this.disabledAfter;
date=(arr[0]||arr[0]==0)?data.dates[arr[0]]||data.dates[data.dates.length-1]:"";
hour=(arr[1]||arr[1]==0)?data.hours[arr[1]]||data.hours[data.hours.length-1]:"";
minute=(arr[2]||arr[2]==0)?data.minutes[arr[2]]||data.minutes[data.minutes.length-1]:"";
result=full=`${date.label+' '+hour.label+':'+minute.label+':00'}`;
obj={
date,
hour,
minute
}
this.checkObj=obj;
this.$emit("change",{
result:result,
value:full,
obj:obj
})
}
}
}
</script>
<style lang="scss">
@import "./w-picker.css";
</style>
<template>
<view class="w-picker-view">
<picker-view class="d-picker-view" :indicator-style="itemHeight" :value="pickVal" @change="handlerChange">
<picker-view-column>
<view class="w-picker-item" v-for="(item,index) in range.hours" :key="index">{{item}}</view>
</picker-view-column>
<picker-view-column>
<view class="w-picker-item" v-for="(item,index) in range.minutes" :key="index">{{item}}</view>
</picker-view-column>
<picker-view-column v-if="second">
<view class="w-picker-item" v-for="(item,index) in range.seconds" :key="index">{{item}}</view>
</picker-view-column>
</picker-view>
</view>
</template>
<script>
export default {
data() {
return {
pickVal:[],
range:{},
checkObj:{}
};
},
props:{
itemHeight:{
type:String,
default:"44px"
},
value:{
type:[String,Array,Number],
default:""
},
current:{//是否默认选中当前日期
type:Boolean,
default:false
},
second:{
type:Boolean,
default:true
}
},
watch:{
value(val){
this.initData();
}
},
created() {
this.initData();
},
methods:{
formatNum(n){
return (Number(n)<10?'0'+Number(n):Number(n)+'');
},
checkValue(value){
let strReg=/^\d{2}:\d{2}:\d{2}$/,example="18:00:05";
if(!strReg.test(value)){
console.log(new Error("请传入与mode、fields匹配的value值,例value="+example+""))
}
return strReg.test(value);
},
resetData(year,month,day,hour,minute){
let curDate=this.getCurrenDate();
let curFlag=this.current;
let curHour=curDate.curHour;
let curMinute=curDate.curMinute;
let curSecond=curDate.curSecond;
for(let hour=0;hour<24;hour++){
hours.push(this.formatNum(hour));
}
for(let minute=0;minute<60;minute++){
minutes.push(this.formatNum(minute));
}
for(let second=0;second<60;second++){
seconds.push(this.formatNum(second));
}
return{
hours,
minutes,
seconds
}
},
getData(curDate){
//用来处理初始化数据
let hours=[],minutes=[],seconds=[];
let curFlag=this.current;
let disabledAfter=this.disabledAfter;
let fields=this.fields;
let curHour=curDate.curHour;
let curMinute=curDate.curMinute;
let curSecond=curDate.curSecond;
for(let hour=0;hour<24;hour++){
hours.push(this.formatNum(hour));
}
for(let minute=0;minute<60;minute++){
minutes.push(this.formatNum(minute));
}
for(let second=0;second<60;second++){
seconds.push(this.formatNum(second));
}
return this.second?{
hours,
minutes,
seconds
}:{
hours,
minutes
}
},
getCurrenDate(){
let curDate=new Date();
let curHour=curDate.getHours();
let curMinute=curDate.getMinutes();
let curSecond=curDate.getSeconds();
return this.second?{
curHour,
curMinute,
curSecond
}:{
curHour,
curMinute,
}
},
getDval(){
let value=this.value;
let fields=this.fields;
let dVal=null;
let aDate=new Date();
let hour=this.formatNum(aDate.getHours());
let minute=this.formatNum(aDate.getMinutes());
let second=this.formatNum(aDate.getSeconds());
if(value){
let flag=this.checkValue(value);
if(!flag){
dVal=[hour,minute,second]
}else{
dVal=value?value.split(":"):[];
}
}else{
dVal=this.second?[hour,minute,second]:[hour,minute]
}
return dVal;
},
initData(){
let curDate=this.getCurrenDate();
let dateData=this.getData(curDate);
let pickVal=[],obj={},full="",result="",hour="",minute="",second="";
let dVal=this.getDval();
let curFlag=this.current;
let disabledAfter=this.disabledAfter;
let hours=dateData.hours;
let minutes=dateData.minutes;
let seconds=dateData.seconds;
let defaultArr=this.second?[
dVal[0]&&hours.indexOf(dVal[0])!=-1?hours.indexOf(dVal[0]):0,
dVal[1]&&minutes.indexOf(dVal[1])!=-1?minutes.indexOf(dVal[1]):0,
dVal[2]&&seconds.indexOf(dVal[2])!=-1?seconds.indexOf(dVal[2]):0
]:[
dVal[0]&&hours.indexOf(dVal[0])!=-1?hours.indexOf(dVal[0]):0,
dVal[1]&&minutes.indexOf(dVal[1])!=-1?minutes.indexOf(dVal[1]):0
];
pickVal=disabledAfter?defaultArr:(curFlag?(this.second?[
hours.indexOf(this.formatNum(curDate.curHour)),
minutes.indexOf(this.formatNum(curDate.curMinute)),
seconds.indexOf(this.formatNum(curDate.curSecond)),
]:[
hours.indexOf(this.formatNum(curDate.curHour)),
minutes.indexOf(this.formatNum(curDate.curMinute))
]):defaultArr);
this.range=dateData;
this.checkObj=obj;
hour=dVal[0]?dVal[0]:hours[0];
minute=dVal[1]?dVal[1]:minutes[0];
if(this.second)second=dVal[2]?dVal[0]:seconds[0];
result=this.second?`${hour+':'+minute+':'+second}`:`${hour+':'+minute}`;
full=this.second?`${hour+':'+minute+':'+second}`:`${hour+':'+minute+':00'}`;
this.$nextTick(()=>{
this.pickVal=pickVal;
});
this.$emit("change",{
result:result,
value:full,
obj:obj
})
},
handlerChange(e){
let arr=[...e.detail.value];
let data=this.range;
let hour="",minute="",second="",result="",full="",obj={};
hour=(arr[0]||arr[0]==0)?data.hours[arr[0]]||data.hours[data.hours.length-1]:"";
minute=(arr[1]||arr[1]==0)?data.minutes[arr[1]]||data.minutes[data.minutes.length-1]:"";
if(this.second)second=(arr[2]||arr[2]==0)?data.seconds[arr[2]]||data.seconds[data.seconds.length-1]:"";
obj=this.second?{
hour,
minute,
second
}:{
hour,
minute
};
this.checkObj=obj;
result=this.second?`${hour+':'+minute+':'+second}`:`${hour+':'+minute}`;
full=this.second?`${hour+':'+minute+':'+second}`:`${hour+':'+minute+':00'}`;
this.$emit("change",{
result:result,
value:full,
obj:obj
})
}
}
}
</script>
<style lang="scss">
@import "./w-picker.css";
</style>
.w-picker-flex2{
flex:2;
}
.w-picker-flex1{
flex:1;
}
.w-picker-view {
width: 100%;
height: 476upx;
overflow: hidden;
background-color: rgba(255, 255, 255, 1);
z-index: 666;
}
.d-picker-view{
height: 100%;
}
.w-picker-item {
text-align: center;
width: 100%;
height: 88upx;
line-height: 88upx;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 30upx;
}
\ No newline at end of file
<template name="w-picker">
<view class="w-picker" :key="createKey" :data-key="createKey">
<view class="mask" :class="{'visible':visible}" @tap="onCancel" @touchmove.stop.prevent catchtouchmove="true"></view>
<view class="w-picker-cnt" :class="{'visible':visible}">
<view class="w-picker-header" @touchmove.stop.prevent catchtouchmove="true">
<text @tap.stop.prevent="onCancel">取消</text>
<slot></slot>
<text :style="{'color':themeColor}" @tap.stop.prevent="pickerConfirm">确定</text>
</view>
<date-picker
v-if="mode=='date'"
class="w-picker-wrapper"
:startYear="startYear"
:endYear="endYear"
:value="value"
:fields="fields"
:item-height="itemHeight"
:current="current"
:disabled-after="disabledAfter"
@change="handlerChange"
@touchstart="touchStart"
@touchend="touchEnd">
</date-picker>
<range-picker
v-if="mode=='range'"
class="w-picker-wrapper"
:startYear="startYear"
:endYear="endYear"
:value="value"
:item-height="itemHeight"
:current="current"
@change="handlerChange"
@touchstart="touchStart"
@touchend="touchEnd">
</range-picker>
<half-picker
v-if="mode=='half'"
class="w-picker-wrapper"
:startYear="startYear"
:endYear="endYear"
:value="value"
:item-height="itemHeight"
:current="current"
:disabled-after="disabledAfter"
@change="handlerChange"
@touchstart="touchStart"
@touchend="touchEnd">
</half-picker>
<shortterm-picker
v-if="mode=='shortTerm'"
class="w-picker-wrapper"
:startYear="startYear"
:endYear="endYear"
:value="value"
:item-height="itemHeight"
:current="current"
expand="60"
:disabled-after="disabledAfter"
@change="handlerChange"
@touchstart="touchStart"
@touchend="touchEnd">
</shortterm-picker>
<time-picker
v-if="mode=='time'"
class="w-picker-wrapper"
:value="value"
:item-height="itemHeight"
:current="current"
:disabled-after="disabledAfter"
:second="second"
@change="handlerChange"
@touchstart="touchStart"
@touchend="touchEnd">
</time-picker>
<selector-picker
v-if="mode=='selector'"
class="w-picker-wrapper"
:value="value"
:item-height="itemHeight"
:options="options"
:default-type="defaultType"
:default-props="defaultProps"
@change="handlerChange"
@touchstart="touchStart"
@touchend="touchEnd">
</selector-picker>
<region-picker
v-if="mode=='region'"
class="w-picker-wrapper"
:value="value"
:hide-area="hideArea"
:default-type="defaultType"
:item-height="itemHeight"
@change="handlerChange"
@touchstart="touchStart"
@touchend="touchEnd">
</region-picker>
<linkage-picker
v-if="mode=='linkage'"
class="w-picker-wrapper"
:value="value"
:options="options"
:level="level"
:default-type="defaultType"
:default-props="defaultProps"
:item-height="itemHeight"
@change="handlerChange"
@touchstart="touchStart"
@touchend="touchEnd">
</linkage-picker>
</view>
</view>
</template>
<script>
import datePicker from "./date-picker.vue"
import rangePicker from "./range-picker.vue"
import halfPicker from "./half-picker.vue"
import shorttermPicker from "./shortterm-picker.vue"
import timePicker from "./time-picker.vue"
import selectorPicker from "./selector-picker.vue"
import regionPicker from "./region-picker.vue"
import linkagePicker from "./linkage-picker.vue"
export default {
name:"w-picker",
components:{
datePicker,
rangePicker,
halfPicker,
timePicker,
selectorPicker,
shorttermPicker,
regionPicker,
linkagePicker
},
props:{
mode:{
type:String,
default:"date"
},
value:{//默认值
type:[String,Array,Number],
default:""
},
current:{//是否默认显示当前时间,如果是,传的默认值将失效
type:Boolean,
default:false
},
themeColor:{//确认按钮主题颜色
type:String,
default:"#f5a200"
},
fields:{//日期颗粒度:year、month、day、hour、minute、second
type:String,
default:"date"
},
disabledAfter:{//是否禁用当前之后的日期
type:Boolean,
default:false
},
second:{//time-picker是否显示秒
type:Boolean,
default:true
},
options:{//selector,region数据源
type:[Array,Object],
default(){
return []
}
},
defaultProps:{//selector,linkagle字段转换配置
type:Object,
default(){
return{
label:"label",
value:"value",
children:"children"
}
}
},
defaultType:{
type:String,
default:"label"
},
hideArea:{//mode=region时,是否隐藏区县列
type:Boolean,
default:false
},
level:{
//多级联动层级,表示几级联动,区间2-4;
type:[Number,String],
default:2
},
timeout:{//是否开启点击延迟,当快速滚动 还没有滚动完毕点击关闭时得到的值是不准确的
type:Boolean,
default:false
},
expand:{//mode=shortterm 默认往后拓展天数
type:[Number,String],
default:30
},
startYear:{
type:[String,Number],
default:1970
},
endYear:{
type:[String,Number],
default:new Date().getFullYear()
}
},
created() {
this.createKey=Math.random()*1000;
},
data() {
return {
itemHeight:`height: ${uni.upx2px(88)}px;`,
visible:false,
result:{},
confirmFlag:true
};
},
methods:{
touchStart(){
if(this.timeout){
this.confirmFlag=false;
}
},
touchEnd(){
if(this.timeout){
setTimeout(()=>{
this.confirmFlag=true;
},500)
}
},
handlerChange(res){
let _this=this;
this.result={...res};
},
show(){
this.visible=true;
},
hide(){
this.visible=false;
},
onCancel(res){
this.visible=false;
this.$emit("cancel");
},
pickerConfirm(){
if(!this.confirmFlag){
return;
};
this.$emit("confirm",this.result);
this.visible=false;
}
}
}
</script>
<style lang="scss">
.w-picker-item {
text-align: center;
width: 100%;
height: 88upx;
line-height: 88upx;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 30upx;
}
.w-picker{
z-index: 888;
.mask {
position: fixed;
z-index: 1000;
top: 0;
right: 0;
left: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
visibility: hidden;
opacity: 0;
transition: all 0.3s ease;
}
.mask.visible{
visibility: visible;
opacity: 1;
}
.w-picker-cnt {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
transition: all 0.3s ease;
transform: translateY(100%);
z-index: 3000;
background-color: #fff;
}
.w-picker-cnt.visible {
transform: translateY(0);
}
.w-picker-header{
display: flex;
align-items: center;
padding: 0 30upx;
height: 88upx;
background-color: #fff;
position: relative;
text-align: center;
font-size: 32upx;
justify-content: space-between;
border-bottom: solid 1px #eee;
.w-picker-btn{
font-size: 30upx;
}
}
.w-picker-hd:after {
content: ' ';
position: absolute;
left: 0;
bottom: 0;
right: 0;
height: 1px;
border-bottom: 1px solid #e5e5e5;
color: #e5e5e5;
transform-origin: 0 100%;
transform: scaleY(0.5);
}
}
</style>
<template>
<view class="u-empty" v-if="show" :style="{
marginTop: marginTop + 'rpx'
marginTop: marginTop + 'rpx',
paddingTop: paddingTop + '%'
}">
<image class="u-image" :src="src ? src : icons[mode].image" mode="widthFix" :style="{
width: imgWidth + 'rpx',
......@@ -84,6 +85,10 @@
marginTop: {
type: [String, Number],
default: 0
},
paddingTop: {
type: [String, Number],
default: 30
}
},
data() {
......
......@@ -126,7 +126,7 @@
},
data() {
return {
inputVal: 0 // 输入框中的值,不能直接使用props中的value,因为应该改变props的状态
inputVal: 1 // 输入框中的值,不能直接使用props中的value,因为应该改变props的状态
};
},
created() {
......
......@@ -241,7 +241,7 @@
right: 0;
bottom: 0;
overflow: hidden;
z-index: 999;
z-index: 999999999;
}
.u-drawer-content {
......
......@@ -29,7 +29,7 @@
}, inputStyle]"
/>
<view class="u-close-wrap" v-if="keyword && clearabled && focused" @touchstart="clear">
<u-icon class="u-clear-icon" name="close" :size="16" color="#fff" @touchstart="clear"></u-icon>
<u-icon class="u-clear-icon" name="cross" :size="16" color="#fff" @touchstart="clear"></u-icon>
</view>
</view>
<view :style="[actionStyle]" class="u-action"
......
......@@ -7,8 +7,8 @@
]"
class="u-tag" :style="[customStyle]" @tap="clickTag">
{{text}}
<view class="u-icon-wrap" @tap.stop>
<u-icon @click="close" size="22" v-if="closeable" name="close" class="u-close-icon" :style="[iconStyle]"></u-icon>
<view class="u-icon-wrap" style="vertical-align: text-bottom;" @tap.stop>
<u-icon @click="close" size="28" v-if="closeable" name="cross" class="u-close-icon" :style="[iconStyle]"></u-icon>
</view>
</view>
</template>
......@@ -158,7 +158,10 @@
font-size: 22rpx;
padding: 12rpx 22rpx;
}
.u-size-big {
font-size: 26rpx;
padding: 22rpx;
}
.u-size-mini {
font-size: 20rpx;
padding: 6rpx 12rpx;
......
......@@ -3,8 +3,27 @@
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
},
"pages": [{
"path": "pages/order/index/index"
},
{
"path" : "pages/balance/balance"
},
{
"path": "pages/index/index"
},
{
"path": "pages/order-submit/order-submit"
},
{
"path": "pages/search/search"
},
{
"path": "pages/cart/cart"
},
{
"path": "pages/cats/cats"
},
{
"path": "pages/goods/goods"
},
......@@ -14,9 +33,6 @@
{
"path": "pages/user-center/user-center"
},
{
"path": "pages/index/index"
},
{
"path": "pages/foot/index/index"
},
......@@ -29,12 +45,6 @@
{
"path": "pages/address/address_chosen"
},
{
"path": "pages/cart/cart"
},
{
"path": "pages/cats/cats"
},
{
"path": "pages/address/AddAddress"
},
......@@ -43,6 +53,9 @@
},
{
"path": "pages/goods/list"
},
{
"path": "pages/order/index"
}
],
"globalStyle": {
......
......@@ -11,13 +11,13 @@
<Text>收货人</Text>
<input class="uni-input inputM" v-model="msg.name" />
</view>
<view style="width: 100%;height: 1px;background: #e4e7ed;"/>
<view style="width: 100%;height: 1px;background: #f5f5f5;"/>
<view class="addcenter_item2">
<Text>联系电话</Text>
<input class="uni-input inputM" v-model="msg.mobile" />
</view>
<view style="width: 100%;height: 1px;background: #e4e7ed;"/>
<view style="width: 100%;height: 1px;background: #f5f5f5;"/>
<!-- TODO 动态获取地址数据 -->
<view class="addcenter_item">
<Text>所在地区</Text>
......@@ -26,7 +26,7 @@
<u-icon name="arrow" color="#B2B2B2" size="30" ></u-icon>
</view>
</view>
<view style="width: 100%;height: 1px;background: #e4e7ed;"/>
<view style="width: 100%;height: 1px;background: #f5f5f5;"/>
<!-- TODO 定位地址 -->
<view class="addcenter_item">
<Text>定位地址</Text>
......@@ -35,7 +35,7 @@
<u-icon name="arrow" color="#B2B2B2" size="30" ></u-icon>
</view>
</view>
<view style="width: 100%;height: 1px;background: #e4e7ed;"/>
<view style="width: 100%;height: 1px;background: #f5f5f5;"/>
<view class="addcenter_item2">
<Text>详细地址</Text>
<input class="uni-input inputM" v-model="msg.detail" />
......@@ -53,6 +53,7 @@
export default {
data(){
return{
pageTitle:'收货地址',
contentHeight:0,
mainColor:'',
msg:{
......@@ -75,7 +76,9 @@
created(){
this.contentHeight = this.$utils.calcContentHeight(-40)+'px';
this.mainColor = this.$uiConfig.mainColor;
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
onLoad: function (option) { //option为object类型,会序列化上个页面传递的参数
if(option.u!=undefined){
......
......@@ -12,7 +12,7 @@
<Text>{{item.mobile}}</Text>
</view>
<Text style='width: 100%;'>收货地址:{{item.address}}</Text>
<view style="width: 100%;height: 2rpx;background: #EEEEEE;margin-top: 15rpx;"></view>
<view style="width: 100%;height: 2rpx;background: #f5f5f5;margin-top: 15rpx;"></view>
<view class="addresclo">
<u-checkbox-group @change="isdefault(item)">
<u-checkbox v-model="item.is_default==1?true:false" shape="circle" :active-color="mainColor">
......@@ -70,6 +70,7 @@ import auth from "../../components/auth/index.vue";
export default {
data() {
return {
pageTitle:'收货地址',
loading: true,
list: [],
showAuth: false,
......@@ -88,8 +89,22 @@ export default {
this.mainColor = this.$uiConfig.mainColor;
},
mounted() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
onLoad() {
console.log(wx.getStorageSync("basedata"));
this.u = wx.getStorageSync("userinfo");
if (!this.u) {
this.u = {
......@@ -190,9 +205,7 @@ export default {
});
}
},
mounted() {
}
};
</script>
......
<template>
<view class="balanceStyle" :style="{'height':contentHeight}" >
<view :style="{'backgroundImage':'url('+(g.setting.bj_pic_url.url?g.setting.bj_pic_url.url:'')+')',backgroundSize: 'cover'}" class="balance_top" >
<Text style='margin-top:50rpx ;color: #fff;;font-size: 24rpx;'>账户余额(元)</Text>
<Text style='margin-top:50rpx ;color: #fff;;font-size: 36px;'>{{g.balance}}</Text>
<view class="recharge">
<Text style='color: #fff;;font-size: 28rpx;'>充值</Text>
</view>
<!-- TODO 暂无余额说明 -->
<u-icon name="question-o" color="#fff" class='explain' size="36"></u-icon>
</view>
<view class="timechoice">
<view style="width: 50%;display: flex;flex-direction: row;align-items: center;justify-content: space-between;">
<u-icon name="arrow-left" color="#909399" size="36" @click='fun_date(-1)'></u-icon>
<Text>{{date}}</Text>
<u-icon name="arrow" color="#909399" size="36" @click='fun_date(1)'></u-icon>
</view>
</view>
<view>
<!-- TODO logs列表 -->
</view>
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> -->
<view class="loading" v-if="load">
<u-loading mode="flower" size="48"></u-loading>
<Text style='color: #fff;margin-top: 10rpx;'>加载中...</Text>
</view>
</view>
</template>
<script>
import auth from "../../components/auth/index.vue";
export default {
data() {
return {
pageTitle:"余额记录",
load:false,
showAuth:false,
contentHeight:0,
mainColor: "",
u:{},
g:{},
date:'',
date2:'',
logsList:[],
}
},
components:{
auth
},
mounted() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length-1].route;
let pages = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
onLoad(){
this.u = uni.getStorageSync("userinfo");
if (!this.u) {
this.u = {
nickName: "未登录",
avatarUrl: ""
};
this.showAuth = true;
}
},
created(){
this.contentHeight = this.$utils.calcContentHeight(-40)+'px';
this.mainColor = this.$uiConfig.mainColor;
let date1 = new Date();
let time1 = date1.getFullYear() + "年" + (date1.getMonth() + 1) +'月'
let time2 = date1.getFullYear() + "-" + (date1.getMonth() + 1)
this.date = time1
this.date2 = time2
this.balancedata()
this.getlogs()
},
methods: {
reloadUserinfo() {
this.u = uni.getStorageSync("userinfo");
this.showAuth=false
},
balancedata(){
uni.showNavigationBarLoading();
let h=this.apiheader()
this.request(
{
url: "",
header:h,
data: {
r: "api/balance/index",
}
},
res => {
uni.hideNavigationBarLoading()
this.g = res.data;
}
);
},
getlogs(){
this.load=true
uni.showNavigationBarLoading();
let h=this.apiheader()
this.request(
{
url: "",
header:h,
data: {
r: "api/balance/logs",
date:this.date2,
}
},
res => {
this.load=false
}
);
},
fun_date(num){
let date = this.date;
let date2 = this.date2;
let currentDate = new Date(date2);
if(num==-1){
let lastDate = currentDate.setMonth(currentDate.getMonth() - 1); // 输出日期格式为毫秒形式1551398400000
lastDate = new Date(lastDate);
let lastYear = lastDate.getFullYear();
let lastMonth = this.checkMonth(lastDate.getMonth() + 1); // 因日期中的月份表示为0-11,所以要显示正确的月份,需要 + 1
lastDate = lastYear + '年' + lastMonth +'月';
let lastDate2 = lastYear + '-' + lastMonth;
this.date = lastDate;
this.date2 = lastDate2;
this.getlogs()
}else if(num==1){
let nextDate = currentDate.setMonth(currentDate.getMonth() + 1); // 输出日期格式为毫秒形式1556668800000
nextDate = new Date(nextDate);
let nextYear = nextDate.getFullYear();
let nextMonth = this.checkMonth(nextDate.getMonth() + 1); // 因日期中的月份表示为0-11,所以要显示正确的月份,需要 + 1
nextDate = nextYear + '年' + nextMonth+'月';
let nextDate2 = nextYear + '-' + nextMonth;
this.date = nextDate;
this.date2 = nextDate2;
this.getlogs()
}
},
checkMonth (i) {
if (i<10){
i="0" + i;
}
return i;
}
}
}
</script>
<style>
.balanceStyle{
background: #f3f4f6;
width: 100%;
}
.balanceStyle .balance_top{
width: 100%;
height: 215px;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
}
.balanceStyle .recharge{
width: 90px;
height: 30px;
text-align: center;
line-height: 30px;
border-radius: 15px;
border: 1px solid #FFFFFF;
margin-top: 60rpx;
}
.balanceStyle .explain{
position: absolute;
right: 20rpx;
top:20rpx
}
.balanceStyle .timechoice{
width: 100%;
height: 50px;
background: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
}
.balanceStyle .loading{
width: 200rpx;
height: 200rpx;
background: #000000;
opacity: 0.7;
border-radius: 10rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: fixed;
left: 50%;
top:30%;
margin-left: -100rpx;
z-index: 999;
}
</style>
This diff is collapsed.
......@@ -134,8 +134,8 @@ export default {
this.contentHeight = this.$utils.calcContentHeight(c);
console.log(this.contentHeight);
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title
let pages = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
......
......@@ -64,6 +64,7 @@
export default {
data() {
return {
pageTitle:'我的收藏',
loading: true,
contentHeight:0,
showAuth:false,
......@@ -84,8 +85,23 @@
this.contentHeight = this.$utils.calcContentHeight(-40)+'px';
this.init()
},
mounted() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length-1].route;
let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
onLoad(){
this.u = wx.getStorageSync("userinfo");
this.u = uni.getStorageSync("userinfo");
if (!this.u) {
this.u = {
nickName: "未登录",
......@@ -185,6 +201,7 @@
margin-bottom: 3px;
font-size: 13px;
margin: 7px 10px;
height: 36px;
}
.favoriteStyle .u-good-list .good .good-info {
display: flex;
......
This diff is collapsed.
......@@ -124,8 +124,8 @@ export default {
initPage() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title
let pages = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
......
......@@ -11,6 +11,7 @@
:border-radius="0"
@click="previewImage"
></u-swiper>
<!-- TODO 分销价格未做 is_share_price -->
</view>
<view class="g-info">
<view class="g-name u-skeleton-rect">{{ g.name }}</view>
......@@ -24,9 +25,11 @@
: g.price_min + "-" + g.price_max
}}</text>
</view>
<!-- TODO is_common_user_member_price 普通用户会员价 -->
<!-- TODO is_member_user_member_price 会员用户会员价 -->
<view class="sell u-skeleton-rect">
<text class="oprice">{{ g.original_price }}</text>
<text>已售出{{ g.sales }}{{ g.unit }}</text>
<text class="oprice" v-if="setting.is_underline_price=='1'">{{ g.original_price }}</text>
<text v-if="setting.is_sales=='1'">已售出{{ g.sales }}{{ g.unit }}</text>
</view>
</view>
<view class="right u-skeleton-rect">
......@@ -63,9 +66,9 @@
<u-icon name="arrow" :size="32" color="#111"></u-icon>
</view>
</view>
<view class="suk-item">
<view class="suk-item" style="flex-wrap:wrap">
<template v-if="skuimage.length > 0">
<view v-for="(x, i) in skuimage" class="item img" :key="i">
<view v-for="(x, i) in skuimage" class="item img" style="margin-bottom:5px" :key="i">
<image :src="x" style="width: 100%; height: 100%;" />
</view>
<view class="item" v-if="g.attr_groups[0].attr_list.length > 1"
......@@ -75,13 +78,12 @@
>
</template>
<template v-else>
<view
v-for="(x, i) in g.attr_groups[0].attr_list"
class="item"
:key="i"
>
{{ x.attr_name }}
</view>
<template v-for="(x, i) in g.attr_groups[0].attr_list">
<view class="item" v-if="i<5" :key="i" style="margin-bottom:5px">
{{ x.attr_name }}
</view>
</template>
<view class="item" v-if="g.attr_groups[0].attr_list.length > 1"
>共{{ g.attr_groups[0].attr_list.length }}种{{
g.attr_groups[0].attr_group_name
......@@ -92,7 +94,7 @@
</view>
</view>
<view class="sku-box u-skeleton-rect">
<view class="sku-box u-skeleton-rect" v-if="setting.is_express=='1'">
<view class="label">快递</view>
<view class="content">
{{ g.express == "" ? "免运费" : g.express }}
......@@ -121,7 +123,7 @@
<view
class="sku-box u-skeleton-rect"
v-if="comments.comments.length == 0"
v-if="comments.comments.length == 0 && setting.is_comment=='1'"
>
<view class="label">暂无评论信息</view>
</view>
......@@ -169,7 +171,8 @@
</view>
<u-skeleton
:loading="loading"
v-if="loading"
:loading="true"
:animation="true"
bgColor="#FFF"
></u-skeleton>
......@@ -212,7 +215,7 @@ export default {
data() {
return {
id: 0,
loading: false,
loading: true,
g: {},
imgs: [],
mc: "",
......@@ -226,7 +229,8 @@ export default {
ot: 0,
currentSku: {},
isExsitGoods: true,
pageTitle:"商品详情"
pageTitle: "商品详情",
setting:{}
};
},
components: {
......@@ -240,14 +244,15 @@ export default {
this.init();
this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary;
this.initPage()
this.initPage();
this.setting = uni.getStorageSync("basedata").mall.setting
},
methods: {
initPage() {
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title
let pages = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
......@@ -258,9 +263,9 @@ export default {
title: this.pageTitle,
});
},
clickCommentHandler(){
clickCommentHandler() {
uni.navigateTo({
url: '/pages/goods/comment-list?id='+this.id
url: "/pages/goods/comment-list?id=" + this.id,
});
},
init() {
......
This diff is collapsed.
<template>
<view>
订单首页
</view>
</template>
<script>
export default {
}
</script>
<style>
</style>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -23,7 +23,7 @@
<Text style='margin-left: 10rpx;'>{{meueData.user_center.foot_bar[0].name}}</Text>
</view>
</view>
<view style="width: 1rpx;height: 60rpx;background: #000000;"></view>
<view style="width: 1px;height: 60rpx;background: #000000;"></view>
<view class="footprint_item" @click="goUrl('/pages/foot/index/index')">
<text>{{user_info.footprint}}</text>
<view class="footprint_item_bottom">
......@@ -33,26 +33,35 @@
</view>
</view>
<view class="account_bar" v-if="meueData.user_center.is_account_status==1">
<view class="account_bar_item">
<view class="account_bar" v-if="meueData.user_center.account_bar.status==1">
<view class="account_bar_item" v-if="meueData.user_center.account_bar.integral.status==1" >
<Text :style="{'color':secondary}">{{user_info.integral}}</Text>
<view class="footprint_item_bottom">
<image :src='meueData.user_center.account_bar.integral.icon' style="width: 26rpx;height: 26rpx;"></image>
<Text style='margin-left: 10rpx;'>{{meueData.user_center.account_bar.integral.text}}</Text>
</view>
</view>
<view style="width: 1rpx;height: 60rpx;background: #EEEEEE;"></view>
<view style="width: 1px;height: 60rpx;background: #f5f5f5;" v-if="meueData.user_center.account_bar.integral.status==1"></view>
<view class="account_bar_item" v-if="meueData.user_center.account_bar.balance.status==1" @click="goUrl('/pages/balance/balance')">
<Text :style="{'color':secondary}">{{user_info.balance}}</Text>
<view class="footprint_item_bottom">
<image :src='meueData.user_center.account_bar.balance.icon' style="width: 26rpx;height: 26rpx;"></image>
<Text style='margin-left: 10rpx;'>{{meueData.user_center.account_bar.balance.text}}</Text>
</view>
</view>
<view style="width: 1px;height: 60rpx;background: #f5f5f5;" v-if="meueData.user_center.account_bar.balance.status==1"></view>
<view class="account_bar_item">
<view class="account_bar_item" v-if="meueData.user_center.account_bar.coupon.status==1">
<Text :style="{'color':secondary}">{{user_info.coupon}}</Text>
<view class="footprint_item_bottom">
<image :src='meueData.user_center.account_bar.coupon.icon' style="width: 26rpx;height: 26rpx;"></image>
<Text style='margin-left: 10rpx;'>{{meueData.user_center.account_bar.coupon.text}}</Text>
</view>
</view>
<view style="width: 1rpx;height: 60rpx;background: #EEEEEE;"></view>
<view style="width: 1px;height: 60rpx;background: #f5f5f5;" v-if="meueData.user_center.account_bar.coupon.status==1"></view>
<view class="account_bar_item">
<view class="account_bar_item" v-if="meueData.user_center.account_bar.card.status==1">
<Text :style="{'color':secondary}">{{user_info.card}}</Text>
<view class="footprint_item_bottom">
<image :src='meueData.user_center.account_bar.card.icon' style="width: 26rpx;height: 26rpx;"></image>
......@@ -62,12 +71,13 @@
</view>
<view class="order_bar" v-if='meueData.user_center.is_order_bar_status==1'>
<u-section title="我的订单" sub-title="查看更多" style='width: 100%;padding: ;'></u-section>
<u-section title="我的订单" sub-title="查看更多" style='width: 100%;padding: ;' @click="goUrl('/pages/order/index/index?status=0')"></u-section>
<view class="order_bar_list">
<view class="order_bar_item" v-for="(item, index) in meueData.user_center.order_bar" :key="index"
:name="item.name" @click="goUrl(item.link_url)">
<image :src='item.icon_url' style="width: 66rpx;height: 60rpx;"></image>
<Text style='margin-top: 10rpx;'>{{item.name}}</Text>
<view v-if='item.num>0' class='badge' :style="{'background':mainColor}">{{item.num}}</view>
</view>
</view>
</view>
......@@ -78,7 +88,7 @@
<image :src='item.icon_url' style="width: 48rpx;height: 48rpx;"></image>
<Text :style="{'margin-top':meueData.user_center.menu_style == 1 ? '0rpx':'10rpx','margin-left':meueData.user_center.menu_style == 1 ? '10rpx':'0rpx'}">
{{item.name}}
</Text>
</Text>
</view>
</view>
<view class="copyright">
......@@ -132,10 +142,10 @@
};
this.showAuth = true;
}
this.cstyle = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").cat_style
: [];
if (this.cstyle.cat_style == "4") {
}
......@@ -148,7 +158,6 @@
this.contentHeight = this.$utils.calcContentHeight(c);
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title
: [];
......@@ -158,6 +167,9 @@
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
this.userinfo()
this.getmeue()
......@@ -199,7 +211,7 @@
(res) => {
uni.hideNavigationBarLoading()
this.isloading = false;
console.log(res.data)
this.meueData = res.data.config;
this.user_info = res.data.user_info;
}
......@@ -261,7 +273,7 @@
}
.userStyle .footprint_item{
width: 200rpx;
height: 100rpx;
height: 90rpx;
display: flex;
flex-direction: column;
align-items: center;
......@@ -315,6 +327,20 @@
flex-direction: column;
align-items: center;
margin-top: 20rpx;
position: relative
}
.userStyle .badge{
position: absolute;
right: -10rpx;
top: -10rpx;
padding:0 12rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 20rpx;
color: #fff;
height: 30rpx;
border-radius: 15rpx;
}
.userStyle .menus{
width: 94%;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment