feat: 优化代码
This commit is contained in:
Vendored
BIN
Binary file not shown.
+78
-78
@@ -1,91 +1,91 @@
|
||||
<template>
|
||||
<view class="mine_address_warp">
|
||||
<view
|
||||
v-for="item in addressList"
|
||||
:key="item.id"
|
||||
:class="selectAddress && selectAddress.id === item.id?'address_item address_item_sel':'address_item'"
|
||||
v-if="addressList && addressList.length !==0"
|
||||
@click="checkAddress(item)"
|
||||
>
|
||||
<template>
|
||||
<view class="mine_address_warp">
|
||||
<view v-for="item in addressList" :key="item.id"
|
||||
:class="selectAddress && selectAddress.id === item.id ? 'address_item address_item_sel' : 'address_item'"
|
||||
v-if="addressList && addressList.length !== 0" @click="checkAddress(item)">
|
||||
<view class="address_item_country_name">
|
||||
{{item.countryName}} {{item.provinceName}} {{item.cityName}} {{item.areaName}}
|
||||
{{ item.countryName }} {{ item.provinceName }} {{ item.cityName }} {{ item.areaName }}
|
||||
</view>
|
||||
<view class="address_item_address">
|
||||
{{item.address}}
|
||||
{{ item.address }}
|
||||
</view>
|
||||
<view class="address_item_info">
|
||||
<view>{{item.name}}</view>
|
||||
<view style="margin-left: 20rpx;">{{item.phone}}</view>
|
||||
<view>{{ item.name }}</view>
|
||||
<view style="margin-left: 20rpx;">{{ item.phone }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="not_order_warp">
|
||||
<view class="not_order_warp_img"><up-image src="/static/common/not_search.png" width="100" height="100" bgColor="#f1f6ff00"></up-image></view>
|
||||
<view class="not_order_warp_img"><up-image src="/static/common/not_search.png" width="100" height="100"
|
||||
bgColor="#f1f6ff00"></up-image></view>
|
||||
<view class="not_order_msg_warp">暂时地址,快去地址管理添加吧~</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getAddress,setAddressDefault,deleteAddress } from '@/api/address.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addressList:[],
|
||||
selectAddress:{},
|
||||
}
|
||||
import { getAddress, setAddressDefault, deleteAddress } from '@/api/address.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
addressList: [],
|
||||
selectAddress: {},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getAddressList();
|
||||
},
|
||||
methods: {
|
||||
// 添加地址
|
||||
jumpAddAddress() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/mine/mine_address_add/mine_address_add',
|
||||
})
|
||||
},
|
||||
mounted() {
|
||||
this.getAddressList();
|
||||
},
|
||||
methods: {
|
||||
// 添加地址
|
||||
jumpAddAddress(){
|
||||
uni.navigateTo({
|
||||
url:'/pages/mine_address_add/mine_address_add',
|
||||
})
|
||||
},
|
||||
// 查询地址
|
||||
async getAddressList(){
|
||||
const res = await getAddress();
|
||||
if(res && res.bizcode === 100){
|
||||
this.addressList = res.data;
|
||||
}
|
||||
},
|
||||
checkAddress(item){
|
||||
this.selectAddress = item;
|
||||
this.$emit("valueFunc", item);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
// 查询地址
|
||||
async getAddressList() {
|
||||
const res = await getAddress();
|
||||
if (res && res.bizcode === 100) {
|
||||
this.addressList = res.data;
|
||||
}
|
||||
},
|
||||
checkAddress(item) {
|
||||
this.selectAddress = item;
|
||||
this.$emit("valueFunc", item);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.mine_address_warp{
|
||||
}
|
||||
.address_item{
|
||||
background: #FFFFFF;
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #9e9e9e26;
|
||||
}
|
||||
.address_item_sel{
|
||||
color: $app-bt-bj !important;
|
||||
background-color: #ff57220d;
|
||||
}
|
||||
.address_item_info{
|
||||
font-size: 26rpx;
|
||||
color: #868383;
|
||||
display: flex;
|
||||
}
|
||||
.address_item_address{
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #666666;
|
||||
margin: 10rpx 0;
|
||||
}
|
||||
.address_item_country_name{
|
||||
color: #9E9E9E;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
</style>
|
||||
.mine_address_warp {}
|
||||
|
||||
.address_item {
|
||||
background: #FFFFFF;
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #9e9e9e26;
|
||||
}
|
||||
|
||||
.address_item_sel {
|
||||
color: $app-bt-bj !important;
|
||||
background-color: #ff57220d;
|
||||
}
|
||||
|
||||
.address_item_info {
|
||||
font-size: 26rpx;
|
||||
color: #868383;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.address_item_address {
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #666666;
|
||||
margin: 10rpx 0;
|
||||
}
|
||||
|
||||
.address_item_country_name {
|
||||
color: #9E9E9E;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<script>
|
||||
import { searchList } from '@/api/product.js';
|
||||
|
||||
|
||||
export default {
|
||||
name:"choiceness",
|
||||
data() {
|
||||
@@ -35,10 +35,10 @@
|
||||
this.getSearchList();
|
||||
},
|
||||
methods: {
|
||||
//
|
||||
//
|
||||
jumpInfo(item){
|
||||
uni.navigateTo({
|
||||
url: '/pages/productInfo/productInfo?id='+item.id,
|
||||
url: '/pages/other_package/productInfo/productInfo?id='+item.id,
|
||||
})
|
||||
},
|
||||
async getSearchList(){
|
||||
|
||||
@@ -1,105 +1,92 @@
|
||||
<template>
|
||||
<view class="comm-input-warp">
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<input
|
||||
:placeholder="$t('login.comm.code')"
|
||||
border="false"
|
||||
:v-model="modelValue"
|
||||
color="#EEEEEE"
|
||||
type="number"
|
||||
@input="$emit('update:modelValue', $event.detail.value)"
|
||||
style="height: 64rpx;width: 70%;"
|
||||
></input>
|
||||
<input :placeholder="$t('login.comm.code')" border="false" :v-model="modelValue" color="#EEEEEE" type="number"
|
||||
@input="$emit('update:modelValue', $event.detail.value)" style="height: 64rpx;width: 70%;"></input>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<input
|
||||
:placeholder="$t('login.comm.code')"
|
||||
border="false"
|
||||
:v-model="modelValue"
|
||||
color="#EEEEEE"
|
||||
type="number"
|
||||
@input="$emit('update:modelValue', $event.target.value)"
|
||||
style="height: 64rpx;width: 70%;"
|
||||
></input>
|
||||
<input :placeholder="$t('login.comm.code')" border="false" :v-model="modelValue" color="#EEEEEE" type="number"
|
||||
@input="$emit('update:modelValue', $event.target.value)" style="height: 64rpx;width: 70%;"></input>
|
||||
<!-- #endif -->
|
||||
<view class="code-warp" v-if="countdown">
|
||||
<up-count-down :time="60 * 1000" format="ss" @finish="getCode(false)"></up-count-down>
|
||||
<up-count-down :time="60 * 1000" format="ss" @finish="getCode(false)"></up-count-down>
|
||||
<text style="margin-left: 10rpx;">s</text>
|
||||
<!-- <text style="margin-left: 10rpx;">{{$t('login.comm.reacquire.code')}}</text> -->
|
||||
</view>
|
||||
<view v-else class="code-warp" @click="getCode(true)">
|
||||
<view>{{$t('login.comm.get.code')}}</view>
|
||||
<view>{{ $t('login.comm.get.code') }}</view>
|
||||
</view>
|
||||
<up-toast ref="uToastRef"></up-toast>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from 'vue';
|
||||
|
||||
const uCodeRef = ref(null);
|
||||
|
||||
export default {
|
||||
name: 'inputComm',
|
||||
props: ['modelValue','codeNumberRef','emptyCountdownRef'],
|
||||
watch: {
|
||||
emptyCountdownRef(value,oldValue) {
|
||||
if(value){
|
||||
this.countdown = true;
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
countdown:false,
|
||||
emptyCountdown:this.emptyCountdownRef,
|
||||
inputCss:{
|
||||
"height":'80rpx',
|
||||
"background": "#F3F3F3FF",
|
||||
"border-radius": "30rpx",
|
||||
"border": "0rpx",
|
||||
"padding-left": "16px",
|
||||
},
|
||||
// import { ref } from 'vue';
|
||||
|
||||
// const uCodeRef = ref(null);
|
||||
|
||||
export default {
|
||||
name: 'inputComm',
|
||||
props: ['modelValue', 'codeNumberRef', 'emptyCountdownRef'],
|
||||
watch: {
|
||||
emptyCountdownRef(value, oldValue) {
|
||||
if (value) {
|
||||
this.countdown = true;
|
||||
}
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
getCode(val){
|
||||
const emptyCountdown = this.emptyCountdown;
|
||||
if(val){
|
||||
const codeNumber = this.codeNumberRef;
|
||||
if(codeNumber){
|
||||
this.$emit('getCode');
|
||||
}else{
|
||||
this.$refs.uToastRef.show({
|
||||
type: 'error',
|
||||
message: this.$t('login.comm.email'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
// uni.dialog.showMessage('请输入邮箱');
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
countdown: false,
|
||||
emptyCountdown: this.emptyCountdownRef,
|
||||
inputCss: {
|
||||
"height": '80rpx',
|
||||
"background": "#F3F3F3FF",
|
||||
"border-radius": "30rpx",
|
||||
"border": "0rpx",
|
||||
"padding-left": "16px",
|
||||
},
|
||||
}
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
getCode(val) {
|
||||
const emptyCountdown = this.emptyCountdown;
|
||||
if (val) {
|
||||
const codeNumber = this.codeNumberRef;
|
||||
if (codeNumber) {
|
||||
this.$emit('getCode');
|
||||
} else {
|
||||
this.$refs.uToastRef.show({
|
||||
type: 'error',
|
||||
message: this.$t('login.comm.email'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
} else {
|
||||
// uni.dialog.showMessage('请输入邮箱');
|
||||
this.$refs.uToastRef.show({
|
||||
type: 'error',
|
||||
message: this.$t('login.comm.email'),
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.code-warp{
|
||||
width: 30%;
|
||||
text-align: right;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.wrap {
|
||||
padding: 24rpx;
|
||||
}
|
||||
.code-warp {
|
||||
width: 30%;
|
||||
text-align: right;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.wrap {
|
||||
padding: 24rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -1,69 +1,63 @@
|
||||
<template>
|
||||
<view class="custom-tab-bar">
|
||||
<view v-for="(item, index) in tabs" :key="index" class="tab-item" @click="switchTab(index)">
|
||||
<image :src="tabIndex === index ? item.selectedIconPath:item.iconPath" class="tab-icon"></image>
|
||||
<text :class="tabIndex === index ? 'tab-text tab-text-sel':'tab-text'">{{ item.text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-for="(item, index) in tabs" :key="index" class="tab-item" @click="switchTab(index)">
|
||||
<image :src="tabIndex === index ? item.selectedIconPath : item.iconPath" class="tab-icon"></image>
|
||||
<text :class="tabIndex === index ? 'tab-text tab-text-sel' : 'tab-text'">{{ item.text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"custom-tab-bar",
|
||||
props: {
|
||||
tabIndex: { //当前选中的tab项
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabs: [
|
||||
{
|
||||
"pagePath": "/pages/home/home",
|
||||
"text": "首页",
|
||||
"iconPath": "/static/column/home.png",
|
||||
"selectedIconPath": "/static/column/home_sel.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "/pages/sort/sort",
|
||||
"text": "分类",
|
||||
"iconPath": "/static/column/sort.png",
|
||||
"selectedIconPath": "/static/column/sort_sel.png"
|
||||
},
|
||||
// {
|
||||
// "pagePath": "/pages/hash_union/hash_union",
|
||||
// "text": "哈希联盟",
|
||||
// "iconPath": "/static/column/hx.png",
|
||||
// "selectedIconPath": "/static/column/hx_sel.png"
|
||||
// },
|
||||
{
|
||||
"pagePath": "/pages/supply_chain/supply_chain",
|
||||
"text": "供应链",
|
||||
"iconPath": "/static/column/supply_chain.png",
|
||||
"selectedIconPath": "/static/column/supply_chain_sel.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "/pages/shopping_cart/shopping_cart",
|
||||
"text": "购物车",
|
||||
"iconPath": "/static/column/shopping.png",
|
||||
"selectedIconPath": "/static/column/shopping_sel.png"
|
||||
}, {
|
||||
"pagePath": "/pages/mine/mine",
|
||||
"text": "我的",
|
||||
"iconPath": "/static/column/mine.png",
|
||||
"selectedIconPath": "/static/column/mine_sel.png"
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
switchTab(index) {
|
||||
const pagePath = this.tabs[index].pagePath;
|
||||
uni.switchTab({ url: pagePath });
|
||||
}
|
||||
export default {
|
||||
name: "custom-tab-bar",
|
||||
props: {
|
||||
tabIndex: { //当前选中的tab项
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabs: [
|
||||
{
|
||||
"pagePath": "/pages/home/home",
|
||||
"text": "首页",
|
||||
"iconPath": "/static/column/home.png",
|
||||
"selectedIconPath": "/static/column/home_sel.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "/pages/sort/sort",
|
||||
"text": "分类",
|
||||
"iconPath": "/static/column/sort.png",
|
||||
"selectedIconPath": "/static/column/sort_sel.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "/pages/supply_chain/supply_chain",
|
||||
"text": "供应链",
|
||||
"iconPath": "/static/column/supply_chain.png",
|
||||
"selectedIconPath": "/static/column/supply_chain_sel.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "/pages/shopping_cart/shopping_cart",
|
||||
"text": "购物车",
|
||||
"iconPath": "/static/column/shopping.png",
|
||||
"selectedIconPath": "/static/column/shopping_sel.png"
|
||||
}, {
|
||||
"pagePath": "/pages/mine/mine",
|
||||
"text": "我的",
|
||||
"iconPath": "/static/column/mine.png",
|
||||
"selectedIconPath": "/static/column/mine_sel.png"
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
switchTab(index) {
|
||||
const pagePath = this.tabs[index].pagePath;
|
||||
uni.switchTab({ url: pagePath });
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -72,24 +66,33 @@
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
height: 140rpx; /* 根据需要调整 */
|
||||
background-color: #fff; /* 背景颜色 */
|
||||
height: 140rpx;
|
||||
/* 根据需要调整 */
|
||||
background-color: #fff;
|
||||
/* 背景颜色 */
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.tab-icon {
|
||||
width: 24px; /* 图标大小 */
|
||||
height: 24px; /* 图标大小 */
|
||||
width: 24px;
|
||||
/* 图标大小 */
|
||||
height: 24px;
|
||||
/* 图标大小 */
|
||||
}
|
||||
|
||||
.tab-text {
|
||||
font-size: 12px; /* 文字大小 */
|
||||
font-size: 12px;
|
||||
/* 文字大小 */
|
||||
}
|
||||
|
||||
.tab-text-sel {
|
||||
color: $app-bt-bj;
|
||||
color: $app-bt-bj;
|
||||
}
|
||||
</style>
|
||||
@@ -7,8 +7,8 @@
|
||||
<view style="margin-left: 20rpx;">
|
||||
<view class="title_">{{item.prizeName}}</view>
|
||||
<view class="time_">{{formatDate(item.ctdate)}}</view>
|
||||
<view
|
||||
class="delivery_"
|
||||
<view
|
||||
class="delivery_"
|
||||
v-if="[DELIVER_STATUS.AWAIT_DELIVERY_REQUIRED,DELIVER_STATUS.YES_DELIVERY_REQUIRED,DELIVER_STATUS.RECEIVED].includes(item.deliveryStatus)"
|
||||
>
|
||||
<view class="delivery_status">{{getValue(DELIVER_STATUS_,item.deliveryStatus)}}</view>
|
||||
@@ -29,14 +29,14 @@
|
||||
</view>
|
||||
<view v-if="loading" style="text-align: center;">加载中...</view>
|
||||
</scroll-view>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getWinningList } from '@/api/raffle.js';
|
||||
import { formatDate,copyData } from '@/utils/index.js';
|
||||
import { DELIVER_STATUS,DELIVER_STATUS_,getValue } from '@/utils/enumUtils.js'
|
||||
|
||||
|
||||
export default {
|
||||
name:"winning_record",
|
||||
props: {
|
||||
@@ -48,7 +48,7 @@
|
||||
computed: {
|
||||
DELIVER_STATUS() {
|
||||
return DELIVER_STATUS;
|
||||
},
|
||||
},
|
||||
DELIVER_STATUS_(){
|
||||
return DELIVER_STATUS_;
|
||||
}
|
||||
@@ -74,10 +74,10 @@
|
||||
getValue,
|
||||
jumpGetFun(item){
|
||||
uni.navigateTo({
|
||||
url:'/pages/get_prize/get_prize?id='+item.id,
|
||||
url:'/pages/other_package/get_prize/get_prize?id='+item.id,
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
// 加载数据的方法
|
||||
async loadData() {
|
||||
if (this.loading) return; // 如果正在加载,则不重复加载
|
||||
|
||||
Reference in New Issue
Block a user