暂存code

This commit is contained in:
hejiangming
2025-05-07 09:54:33 +08:00
parent 78270eeda0
commit 007b002b81
403 changed files with 14507 additions and 6320 deletions
+287 -6
View File
@@ -1,19 +1,219 @@
<template>
<view class="hash_union_warp">
<view class="not_order_warp">
<up-image src="/static/common/not_order.png" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="not_order_msg_warp">暂无相关数据</view>
<view class="hash_union_content">
<!-- 头部 -->
<view class="content_header">
<view class="header_union_comm">
<up-image src="/static/common/address3.png" width="16" height="18" bgColor="#f1f6ff00"></up-image>
<view class="msg_">二七广场丹尼斯</view>
<view style="margin-top: 10rpx;">
<up-image src="/static/common/right.png" width="18" height="18" bgColor="#f1f6ff00"></up-image>
</view>
</view>
<view class="header_union_comm">
<view style="width: 200rpx;">
<up-search
shape="square"
bgColor="#EEEEEEFF"
color="#666666FF"
:showAction="false"
placeholder="搜索"
></up-search>
</view>
</view>
</view>
<!-- banner图 -->
<up-swiper
:list="swiperList"
height="120"
radius="10"
@change="e => currentNum = e.current"
bgColor="#ffffff00"
>
<template #indicator>
<view
class="indicator-num"
>
<text class="indicator-num__text">{{ currentNum + 1 }}/{{ swiperList.length }}</text>
</view>
</template>
</up-swiper>
<!-- 分类 -->
<view class="sort_comm_warp">
<view v-for="item in sortList" :key="item.id" class="sort_item_comm">
<up-image :src="item.icon" width="40" height="32" bgColor="#f1f6ff00"></up-image>
<view class="sort_item_title_comm">{{item.name}}</view>
</view>
</view>
</view>
<!-- 附近列表 -->
<view class="hash_union_nearby">
<view class="header_">
<view class="left_">
<view class="item_comm">
<view style="margin-top: 4rpx;">
<up-image src="/static/common/address3.png" width="10" height="12" bgColor="#f1f6ff00"></up-image>
</view>
<text style="margin: 0 10rpx; 0 6rpx;">附近</text>
<view style="margin-top: 6rpx;">
<up-image src="/static/common/buttom.png" width="10" height="12" bgColor="#f1f6ff00"></up-image>
</view>
</view>
<view class="item_comm" style="margin-left: 10rpx;">
<text style="margin-right: 10rpx;">综合排序</text>
<view style="margin-top: 6rpx;">
<up-image src="/static/common/buttom.png" width="10" height="12" bgColor="#f1f6ff00"></up-image>
</view>
</view>
</view>
<view class="item_comm">查看更多</view>
</view>
<view class="content_">
<view
class="content_item"
v-if="contentList && contentList.length !==0"
v-for="item in contentList"
:key="item.id"
>
<up-image src="/static/common/bianlidian.jpg" width="80" height="80" bgColor="#f1f6ff00" radius="10"></up-image>
<view class="content_item_right">
<view class="title_">{{item.name}}</view>
<view class="rate_">
<up-rate v-model="item.rate" size="14"></up-rate>
<text>¥{{item.price}}/人</text>
<text>{{item.num}}去过</text>
</view>
<view>
{{item.tabs.join(" ")}}
</view>
<view class="address_">
<up-image src="/static/common/address3.png" width="10" height="12" bgColor="#f1f6ff00"></up-image>
<text style="margin-left: 10rpx;">{{item.address}}</text>
</view>
</view>
</view>
</view>
</view>
<!-- <view class="not_order_warp">
<up-image src="/static/common/not_order.png" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="not_order_msg_warp">暂未开放</view>
</view> -->
<CustomTabBar :tabIndex="2"/>
</view>
</template>
<script>
import CustomTabBar from '@/components/custom-tab-bar.vue';
export default {
components:{CustomTabBar},
data() {
return {
swiperList:[
'/static/home/banner04.png',
],
currentNum:0,
sortList:[
{
id:1,
icon:'/static/union/bh.png',
name:'百货',
},
{
id:2,
icon:'/static/union/fs.png',
name:'服饰',
},
{
id:3,
icon:'/static/union/wj.png',
name:'五金',
},
{
id:4,
icon:'/static/union/sm.png',
name:'数码',
},
{
id:5,
icon:'/static/union/jd.png',
name:'酒店',
},
{
id:6,
icon:'/static/union/xc.png',
name:'洗车',
},
{
id:7,
icon:'/static/union/yy.png',
name:'影院',
},
{
id:8,
icon:'/static/union/sh.png',
name:'商行',
},
{
id:9,
icon:'/static/union/bld.png',
name:'便利店',
},
{
id:10,
icon:'/static/union/yb.png',
name:'饮吧',
},
],
rateValue:4,
contentList:[
{
id:1,
name:"好又多便利店",
rate:4,//
price:12,
num:1854,
tabs:['便利店',"建业路/英协花园"],
address:"200m",
},
{
id:2,
name:"好又多便利店",
rate:4,//
price:12,
num:1854,
tabs:['便利店',"建业路/英协花园"],
address:"200m",
},
{
id:3,
name:"好又多便利店",
rate:4,//
price:12,
num:1854,
tabs:['便利店',"建业路/英协花园"],
address:"200m",
},
{
id:4,
name:"好又多便利店",
rate:4,//
price:12,
num:1854,
tabs:['便利店',"建业路/英协花园"],
address:"200m",
},
]
}
},
onShow() {
/*#ifdef APP-PLUS*/
uni.hideTabBar({
animation: false
})
/*#endif*/
},
methods: {
}
@@ -22,8 +222,89 @@
<style lang="scss" scoped>
.hash_union_warp{
height: 100vh;
background-color: $app-bj;
background-color: #FFFFFF;
height: calc(100vh - 140rpx);
overflow: hidden;
.hash_union_content{
padding: 40rpx 20rpx;
.content_header{
display: flex;
justify-content: space-between;
align-items: center;
padding: 60rpx 0 20rpx;
}
.header_union_comm{
display: flex;
align-items: center;
}
.msg_{
font-weight: 500;
font-size: 28rpx;
color: #1A1A1A;
margin: 0 10rpx;
}
}
.hash_union_nearby{
background-color: $app-bj;
border-radius: 30rpx 30rpx 0rpx 0rpx;
padding: 30rpx;
.header_{
display: flex;
justify-content: space-between;
}
.left_{
display: flex;
}
.item_comm{
background: #FFFFFF;
border-radius: 28rpx;
padding: 10rpx 30rpx;
text-align: center;
font-weight: 500;
font-size: 26rpx;
color: #333333;
display: flex;
align-items: center;
}
.content_{
margin: 20rpx 0;
height: calc(100vh - 1020rpx);
overflow: auto;
}
.content_item{
background: #FFFFFF;
border-radius: 30rpx;
display: flex;
align-items: center;
padding:20rpx;
margin-bottom: 20rpx;
.content_item_right{
margin-left: 20rpx;
font-weight: 500;
font-size: 18rpx;
color: #999999;
width: calc(100% - 40rpx);
}
.title_{
font-weight: bold;
font-size: 30rpx;
color: #333333;
}
.rate_{
display: flex;
align-items: center;
margin: 10rpx 0 6rpx;
}
.address_{
display: flex;
align-items: center;
margin-top: 10rpx;
}
}
}
.not_order_warp {
display: grid;
justify-content: center;
+345 -182
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+27 -10
View File
@@ -1,7 +1,7 @@
<template>
<view class="login_warp">
<view class="login_logo_warp">
<view style="margin-left: 8rpx;">
<view style="text-align: center;">
<up-image src="/static/logo.png" width="90" height="90" bgColor="#f1f6ff00" radius="10"></up-image>
</view>
<view style="margin-top: 20rpx;">
@@ -55,7 +55,6 @@
</view>
<view class="login_comm_but login_comm_but_yes" @click="loginFun">
<up-loading-icon color="#FFFFFF" :show="butLoading"></up-loading-icon>
<text style="margin-left: 10rpx;">登录</text>
</view>
<view class="cut_way_warp">
@@ -76,9 +75,11 @@
>
<template #label>
<text>已阅读并同意</text>
<text class="policy_a_warp">《哈希优品服务协议》</text>
<text>及</text>
<text class="policy_a_warp">《隐私政策》</text>
<text class="policy_a_warp" @click="jumpUserAgreement">《服务协议》</text>
<text>、</text>
<text class="policy_a_warp" @click="jumpPrivacyAgreement">《隐私政策》</text>
<text>、</text>
<text class="policy_a_warp" @click="jumpProductAgreement">《售后保障协议》</text>
</template>
</up-checkbox>
</view>
@@ -93,6 +94,7 @@
import { getUserList } from '@/api/common.js';
import { loginbysms,loginbypw } from '@/api/auth.js';
import { setStorageFun,TOKEN_NAME,USER_KEY,USER_DATA,USER_LOGIN_TIME } from '@/utils/auth.js';
import CryptoJS from 'crypto-js';
export default {
components: {
@@ -116,7 +118,6 @@
isShow:false,// 是否显示
isPolicy:false,// 是否同意
countdown:false,// 清空倒计时
butLoading:false,
}
},
methods: {
@@ -144,11 +145,10 @@
});
return;
}
this.butLoading=true;
let response={};
if(this.loginWay === 'password'){
params.mobile = form.name;
params.password = form.password;
params.password = CryptoJS.MD5(form.password).toString();
response = await loginbypw(params);
}else{
params.mobile = form.name;
@@ -170,7 +170,6 @@
// 当前登录得时间戳
let currentTimeStamp = new Date().getTime();
setStorageFun(USER_LOGIN_TIME,currentTimeStamp);
this.butLoading=false;
this.$refs.uToastRef.show({
type: 'success',
message: response.msg,
@@ -219,7 +218,25 @@
uni.navigateTo({
url:"/pages/register/register",
})
}
},
// 用户协议
jumpUserAgreement(){
uni.navigateTo({
url: '/pages/mine_user_agreement/mine_user_agreement?backPath=login'
})
},
// 隐私协议
jumpPrivacyAgreement(){
uni.navigateTo({
url: '/pages/mine_privacy_agreement/mine_privacy_agreement?backPath=login'
})
},
// 售后保障协议
jumpProductAgreement(){
uni.navigateTo({
url: '/pages/mine_product_agreement/mine_product_agreement?backPath=login'
})
},
}
}
</script>
+300 -73
View File
File diff suppressed because one or more lines are too long
+6 -3
View File
@@ -1,5 +1,6 @@
<template>
<view class="mine_address_warp">
<Header :leftTitle="$t('address.title')" left-path-type="switchTab" left-path="/pages/mine/mine"/>
<view v-for="item in addressList" :key="item.id" class="address_item" v-if="addressList && addressList.length !==0">
<view class="address_item_info">
<view>{{item.name}}</view>
@@ -38,15 +39,18 @@
<script>
import { getAddress,setAddressDefault,deleteAddress } from '@/api/address.js';
import Header from '@/components/header.vue';
export default {
data() {
return {
addressList:[
addressList:[],
options:[
{text: '删除'}
]
}
},
components:{Header},
mounted() {
this.getAddressList();
},
@@ -76,7 +80,6 @@
},
// 删除地址
deleteAddressFun(item){
console.log("item",item);
const then = this;
uni.showModal({
title: '提示',
+14 -29
View File
@@ -1,5 +1,6 @@
<template>
<view class="address_add_warp">
<Header :leftTitle="$t('address.add.title')" left-path-type="navigateTo" :leftPath="leftPath"/>
<view class="address_form">
<view class="add_form_item add_form_item_but">
<view class="add_form_title">收货人</view>
@@ -21,6 +22,7 @@
:customStyle="{
'border':'0rpx',
}"
type="number"
></up-input>
</view>
<view class="add_form_item add_form_item_but" >
@@ -65,6 +67,8 @@
@change="regionChange"
keyName="label"
itemHeight="34"
@cancel="regionShow=false"
@close="regionShow=false"
></up-picker>
</view>
</template>
@@ -72,8 +76,10 @@
<script>
import { editAddress,getAddressDetail } from '@/api/address.js'
import { getCascadeRegion } from '@/api/common.js'
import Header from '@/components/header.vue';
export default {
components:{Header},
data() {
return {
form:{
@@ -90,6 +96,7 @@
regionShow:false,
regionColumns:[],
regionLoading:false,
leftPath:"/pages/mine_address/mine_address",
}
},
onLoad(option) {
@@ -97,6 +104,10 @@
if(id && id!==0){
this.getById(id);
}
const ids = option.ids;
if(ids && ids!==0){
this.leftPath = "/pages/order_submit/order_submit?ids="+ids+"&addressShow = true";
}
},
methods: {
/**
@@ -258,9 +269,10 @@
type: 'success',
message: params.id && params.id !==0 ? '修改成功':"添加成功",
});
const leftPath = this.leftPath;
setTimeout(()=>{
uni.navigateTo({
url:'/pages/mine_address/mine_address',
url:leftPath,
})
},2000)
}
@@ -273,32 +285,5 @@
</script>
<style lang="scss" scoped>
.address_add_warp{
height: calc(100vh - 58rpx);
background-color: $app-bj;
padding: 30rpx;
}
.address_form{
background: #FFFFFF;
border-radius: 24rpx;
padding: 0 30rpx 30rpx;
}
.region_warp{
display: flex;
justify-content: space-between;
width: calc(100% - 160rpx);
}
.address_default{
background: #FFFFFF;
border-radius: 24rpx;
padding: 30rpx;
display: flex;
justify-content: space-between;
margin-top: 30rpx;
.title{
font-weight: bold;
font-size: 28rpx;
color: #222222;
}
}
</style>
+102 -53
View File
@@ -1,9 +1,10 @@
<template>
<view class="authentication_warp">
<Header :leftTitle="$t('authentication.title')" left-path-type="switchTab" left-path="/pages/mine/mine"></Header>
<view class="data_common_warp">
<view class="data_msg">请填写商户本人的相关信息</view>
<view class="data_msg">请填写用户本人得相关信息</view>
<view
:class="item.id < formList.length ?'add_form_item add_form_item_but':'add_form_item'"
class="'add_form_item add_form_item_but'"
v-for="item in formList"
:key="item.id"
>
@@ -13,43 +14,50 @@
border="surround"
v-model="form[item.formName]"
:customStyle="inputCss"
:type="item.type"
></up-input>
</view>
</view>
<view class="data_common_warp">
<view class="ID_card_title">上传证件照</view>
<view class="ID_card_msg">(请务必上传本人证件照,生活照、艺术照将会被驳回)</view>
<view class="ID_card_upload">
<view class="upload_item">
<up-image src="/static/common/ID_rx.png" width="100%" height="90" bgColor="#f1f6ff00"></up-image>
<view class="upload_msg">点击上传身份证人像面</view>
</view>
<view class="upload_item">
<up-image src="/static/common/ID_gq.png" width="100%" height="90" bgColor="#f1f6ff00"></up-image>
<view class="upload_msg">点击上传身份国旗面</view>
</view>
</view>
<view class="ID_card_upload_templ">
<view class="templ_title">上传标准</view>
<view class="templ_img_list">
<view class="templ_img_item" v-for="item in uploadTemplList" :key="item.id">
<up-image :src="item.url" width="100%" height="50" bgColor="#f1f6ff00"></up-image>
<view class="templ_img_item_msg">
<up-image :src="item.isOk ? '/static/common/ID_ok_1.png' :'/static/common/ID_error.png'" width="10" height="10" bgColor="#f1f6ff00"></up-image>
<view class="templ_img_item_msg_title">{{item.title}}</view>
</view>
</view>
<view
class="add_form_item"
>
<view class="add_form_title">证件类型</view>
<view class="cert_" @click="certShowCheck(true)">
<view class="cert_title">{{form.certName || '请选择'}}</view>
<up-image src="/static/common/right.png" width="16" height="16" bgColor="#f1f6ff00"></up-image>
</view>
</view>
</view>
<!-- 证件照 -->
<CommonCard @valueFunc="getValue"/>
<view class="add_but" @click="addAuthentication">
提交
</view>
<up-picker
:show="certShow"
:columns="[CERT_OPTION]"
keyName="value"
itemHeight="34"
@confirm="certConfirm"
@cancel="certShow=false"
@close="certShow=false"
></up-picker>
<up-toast ref="uToastRef"></up-toast>
</view>
</template>
<script>
import CommonCard from '@/components/common_card.vue';
import Header from '@/components/header.vue';
import { realNameAuthentication } from '@/api/auth.js';
import { CERT_OPTION } from '@/utils/enumUtils.js';
export default {
computed: {
CERT_OPTION() {
return CERT_OPTION;
},
},
components:{CommonCard,Header},
data() {
return {
inputCss:{
@@ -59,8 +67,11 @@
},
form:{
name:null,
mobile:null,
number:null,// 银行名称
certType:null,// 证状证件类型:1-居民身份证,2-护照
certName:null,
certNo:null,// 证件号码
certFimg:null,// 证件正面照片
certBimg:null,// 证件背面照片
},
formList:[
{
@@ -68,16 +79,13 @@
title:"真实姓名",
formName:"name",
placeholder:"请输入您的真实姓名",
},{
id:2,
title:"手机号",
formName:"mobile",
placeholder:"请输入手机号",
type:"text",
},{
id:3,
title:"证件号码",
formName:"number",
formName:"certNo",
placeholder:"请输入证件号码",
type:"text",
}
],
uploadTemplList:[
@@ -102,11 +110,14 @@
isOk:false,
url:"/static/common/ID_error_3.png",
}
]
],
certShow:false,
certOption:[],
}
},
methods: {
addAuthentication(){
async addAuthentication(){
const params={
...this.form
}
@@ -117,24 +128,65 @@
});
return;
}
if(!params.mobile){
if(!params.certType){
this.$refs.uToastRef.show({
type: 'error',
message: "请输入手机号",
message: "请选择证件类型",
});
return;
}
if(!params.number){
if(!params.certNo){
this.$refs.uToastRef.show({
type: 'error',
message: "请输入证件号码",
});
return;
}
if(params.certFimg.length === 0){
this.$refs.uToastRef.show({
type: 'error',
message: "请上传证件正面照片",
});
return;
}
if(params.certBimg.length === 0){
this.$refs.uToastRef.show({
type: 'error',
message: "请上传证件背面照片",
});
return;
}
console.log("params",params);
uni.navigateTo({
url:'/pages/mine_authentication_ok/mine_authentication_ok',
})
const resp = await realNameAuthentication(params);
if(resp && resp.bizcode === 100){
uni.navigateTo({
url:'/pages/mine_authentication_ok/mine_authentication_ok',
})
}
},
// 提交地址
certConfirm(e){
const {
columnIndex,
value,
values,
index,
} = e;
const data = value[0];
this.form.certType = data.key;
this.form.certName = data.value;
this.certShowCheck(false);
},
// 选择银行的弹框
async certShowCheck(status){
this.certShow = status;
},
getValue(type,value){
if (type === "Z") {
this.form.certFimg = value;
} else if (type === "F") {
this.form.certBimg = value;
}
}
}
}
@@ -145,17 +197,14 @@
height: calc(100vh - 58rpx);
background-color: $app-bj;
padding: 30rpx;
.data_common_warp{
background: #FFFFFF;
border-radius: 30rpx;
padding: 30rpx;
margin-bottom: 30rpx;
}
.data_msg{
font-weight: 500;
font-size: 26rpx;
color: #F34343;
margin-bottom: 20rpx;
}
.cert_{
display: flex;
justify-content: space-between;
width: calc(100% - 170rpx);
.cert_title{
margin-left: 30rpx;
color:#9e9e9ec7
}
}
</style>
@@ -1,35 +1,75 @@
<template>
<view class="authentication_ok_warp">
<view class="authentication_result">
<view class="result_title">您的实名认证</view>
<view class="result_value">已通过!</view>
<Header :leftTitle="$t('authentication.title')" left-path-type="switchTab" left-path="/pages/mine/mine"/>
<view class="authentication_ok_content" v-if="currentUserData && Object.keys(currentUserData).length !==0">
<view class="authentication_result">
<view class="result_title">您的实名认证</view>
<view class="result_value">{{getValue(CERT_STATUS_OPTION,currentUserData.certStatus)}}</view>
</view>
<view class="authentication_info">
<view class="info_item">
<text class="info_item_title">证件姓名:</text>
<text class="info_item_value">{{currentUserData.name}}</text>
</view>
<view class="info_item">
<text class="info_item_title">证件类型:</text>
<text class="info_item_value">{{getValue(CERT_OPTION,currentUserData.certType)}}!</text>
</view>
<view class="info_item">
<text class="info_item_title">证件正面:</text>
<view class="info_item_value">
<up-image :src="currentUserData.certFimg" mode="widthFix" width="100%" height="140" bgColor="#f1f6ff00" :fade="true" duration="450"></up-image>
</view>
</view>
<view class="info_item">
<text class="info_item_title">证件背面:</text>
<view class="info_item_value">
<up-image :src="currentUserData.certBimg" mode="widthFix" width="100%" height="140" bgColor="#f1f6ff00" :fade="true" duration="450"></up-image>
</view>
</view>
</view>
</view>
<view class="authentication_info">
<view class="info_item">
<text class="info_item_title">证件姓名:</text>
<text class="info_item_value">张某</text>
</view>
<view class="info_item">
<text class="info_item_title">证件性别:</text>
<text class="info_item_value">男</text>
</view>
<view class="info_item">
<text class="info_item_title">证件号码:</text>
<text class="info_item_value">448468454848458</text>
</view>
<view v-else class="not_order_warp">
<up-image src="/static/common/not_order.png" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="not_order_msg_warp">暂无相关认证信息</view>
</view>
<up-toast ref="uToastRef"></up-toast>
</view>
</template>
<script>
import Header from '@/components/header.vue';
import { getUserInfo } from '@/api/auth.js';
import { getValue,CERT_OPTION,CERT_STATUS_OPTION } from '@/utils/enumUtils.js';
export default {
computed: {
CERT_OPTION() {
return CERT_OPTION;
},
CERT_STATUS_OPTION() {
return CERT_STATUS_OPTION;
},
},
components:{Header},
data() {
return {
currentUserData:{},// 当前用户信息
}
},
mounted() {
this.getUserInfo();
},
methods: {
getValue,
async getUserInfo(){
const result = await getUserInfo();
if(result && result.bizcode === 100){
const data = result.data;
console.log("data",data);
this.currentUserData = result.data || {};
}
},
}
}
</script>
@@ -38,12 +78,15 @@
.authentication_ok_warp{
height: 100vh;
background-color: #FFFFFF;
padding: 60rpx;
.authentication_ok_content{
padding: 60rpx;
}
.authentication_result{
display: grid;
justify-content: center;
align-items: center;
text-align: center;
margin-top: 100rpx;
.result_title{
font-weight: bold;
font-size: 40rpx;
+111 -39
View File
@@ -8,17 +8,38 @@
border="surround"
v-model="form[item.formName]"
:customStyle="inputCss"
></up-input>
:type="item.type"
></up-input>
</view>
<view class="add_bank_form_item" >
<view class="add_title">银行</view>
<view class="bank_warp" @click="bankShowCheck(true)">
<view style="color: #808080;margin-left: 22rpx;font-size: 28rpx;">{{form.bankName || "选择银行"}}</view>
<up-image src="/static/common/right_soild.png" width="14" height="14" bgColor="#f1f6ff00"></up-image>
</view>
</view>
</view>
<view class="add_but" @click="addBank">
添加
</view>
<up-toast ref="uToastRef"></up-toast>
<up-picker
:show="bankShow"
:columns="bankOption"
keyName="bankName"
itemHeight="34"
@confirm="bankConfirm"
:loading="bankLoading"
@close="bankShow=false"
@cancel="bankShow=false"
></up-picker>
</view>
</template>
<script>
import { bindBank } from '@/api/bank.js';
import { getSupportBank } from '@/api/common.js';
export default {
data() {
return {
@@ -30,74 +51,120 @@
"padding-left": "16px",
},
form:{
name:null,
number:null,
bankName:null,// 银行名称
bankBranch:null,// 开户支行
iban:null,// IBAN
bankNo:null,//银行卡号
bankId:null,// 银行ID
bankName:null,// 银行ID
bankUsername:null,//银行卡开户姓名
bankPhone:null,//银行卡预留手机号码
},
formList:[
{
id:1,
title:"姓名",
formName:"name",
placeholder:"请输入姓名",
title:"银行卡开户姓名",
formName:"bankUsername",
placeholder:"请输入银行卡开户姓名",
type:'text',
},{
id:3,
title:"银行卡预留手机号码",
formName:"bankPhone",
placeholder:"请输入银行卡预留手机号码",
type:'number',
},{
id:2,
title:"银行卡账号/卡号",
formName:"number",
formName:"bankNo",
placeholder:"请输入账号",
},{
id:3,
title:"银行名称",
formName:"bankName",
placeholder:"请输入银行名称",
},{
id:4,
title:"开户支行(选填)",
formName:"bankBranch",
placeholder:"请属于您的开户支行",
},{
id:5,
title:"IBAN(选填)",
formName:"iban",
placeholder:"IBNA",
type:'number',
},
]
],
bankOption:[],// 银行列表选择
bankShow:false,
bankLoading:false,
}
},
onLoad() {
},
methods: {
addBank(){
// 选择银行的弹框
async bankShowCheck(status){
if(status){
const resp = await getSupportBank();
if(resp && resp.bizcode === 100){
this.bankOption = [resp.data];
}
}else{
this.bankOption = [[]];
}
this.bankShow = status;
},
// 提交地址
bankConfirm(e){
const {
columnIndex,
value,
values,
index,
} = e;
if(!value || value.length === 0){
this.$refs.uToastRef.show({
type: 'error',
message: "请先选择银行",
});
return;
}
const data = value[0];
this.form.bankId = data.id;
this.form.bankName = data.bankName;
this.bankShowCheck(false);
},
async addBank(){
const param ={
...this.form
};
if(!param.name){
if(!param.bankUsername){
this.$refs.uToastRef.show({
type: 'error',
message: "请输入姓名",
message: "请输入银行卡开户姓名",
});
return;
}
if(!param.number){
if(!param.bankPhone){
this.$refs.uToastRef.show({
type: 'error',
message: "银行卡账号/卡号",
message: "请输入银行卡预留手机号码",
});
return;
}
if(!param.bankName){
if(!param.bankNo){
this.$refs.uToastRef.show({
type: 'error',
message: "银行名称",
message: "请输入银行卡账号/卡号",
});
return;
}
console.log("param",param);
uni.navigateTo({
url:'/pages/mine_bank_card/mine_bank_card',
})
}
if(!param.bankId){
this.$refs.uToastRef.show({
type: 'error',
message: "请选择银行",
});
return;
}
delete param.bankName;
const resp = await bindBank(param);
if(resp && resp.bizcode === 100){
this.$refs.uToastRef.show({
type: 'sesses',
message: "绑定成功",
});
setTimeout(()=>{
uni.navigateTo({
url:'/pages/mine_bank_card/mine_bank_card',
})
},2000)
}
},
}
}
</script>
@@ -123,5 +190,10 @@
margin-bottom: 30rpx;
}
}
.bank_warp{
display: flex;
justify-content: space-between;
width: 100%;
}
</style>
+80 -38
View File
@@ -1,60 +1,88 @@
<template>
<view class="mine_bank_warp">
<view class="bank_title">
银行卡({{bankList.length}}张)
</view>
<view class="bank_list">
<view class="bank_item" v-for="item in bankList" :key="item.id" >
<view class="bank_data">
<up-image :src="item.url" width="50" height="50" bgColor="#f1f6ff00"></up-image>
<view class="bank_info">
<view class="bank_bank_name">{{item.bankName}}</view>
<view class="bank_user_name">{{item.userName}}</view>
<Header :leftTitle="$t('bankCard.title')" left-path-type="switchTab" left-path="/pages/mine/mine"/>
<view class="mine_bank_content_warp">
<view class="bank_title">
银行卡({{bankList.length}}张)
</view>
<view class="bank_list">
<view v-if="bankList.length !== 0" class="bank_item" v-for="item in bankList" :key="item.id" >
<view class="bank_data">
<up-image :src="item.bankLogo || '/static/bank/default.png'" width="50" height="50" bgColor="#f1f6ff00"></up-image>
<view class="bank_info">
<view class="bank_bank_name">{{item.bankName}}</view>
<view class="bank_user_name">{{item.bankUsername}}</view>
</view>
</view>
<view class="bank_parting_line"></view>
<view class="operate_item">
<view>{{encipherBankNumber(item.bankNo)}}</view>
<view class="operate_" @click="deleteClick(item)">解绑</view>
</view>
</view>
<view class="bank_parting_line"></view>
<view>{{item.number}}</view>
<view v-else class="not_order_warp">
<up-image src="/static/common/not_order.png" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="not_order_msg_warp">还未绑定银行卡哦~</view>
</view>
</view>
<view class="add_but" @click="jumpAddBank">
添加银行卡
</view>
</view>
<view class="add_but" @click="jumpAddBank">
添加银行卡
</view>
</view>
</template>
<script>
import { getBankList,bindBank,unbind } from '@/api/bank.js';
import { encipherBankNumber } from '@/utils/index.js';
import Header from '@/components/header.vue';
export default {
components:{Header},
data() {
return {
bankList:[
{
id:1,
url:'/static/bank/default.png',
bankName:'中国交通银行',
userName:'张某某',
number:"**** **** **** 0865",
},{
id:2,
url:'/static/bank/default.png',
bankName:'中国农业银行',
userName:'张某某',
number:"**** **** **** 0769",
},{
id:3,
url:'/static/bank/default.png',
bankName:'中国农业银行',
userName:'张某某',
number:"**** **** **** 0769",
},
]
bankList:[],
}
},
onLoad() {
this.getBankList();
},
methods: {
encipherBankNumber,
jumpAddBank(){
uni.navigateTo({
url:'/pages/mine_bank_add/mine_bank_add',
})
}
},
async getBankList(){
const resp = await getBankList();
if(resp && resp.bizcode === 100){
this.bankList = resp.data || [];
}
},
// 删除
deleteClick(item){
const then = this;
uni.showModal({
title: '提示',
content: '是否要解绑该银行卡?',
success: function (res) {
if (res.confirm) {
then.deleteFun(item);
}
}
});
},
// 删除的方法
async deleteFun(item){
const params={
id:item.id,
}
const respon = await unbind(params);
if(respon && respon.bizcode === 100){
this.getBankList();
}
},
}
}
</script>
@@ -63,8 +91,10 @@
.mine_bank_warp{
height: calc(100vh - 58rpx);
background-color: $app-bj;
padding: 30rpx;
overflow-y: hidden;
.mine_bank_content_warp{
padding: 30rpx;
}
.bank_title{
font-weight: bold;
font-size: 36rpx;
@@ -105,5 +135,17 @@
border-radius: 0rpx 0rpx 1rpx 1rpx;
margin: 30rpx auto;
}
.operate_item{
display: flex;
justify-content: space-between;
.operate_{
padding: 10rpx 30rpx;
background: #F3F3F3;
border-radius: 25rpx;
font-size: 24rpx;
color: #222222;
margin-left: 20rpx;
}
}
}
</style>
+187 -149
View File
@@ -7,20 +7,20 @@
<view class="order_type_title">
<view
:class="form.type === item.id ? 'order_type_title_item order_type_title_item_sel':'order_type_title_item'"
v-for="item in orderTypeList"
v-for="(item,index) in orderTypeList"
@click="checkType(item)"
:key="item.id"
:key="index"
>
{{item.title}}
</view>
</view>
<view>
<scroll-view scroll-y="true" @scrolltolower="loadMore" style="height: calc(100vh - 300rpx);">
<view v-if="orderList && orderList.length!==0" class="order_list_warp">
<view class="order_item" v-for="item in orderList" :key="item.id">
<!-- 头部 -->
<view class="order_item_header">
<view class="order_item_header_left">
<up-image :src="item.shopLogo" width="22" height="22" bgColor="#f1f6ff00"></up-image>
<up-image :src="item.shopLogo" width="22" height="22" bgColor="#f1f6ff00" shape="circle"></up-image>
<view class="order_product_title">{{item.shopName}}</view>
</view>
<!-- 除开待付款 -->
@@ -33,36 +33,51 @@
<!-- 待付款 -->
<view v-else class="order_item_header_right order_right_due">
<view class="order_right_due_msg">等待付款</view>
<view class="order_right_due_time">{{item.expireTime}}分钟</view>
<view class="order_right_due_time">{{formatDate1(item.expireTime)}}前</view>
</view>
</view>
<!-- 产品详情 -->
<view class="order_item_content">
<view v-for="pItem in item.items" :key="pItem.id" class="content_item">
<up-image :src="pItem.mainGraph" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="content_info">
<view class="content_info_title">{{pItem.title}}</view>
<view class="content_info_tag">{{pItem.goodsSpece}}</view>
<!-- <view>
<text class="content_info_description" v-for="dItem in pItem.description">
{{dItem}}
</text>
</view> -->
<view v-for="pItem in item.items" :key="pItem.id" >
<view class="content_item" @click="jumpOrderInfo(item)">
<up-image :src="pItem.mainGraph" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="content_info">
<view class="content_info_title">{{pItem.title}}</view>
<view class="content_info_tag">{{pItem.goodsSpece}}</view>
<!-- <view>
<text class="content_info_description" v-for="dItem in pItem.description">
{{dItem}}
</text>
</view> -->
</view>
<view class="content_right">
<view class="content_right_total">¥{{pItem.goodsAmount}}</view>
<view class="content_right_quantity">x{{pItem.buyNum}}</view>
</view>
</view>
<view class="content_right">
<view class="content_right_total">¥{{pItem.goodsAmount}}</view>
<view class="content_right_quantity">x{{pItem.buyNum}}</view>
<view class="content_item_yd" v-if="pItem.expressNo">
<view>运单号:<text v-if="pItem.expressName">({{pItem.expressName}})</text>{{pItem.expressNo}}</view>
<view style="margin-left:10rpx;">
<up-image src="/static/common/copy.png" width="14" height="14" bgColor="#f1f6ff00" @click="copyData(pItem.expressNo)"></up-image>
</view>
</view>
</view>
</view>
<!-- 汇总 -->
<view class="order_item_collect">
<view class="collect_msg">共{{item.buyNum}}件,合计¥{{item.sumAmount}}</view>
<view class="collect_msg collect_msg_s" v-if="this.form.type === MINE_ORDER_TYPE.NOT_RECEIVE">
<view class="content_item_yd_msg">(快递动态跟进请复制单号至[快递100官网] 查询)</view>
<view>共{{item.buyNum}}件,合计¥{{item.sumAmount}}</view>
</view>
<view class="collect_msg" v-else>
共{{item.buyNum}}件,合计¥{{item.sumAmount}}
</view>
<view class="collect_operate">
<view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.UNSHIPPED" @click="checkCancel(true)">取消订单</view>
<view class="operate_comm operate_but_2" v-if="item.status === ORDER_TYPE.UNPAID" @click="jumpOrderInfo">去付款</view>
<!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.UNSHIPPED" @click="checkCancel(true)">取消订单</view> -->
<view class="operate_comm operate_but_2" v-if="item.status === ORDER_TYPE.UNPAID" @click="jumpOrderInfo(item)">去付款</view>
<!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.COMPLETED">申请退款</view> -->
<view class="operate_comm operate_but_2" v-if="item.status === ORDER_TYPE.NOT_RECEIVE">确认收货</view>
<view class="operate_comm operate_but_2" v-if="item.status === ORDER_TYPE.NOT_RECEIVE" @click="confirmReceiptOk(item)">确认收货</view>
<!-- <view class="operate_comm operate_but_3" v-if="item.status === ORDER_TYPE.UNSHIPPED">提醒发货</view> -->
<!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.COMPLETED">申请售后</view> -->
<!-- <view class="operate_comm operate_but_1" v-if="item.status === ORDER_TYPE.AFTER_SALE">查看售后</view> -->
@@ -76,7 +91,8 @@
<up-image src="/static/common/not_order.png" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="not_order_msg_warp">暂无相关订单</view>
</view>
</view>
<view v-if="loading" style="text-align: center;">加载中...</view>
</scroll-view>
<up-popup v-model:show="cancelShow" :round="10" :closeOnClickOverlay="false">
<view class="cancel_show_warp">
<view class="cancel_show_title_warp">
@@ -112,147 +128,75 @@
</view>
</up-popup>
<up-toast ref="uToastRef"></up-toast>
<!-- 暂未开放 -->
<up-modal :show="openShow" :showConfirmButton = "false">
<view class="slot-content">
<view class="close_warp" @click="openShow=false;">
<up-image src="/static/common/close.png" width="20" height="20" bgColor="#f1f6ff00"></up-image>
</view>
<view class="content_">
<view class="content_1">温馨提示</view>
<view class="content_2">暂未开放</view>
</view>
<view class="but_">
<view class="but_copy" @click="openShow=false;">确定</view>
</view>
</view>
</up-modal>
</view>
</template>
<script>
import { ORDER_TYPE,ORDER_STATUS,getValue } from '@/utils/enumUtils.js';
import { MINE_ORDER_TYPE,ORDER_TYPE,ORDER_STATUS,getValue } from '@/utils/enumUtils.js';
import { ORDER_STATUS_CSS } from '@/utils/enumCssUtils.js';
import { getOrderList } from '@/api/order.js';
import { getOrderList,confirmReceipt } from '@/api/order.js';
import dayjs from 'dayjs';
import { formatDate1,copyData } from '@/utils/index.js'
export default {
computed: {
ORDER_TYPE() {
return ORDER_TYPE;
MINE_ORDER_TYPE() {
return MINE_ORDER_TYPE;
},
ORDER_STATUS() {
return ORDER_STATUS;
return ORDER_STATUS;
},
ORDER_STATUS_CSS() {
return ORDER_STATUS_CSS;
}
return ORDER_STATUS_CSS;
},
ORDER_TYPE(){
return ORDER_TYPE;
}
},
data() {
return {
orderTypeList:[
{
id:ORDER_TYPE.UNPAID,
id:MINE_ORDER_TYPE.UNPAID,
title:"待支付",
},{
id:ORDER_TYPE.UNSHIPPED,
id:MINE_ORDER_TYPE.UNSHIPPED,
title:"待发货",
},{
id:ORDER_TYPE.NOT_RECEIVE,
id:MINE_ORDER_TYPE.NOT_RECEIVE,
title:"待收货",
},{
id:ORDER_TYPE.SUCCEED,
title:"待评价",
id:MINE_ORDER_TYPE.SUCCEED,
title:"已完成",
},
{
id:MINE_ORDER_TYPE.AFTER_SALE,
title:"售后",
},
],
form:{
search:null,//搜索
page:1,
pageSize:15,
type:0,// 选中的类型
pageSize:10,
type:MINE_ORDER_TYPE.UNPAID,// 选中的类型
},
orderList:[
{
id:1,
url:'/static/common/order_defal.png',
name:"哈希店铺",
status:1,
paymentTime:29,// 剩余付款时间,单位:分钟
product:[
{
id:1,
url:'/static/common/product_def.png',
title:'美的双开门冰箱大容量多美的双开门冰箱大容量多',
description:['双开门','大容量'],
tag:['7天无理由退货','退货险'],
quantity:1,
total:3599,
}
],
productTotal:3599,
},
{
id:2,
url:'/static/common/order_defal.png',
name:"哈希店铺",
status:2,
product:[
{
id:1,
url:'/static/common/product_def.png',
title:'美的双开门冰箱大容量多美的双开门冰箱大容量多',
description:['双开门','大容量'],
tag:['7天无理由退货','退货险'],
quantity:1,
total:3599,
},{
id:2,
url:'/static/common/product_def.png',
title:'美的双开门冰箱大容量多美的双开门冰箱大容量多',
description:['双开门','大容量'],
tag:['7天无理由退货','退货险'],
quantity:1,
total:3599,
}
],
productTotal:7099.88,
},{
id:3,
url:'/static/common/order_defal.png',
name:"哈希店铺",
status:4,
product:[
{
id:1,
url:'/static/common/product_def.png',
title:'美的双开门冰箱大容量多美的双开门冰箱大容量多',
description:['双开门','大容量'],
tag:['7天无理由退货','退货险'],
quantity:1,
total:3599,
}
],
productTotal:3599,
},{
id:4,
url:'/static/common/order_defal.png',
name:"哈希店铺",
status:5,
product:[
{
id:1,
url:'/static/common/product_def.png',
title:'美的双开门冰箱大容量多美的双开门冰箱大容量多',
description:['双开门','大容量'],
tag:['7天无理由退货','退货险'],
quantity:1,
total:3599,
}
],
productTotal:3599,
},{
id:6,
url:'/static/common/order_defal.png',
name:"哈希店铺",
status:6,
product:[
{
id:1,
url:'/static/common/product_def.png',
title:'美的双开门冰箱大容量多美的双开门冰箱大容量多',
description:['双开门','大容量'],
tag:['7天无理由退货','退货险'],
quantity:1,
total:3599,
}
],
productTotal:3599,
},
],
hasMore: true, // 是否有更多数据可以加载
orderList:[],
cancelShow:false,// 取消订单
reasonList:[
{
@@ -279,15 +223,20 @@
reason:null,
remark:null,
},
loading: false, // 加载状态标志
openShow:false,
}
},
onLoad(options) {
const type = options.type;
this.form.type = type ? parseInt(type,10) : ORDER_TYPE.UNPAID;
this.getOrderList();
this.form.type = type && type < 5 ? parseInt(type,10) : MINE_ORDER_TYPE.UNPAID;
this.loadData();
},
methods: {
dayjs,
getValue,
formatDate1,
copyData,
jumpLeft(){
uni.switchTab({
url: '/pages/mine/mine',
@@ -297,24 +246,72 @@
console.log("searchFun",val);
},
checkType(item){
this.form.page = 1;
this.form.type = item.id;
this.getOrderList();
this.orderList = [];
if(item.id!==MINE_ORDER_TYPE.AFTER_SALE){
this.loadData();
}else{
this.openShow = true;// 未开发的弹框
}
},
jumpOrderInfo(){
jumpOrderInfo(item){
uni.navigateTo({
url:"/pages/mine_order_info/mine_order_info?type="+this.type,
url:"/pages/mine_order_info/mine_order_info?id="+item.id,
})
},
async getOrderList(){
// 处理到期时间
handleExpressTime(expressTime){
let resultM=0;
if(!expressTime || expressTime === 0){
return resultM;
}
const currentTimestamp = dayjs().unix();
const time = currentTimestamp - expressTime;
resultM = dayjs(time).format('YYYY-MM-DD HH:MM:SS'); // 获取时分格式的字符串
// 如果需要将时分转换为分钟数(例如,'12:34'转换为754分钟),则需要额外计算:
// const [hours, minutes] = formattedTime.split(':').map(Number); // 分解小时和分钟为数字
// resultM = hours * 60 + minutes; // 计算总分钟数
// console.log(resultM); // 输出总分钟数,例如754
return resultM;
},
// 加载数据的方法
async loadData() {
if (this.loading) return; // 如果正在加载,则不重复加载
this.loading = true; // 设置加载状态为true
try {
// 模拟异步获取数据,实际应用中应该替换为你的数据获取逻辑,例如API调用
const newData = await this.fetchData(this.form.page, this.form.pageSize);
if(newData.entitys && newData.entitys.length !==0){
this.orderList = [...this.orderList, ...newData.entitys]; // 将新数据添加到列表中
this.form.page++; // 页码加1
}
} catch (error) {
console.error('加载数据失败:', error);
} finally {
this.loading = false; // 设置加载状态为false
}
},
// 模拟获取数据的方法,实际应用中应该替换为你的数据获取逻辑,例如从服务器获取数据
async fetchData(page, pageSize) {
const params = {
...this.form,
page,
pageSize,
}
const resp = await getOrderList(params);
console.log("resp",resp);
if(resp && resp.bizcode === 100){
this.orderList = resp.data;
const data = await getOrderList(params);
if(data && data.bizcode === 100){
return data.data
}else{
return [];
}
},
// 当滚动到底部时触发的方法
loadMore() {
this.loadData(); // 加载更多数据
},
checkCancel(status){
this.cancelShow = status;
if(!status){
@@ -324,7 +321,6 @@
}
}
},
/**
* 确认取消
*/
@@ -339,8 +335,33 @@
});
return;
}
console.log("params",params);
this.checkCancel(false);
},
/**
* 确认收货
*/
confirmReceiptOk(item){
const then = this;
uni.showModal({
title: '提示',
content: '是否确认收货?',
success: function (res) {
if (res.confirm) {
then.confirmReceiptFun(item);
}
}
});
},
async confirmReceiptFun(item){
const params = {
id:item.id,
}
const resp = await confirmReceipt(params);
if(resp && resp.bizcode === 100){
this.orderList = [];
this.form.page = 1;
this.loadData();
}
}
}
}
@@ -374,8 +395,8 @@
}
}
.order_list_warp{
height: calc(100vh - 270rpx);
overflow-y: auto;
// height: calc(100vh - 270rpx);
// overflow-y: auto;
}
.order_item{
background: #FFFFFF;
@@ -428,6 +449,10 @@
color: #666666;
text-align: right;
}
.collect_msg_s{
display: flex;
justify-content: space-between;
}
}
}
@@ -479,4 +504,17 @@
position: initial;
width: 94%;
}
.content_info_title{
width: 370rpx;
}
.content_item_yd{
font-weight: bold;
font-size: 24rpx;
display: flex;
align-items: center;
}
.content_item_yd_msg{
font-weight: bold;
font-size: 18rpx;
}
</style>
+279 -121
View File
@@ -1,9 +1,17 @@
<template>
<view class="mine_order_info_warp">
<view
class="mine_order_info_warp"
:style="{
'height': 'calc(100vh - '+height+')'
}"
>
<up-loading-page :loading="listLoading"></up-loading-page>
<view class="order_info_header">
<up-image src="/static/common/left_b.png" width="20" height="19" bgColor="#f1f6ff00" @click="jumpLeft"></up-image>
<view class="header_status">
<up-image src="/static/common/order_status_1.png" width="20" height="19" bgColor="#f1f6ff00"></up-image>
<view style="margin-top: 10rpx;">
<up-image src="/static/common/order_status_1.png" width="20" height="19" bgColor="#f1f6ff00"></up-image>
</view>
<text class="msg">{{getValue(ORDER_STATUS,orderInfo.status)}}</text>
</view>
</view>
@@ -13,41 +21,41 @@
<view style="">
<text style="font-size: 28rpx;font-weight: bold;">需付款:</text>
<text style="font-size: 28rpx;">¥</text>
<text style="font-size: 36rpx;font-weight: bold;">234</text>
<text style="font-size: 28rpx;">.00</text>
<text style="font-size: 20rpx;font-weight: bold;margin-left: 20rpx;">剩余</text>
<text style="font-size: 28rpx;font-weight: bold;margin-left: 10rpx;">29:32:20</text>
<text style="font-size: 20rpx;font-weight: bold;">&nbsp;订单自动取消</text>
<text style="font-size: 36rpx;font-weight: bold;">{{orderInfo.sumAmount}}</text>
<!-- <text style="font-size: 28rpx;">.00</text> -->
<text style="font-size: 20rpx;font-weight: bold;margin-left: 20rpx;">订单</text>
<text style="font-size: 28rpx;font-weight: bold;margin-left: 10rpx;">{{formatDate1(orderInfo.expireTime)}}</text>
<text style="font-size: 20rpx;font-weight: bold;">&nbsp;自动取消</text>
</view>
<view class="payment_but">
<!-- <view class="payment_but">
<view class="but">去支付</view>
</view>
</view> -->
</view>
<view class="content_cancel" v-if="orderInfo.status === ORDER_TYPE.CANCELED">取消原因:超时未支付</view>
<!-- 地址 -->
<view class="steps_warp">
<!-- 物流单号 -->
<view class="address_info" v-if="[ORDER_TYPE.NOT_RECEIVE].includes(orderInfo.status)">
<view class="address_info">
<view class="address_data_warp">
<up-image src="/static/common/waybill.png" width="20" height="20" bgColor="#f1f6ff00"></up-image>
<view class="address_info_name">运单号:</view>
<view class="address_info_mobile" style="margin-right: 20rpx;">{{orderInfo.waybillNumber}}</view>
<up-image src="/static/common/copy.png" width="14" height="14" bgColor="#f1f6ff00" @click="copyData(orderInfo.waybillNumber)"></up-image>
<view class="address_info_name">订单编号:</view>
<view class="address_info_mobile" style="margin-right: 20rpx;">{{orderInfo.orderNum}}</view>
<up-image src="/static/common/copy.png" width="14" height="14" bgColor="#f1f6ff00" @click="copyData(orderInfo.orderNum)"></up-image>
</view>
</view>
<view class="address_info_right" v-if="[ORDER_TYPE.NOT_RECEIVE].includes(orderInfo.status)">&nbsp;</view>
<view class="address_info_right">&nbsp;</view>
<!-- 收货地址 -->
<view class="address_warp">
<view class="address_info">
<view class="address_data_warp">
<up-image src="/static/common/address.png" width="20" height="20" bgColor="#f1f6ff00"></up-image>
<view class="address_info_name">{{orderInfo.name}}</view>
<view class="address_info_mobile">{{orderInfo.mobile}}</view>
<view class="address_info_mobile">{{orderInfo.phone}}</view>
</view>
<view class="address_but">修改地址</view>
<!-- <view class="address_but">修改地址</view> -->
</view>
<view class="address_content">
{{orderInfo.address}}
{{assembleAddress(orderInfo).names}} {{orderInfo.address}}
</view>
</view>
</view>
@@ -56,161 +64,293 @@
<view class="order_comm order_product_warp">
<!-- 头部 -->
<view class="order_product_header">
<up-image :src="orderInfo.product.url" width="22" height="22" bgColor="#f1f6ff00"></up-image>
<view class="order_product_title">{{orderInfo.product.name}}</view>
<up-image :src="orderInfo.shopLogo" width="22" height="22" bgColor="#f1f6ff00" shape="circle"></up-image>
<view class="order_product_title">{{orderInfo.shopName}}</view>
</view>
<!-- 产品详情 -->
<view class="order_item_content">
<view v-for="pItem in orderInfo.product.productList" :key="pItem.id" class="content_item">
<up-image :src="pItem.url" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="content_info">
<view class="content_info_title">{{pItem.title}}</view>
<view class="content_info_tag">{{pItem.tag.join(" ")}}</view>
<view>
<text class="content_info_description" v-for="dItem in pItem.description" :key="dItem">
{{dItem}}
</text>
<view v-for="pItem in orderInfo.items" :key="pItem.id" >
<view class="content_item">
<up-image :src="pItem.mainGraph" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="content_info">
<view class="content_info_title">{{pItem.title}}</view>
<view class="content_info_tag">{{pItem.goodsSpece}}</view>
<view>
<text class="content_info_description" v-for="dItem in pItem.description" :key="dItem">
{{dItem}}
</text>
</view>
</view>
<view class="content_right">
<view class="content_right_total">¥{{pItem.goodsAmount}}</view>
<view class="content_right_quantity">x{{pItem.buyNum}}</view>
</view>
</view>
<view class="content_right">
<view class="content_right_total">¥{{pItem.total}}</view>
<view class="content_right_quantity">x{{pItem.quantity}}</view>
<view class="content_other_item">
<view class="data_item data_item_yd" v-if="pItem.expressNo">
<view class="item_title">运单号:</view>
<view class="item_value">
<view>{{pItem.expressNo}} </view>
<view style="margin-left:10rpx;">
<up-image src="/static/common/copy.png" width="14" height="14" bgColor="#f1f6ff00" @click="copyData(pItem.expressNo)"></up-image>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 金额等数据汇总 -->
<view class="order_comm order_data_warp">
<view class="data_item">
<view class="item_title">商品总价</view>
<view class="item_value">¥3599.00</view>
<view class="item_value">¥{{orderInfo.sumAmount}}</view>
</view>
<view class="data_item">
<view class="item_title">快递运费</view>
<view class="item_value">¥0.00</view>
</view>
<view class="data_item">
<view class="item_title">平台优惠<text class="copy_order_coupon">优惠券</text></view>
<view class="item_value">-¥10.00</view>
<view class="item_title">平台优惠<text class="copy_order_coupon" v-if="orderInfo.coupon">优惠券</text></view>
<view class="item_value">-¥0.00</view>
</view>
<view class="data_item">
<view class="item_title">应付款</view>
<view class="item_value pay_amount">¥3589.00</view>
<view class="item_value pay_amount">¥{{orderInfo.sumAmount}}</view>
</view>
<view class="order_data_but"></view>
<view class="data_item">
<view class="item_title">订单编号</view>
<view class="item_value">2324124232424 <text class="copy_order_number" @click="copyData('2324124232424')">复制</text></view>
</view>
<view class="data_item">
<view class="item_title">买家留言</view>
<view class="item_value">快点发货~</view>
<view class="item_value">{{orderInfo.remark}}</view>
</view>
<view class="data_item">
<view class="item_title">配送方式</view>
<view class="item_value">普通快递</view>
</view>
<view class="data_item">
<!-- <view class="data_item">
<view class="item_title">支付方式</view>
<view class="item_value">微信支付</view>
</view>
</view> -->
<view class="data_item">
<view class="item_title">下单时间</view>
<view class="item_value">2024-10-12 20:18:25</view>
<view class="item_value">{{formatDate(orderInfo.ctdate)}}</view>
</view>
</view>
<!-- 支付方式 -->
<view class="order_way_warp" @click="wayShow = true;" v-if="orderInfo.status === ORDER_TYPE.UNPAID">
<view>支付方式</view>
<view class="order_way_right">
{{getValue(wayOption,wayForm.payway)}}
<up-image src="/static/common/right.png" width="20" height="20" bgColor="#f1f6ff00"></up-image>
</view>
</view>
</view>
<view class="collect_operate order_but_warp">
<view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.UNSHIPPED">取消订单</view>
<view
class="collect_operate order_but_warp"
v-if="[ORDER_TYPE.UNPAID,ORDER_TYPE.NOT_RECEIVE].includes(orderInfo.status)"
>
<!-- <view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.UNSHIPPED">取消订单</view> -->
<view class="operate_comm operate_but_2" v-if="orderInfo.status === ORDER_TYPE.UNPAID" @click="goPay">去付款</view>
<view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.COMPLETED">申请退款</view>
<view class="operate_comm operate_but_2" v-if="orderInfo.status === ORDER_TYPE.NOT_RECEIVE">确认收货</view>
<view class="operate_comm operate_but_3" v-if="orderInfo.status === ORDER_TYPE.UNSHIPPED">提醒发货</view>
<view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.COMPLETED">申请售后</view>
<view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.AFTER_SALE">查看售后</view>
<view class="operate_comm operate_but_1" v-if="[ORDER_TYPE.COMPLETED].includes(orderInfo.status)">删除记录</view>
<view class="operate_comm operate_but_3" v-if="[ORDER_TYPE.COMPLETED,ORDER_TYPE.CANCELED].includes(orderInfo.status)">再次购买</view>
<!-- <view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.COMPLETED">申请退款</view> -->
<view class="operate_comm operate_but_2" v-if="orderInfo.status === ORDER_TYPE.NOT_RECEIVE" @click="confirmReceiptOk(orderInfo)">确认收货</view>
<!-- <view class="operate_comm operate_but_3" v-if="orderInfo.status === ORDER_TYPE.UNSHIPPED">提醒发货</view> -->
<!-- <view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.COMPLETED">申请售后</view> -->
<!-- <view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.AFTER_SALE">查看售后</view> -->
<!-- <view class="operate_comm operate_but_1" v-if="[ORDER_TYPE.COMPLETED].includes(orderInfo.status)">删除记录</view> -->
<!-- <view class="operate_comm operate_but_3" v-if="[ORDER_TYPE.COMPLETED,ORDER_TYPE.CANCELED].includes(orderInfo.status)">再次购买</view> -->
</view>
<!-- 选择支付方式 -->
<up-popup v-model:show="wayShow" :round="10" :closeOnClickOverlay="false" :closeable="true" :safeAreaInsetBottom="false">
<view class="way_popup_warp">
<view class="way_popup_title">支付方式</view>
<up-radio-group
v-model="wayForm.payway"
placement="column"
>
<view class="way_item" v-for="item in wayOption" :key="item.type">
<view class="way_item_">
<!-- <view style="margin-top: 2rpx;"><up-image :src="item.path" width="20" height="20" bgColor="#f1f6ff00"></up-image></view> -->
<view class="way_item_val">{{item.name}}<text v-if="item.balance">&nbsp;&nbsp;({{item.balance}})</text></view>
</view>
<up-radio
:name="item.type"
activeColor="#FF7C41"
>
</up-radio>
</view>
</up-radio-group>
<view class="popup_but" @click="wayShow = false;">
确认
</view>
</view>
</up-popup>
<up-toast ref="uToastRef"></up-toast>
</view>
</template>
<script>
import { ORDER_TYPE,ORDER_STATUS,getValue } from '@/utils/enumUtils.js';
import { copyData } from '@/utils/index.js';
import { copyData,assembleAddress,formatDate,formatDate1 } from '@/utils/index.js';
import { getDetail,payment,getSupportPay,confirmReceipt } from '@/api/order.js';
import { appWxpayFun,zfbPayFun,jumpWayOk,jumpWayError } from '@/utils/payUtils.js'
export default {
computed: {
ORDER_TYPE() {
return ORDER_TYPE;
return ORDER_TYPE;
},
ORDER_STATUS() {
return ORDER_STATUS;
return ORDER_STATUS;
},
ORDER_STATUS_CSS() {
return ORDER_STATUS_CSS;
}
return ORDER_STATUS_CSS;
},
},
data() {
return {
type:0,
orderInfo:{
// status:ORDER_TYPE.UNPAID,// 待付款
// status:ORDER_TYPE.CANCELED,// 已取消
// status:ORDER_TYPE.UNSHIPPED,// 待发货
status:ORDER_TYPE.NOT_RECEIVE,// 待收货
// status:ORDER_TYPE.COMPLETED,// 完成
// status:ORDER_TYPE.AFTER_SALE,
name:"张先生",
mobile:"18****2848",
address:"河南省郑州市金水区东风路街道北三环索凌路交叉口明明小区1号楼1座",
waybillNumber:'SF23423443242',
product:{
id:1,
url:'/static/common/order_defal.png',
name:"哈希店铺",
status:1,
paymentTime:29,// 剩余付款时间,单位:分钟
productList:[
{
id:1,
url:'/static/common/product_def.png',
title:'美的双开门冰箱大容量多美的双开门冰箱大容量多',
description:['双开门','大容量'],
tag:['7天无理由退货','退货险'],
quantity:1,
total:3599,
},{
id:2,
url:'/static/common/product_def.png',
title:'美的双开门冰箱大容量多美的双开门冰箱大容量多',
description:['双开门','大容量'],
tag:['7天无理由退货','退货险'],
quantity:1,
total:3599,
}
],
productTotal:7599,
},
id:0,
orderInfo:{},
listLoading:false,
wayForm:{
id:0,
payway:null,// 支付方式
},
wayShow:false,
wayOption:[],// 支付选项
height:'180rpx',
}
},
onLoad(options) {
const type = options.type;
this.type = type ? parseInt(type,10) : 0;
const id = options.id;
this.id = id ? parseInt(id,10) : 0;
this.getOrderInfo();
this.getWayOption();
},
methods: {
getValue,
copyData,
assembleAddress,
formatDate,
formatDate1,
jumpLeft(){
uni.navigateTo({
url:"/pages/mine_order/mine_order?type="+this.type,
url:"/pages/mine_order/mine_order?type="+this.orderInfo.status,
})
},
async getWayOption(){
const result = await getSupportPay();
if(result && result.bizcode === 100){
this.wayOption = result.data;
}
},
// 查询订单详情
async getOrderInfo(){
this.listLoading = true;
const params={
id:this.id,
}
const result = await getDetail(params);
if(result && result.bizcode === 100){
const orderInfo = result.data;
if([ORDER_TYPE.UNPAID,ORDER_TYPE.NOT_RECEIVE].includes(orderInfo.status)){
this.height = '180rpx';
}else{
this.height = '0rpx';
}
this.orderInfo = orderInfo;
}
this.listLoading = false;
},
// 去支付
goPay(){
console.log("goPay.....")
async goPay(){
const payway = this.wayForm.payway;
if(!payway || payway === 0){
this.$refs.uToastRef.show({
type: 'error',
message: "请先选择支付方式",
});
return;
}
const params={
id:this.orderInfo.id,
payway,
}
const resp = await payment(params);
// 提交订单成功,就唤起支付
if(resp && resp.bizcode === 100){
const item = resp.data;
if(item.status === 1){
jumpWayOk();
return;
}
if(item.wechat && Object.keys(item.wechat).length !==0){
this.appWxpay(item.wechat,item.orderId,item.orderNum);
}else if(item.alipay && Object.keys(item.alipay).length !==0 && item.alipay){
this.zfbPay(item.alipay,item.orderId,item.orderNum);
}else{
this.$refs.uToastRef.show({
type: 'error',
message: "订单支付失败",
});
setTimeout(()=>{
jumpWayError()
},2000)
}
}else{
this.getOrderInfo();
}
},
// app 微信支付
async appWxpay(alipay,orderId,orderNum){
try {
const result = await appWxpayFun(alipay,orderId,orderNum);
console.log('支付成功', result);
// 处理支付成功后的逻辑,如更新订单状态等
} catch (error) {
console.error('支付失败', error);
// 处理支付失败后的逻辑,如提示用户等
}
},
// 支付宝支付
async zfbPay(alipay,orderId,orderNum){
try {
const result = await zfbPayFun(alipay,orderId,orderNum);
console.log('支付成功', result);
// 处理支付成功后的逻辑,如更新订单状态等
} catch (error) {
console.error('支付失败', error);
// 处理支付失败后的逻辑,如提示用户等
}
},
/**
* 确认收货
*/
confirmReceiptOk(item){
const then = this;
uni.showModal({
title: '提示',
content: '是否确认收货?',
success: function (res) {
if (res.confirm) {
then.confirmReceiptFun(item);
}
}
});
},
async confirmReceiptFun(item){
const params = {
id:item.id,
}
const resp = await confirmReceipt(params);
if(resp && resp.bizcode === 100){
this.orderList = [];
this.form.page = 1;
this.loadData();
}
}
}
}
@@ -218,7 +358,7 @@
<style lang="scss" scoped>
.mine_order_info_warp{
height: calc(100vh - 180rpx);
// height: calc(100vh - 180rpx);
background-color: $app-bj;
position: relative;
overflow-y: auto;
@@ -247,7 +387,7 @@
.order_info_content{
position: absolute;
top: 184rpx;
width: 100%;
width: calc(100% - 40rpx);
padding: 0 20rpx;
.content_due{
display: grid;
@@ -280,13 +420,13 @@
background: #FFFFFF;
border-radius: 24rpx;
padding: 20rpx;
width: calc(100% - 80rpx);
width: calc(100% - 40rpx);
margin-top: 66rpx;
.address_info_right{
border-left: 1rpx dashed #99999959;
height: 26rpx;
height: 14rpx;
width: 10rpx;
margin: 20rpx;
margin: 10rpx 20rpx;
}
.address_warp{
}
@@ -329,11 +469,12 @@
border-radius: 20rpx;
padding: 30rpx;
margin-top: 30rpx;
width: calc(100% - 96rpx);
width: calc(100% - 60rpx);
}
.order_product_warp{
.order_product_header{
display: flex;
align-items: center;
}
.order_product_title{
font-weight: bold;
@@ -345,19 +486,8 @@
.order_data_warp{
margin-bottom: 20rpx;
.data_item{
display: flex;
justify-content: space-between;
line-height: 60rpx;
font-weight: bold;
font-size: 24rpx;
}
.item_title{
color: #808080;
}
.item_value{
color: #1A1A1A;
}
.pay_amount{
color: $app-bt-bj;
}
@@ -396,4 +526,32 @@
height: 34rpx;
}
}
.content_other_item{
margin-top: 20rpx;
}
.data_item{
display: flex;
justify-content: space-between;
line-height: 60rpx;
font-weight: bold;
font-size: 24rpx;
}
.item_title{
color: #808080;
}
.item_value{
color: #1A1A1A;
display: flex;
}
.order_way_warp{
margin-bottom: 60rpx;
width: calc(100% - 60rpx);
}
.content_info_title{
width: 370rpx;
}
.data_item_yd{
display: flex;
justify-content: left;
}
</style>
File diff suppressed because one or more lines are too long
+7 -2
View File
@@ -9,7 +9,7 @@
<text style="font-size: 40rpx;">84</text>
</view>
</view>
<view class="header_but">提现</view>
<view class="header_but" @click="jumpWithdraw">提现</view>
</view>
<view class="mine_purse_bonus_content">
<view class="title">财务明细</view>
@@ -77,7 +77,12 @@
}
},
methods: {
// 提现
jumpWithdraw(){
uni.navigateTo({
url:"/pages/mine_purse_bonus_withdraw/mine_purse_bonus_withdraw",
})
}
}
}
</script>
+142 -188
View File
@@ -1,5 +1,6 @@
<template>
<view class="order_submit_warp">
<Header :leftTitle="$t('order.submit.title')" leftPathType="switchTab" leftPath="/pages/shopping_cart/shopping_cart"/>
<!-- 收件人信息 -->
<view class="order_submit_header_warp" @click="checkAddressShow(true,'data')" v-if="orderInfo.address && Object.keys(orderInfo.address).length !==0">
<view class="header_areaAddress_warp">
@@ -20,7 +21,9 @@
<view v-else class="no_address" @click="checkAddressShow(true,'data')">
<view class="no_address_title">
<view>请填写地址</view>
<up-image src="/static/common/right.png" width="14" height="14" bgColor="#f1f6ff00"></up-image>
<view style="margin-top: 10rpx;">
<up-image src="/static/common/right.png" width="14" height="14" bgColor="#f1f6ff00"></up-image>
</view>
</view>
<view class="no_address_msg">您还未添加收货地址,请完善地址!</view>
</view>
@@ -28,7 +31,7 @@
<view class="order_store_warp order_product_warp" v-for="(item,index) in orderInfo.shops" :key="item.id">
<!-- 头部 -->
<view class="order_product_header">
<up-image :src="item.logo" width="22" height="22" bgColor="#f1f6ff00"></up-image>
<up-image :src="item.logo" width="22" height="22" bgColor="#f1f6ff00" shape="circle"></up-image>
<view class="order_product_title">{{item.name}}</view>
</view>
<view v-for="(addItem,addIndex) in item.addrTimes" :key="addIndex">
@@ -44,9 +47,9 @@
</view>
<!-- 产品详情 -->
<view class="order_item_content" v-for="(pItem,pIndex) in addItem.goods" :key="pItem.id">
<up-image :src="pItem.img" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<up-image :src="pItem.img" width="80" height="80" bgColor="#f1f6ff00" @click="jumpProductInfo(pItem)"></up-image>
<view class="content_info_right">
<view>
<view class="content_info_left_total" @click="jumpProductInfo(pItem)">
<view class="content_info_title">{{pItem.title}}</view>
<view class="content_info_tag">{{pItem.specs}}</view>
</view>
@@ -98,7 +101,7 @@
<view class="order_way_warp" @click="wayShow = true;">
<view>支付方式</view>
<view class="order_way_right">
{{getValue(PAYMENT_WAY_,orderInfo.paymentMethod)}}
{{getValue(wayOption,orderInfo.paymentMethod)}}
<up-image src="/static/common/right.png" width="20" height="20" bgColor="#f1f6ff00"></up-image>
</view>
</view>
@@ -116,14 +119,13 @@
v-model="orderInfo.paymentMethod"
placement="column"
>
<view class="way_item" v-for="item in wayList" :key="item.id">
<view class="way_item" v-for="item in wayOption" :key="item.id">
<view class="way_item_">
<view style="margin-top: 2rpx;"><up-image :src="item.path" width="20" height="20" bgColor="#f1f6ff00"></up-image></view>
<view class="way_item_val">{{item.name}}</view>
<!-- <view style="margin-top: 2rpx;"><up-image :src="item.path" width="20" height="20" bgColor="#f1f6ff00"></up-image></view> -->
<view class="way_item_val">{{item.name}}<text v-if="item.balance">&nbsp;&nbsp;({{item.balance}})</text></view>
</view>
<up-radio
:name="item.id"
:disabled="item.disabled"
:name="item.type"
activeColor="#FF7C41"
>
</up-radio>
@@ -140,6 +142,7 @@
<view class="address_popup_warp">
<view class="address_popup_title">收件地址</view>
<view class="address_popup_content">
<view class="address_popup_content_add" @click="addAdress"> + 新增地址</view>
<Address @valueFunc="getAddressValueFunc"/>
</view>
<view class="popup_but" @click="addressOk">
@@ -154,65 +157,87 @@
<script>
import Address from '@/components/address.vue';
import { PAYMENT_WAY,PAYMENT_WAY_,PRODUCT_DELIVERY_TIME,getValue } from '@/utils/enumUtils.js';
import { getSettleList,settle } from '@/api/cart.js'
import { PAYMENT_WAY,PAYMENT_WAY_,PRODUCT_DELIVERY_TIME,getValue,WAY_LIST } from '@/utils/enumUtils.js';
import { getSettleList,settle,updateGoodsNum } from '@/api/cart.js';
import { getSupportPay } from '@/api/order.js';
import { feedback } from '@/api/payment.js';
import { assembleAddress } from '@/utils/index.js'
import Header from '@/components/header.vue';
import { appWxpayFun,zfbPayFun,jumpWayOk,jumpWayError } from '@/utils/payUtils.js'
export default {
computed: {
PAYMENT_WAY_() {
return PAYMENT_WAY_;
},
PRODUCT_DELIVERY_TIME() {
return PRODUCT_DELIVERY_TIME;
}
},
},
components: {
Address,
},
onLoad(option) {
const ids = option.ids;
if(ids){
this.ids = ids;
this.getOrder();
}
Header,
},
data() {
return {
ids:0,
orderInfo:{
// coupon:2,//优惠卷
paymentMethod:null,// 支付方式
paymentMethod:PAYMENT_WAY.ALIPAY,// 支付方式,暂时默认用支付宝
total:4000,// 需要支付的总金额
address:{},// 选中的地址
store:[],
},
wayList:[
{
disabled:false,
id:PAYMENT_WAY.WECHAT,
name:"微信支付",
path:"/static/product/way_wx.png",
},
{
disabled:false,
id:PAYMENT_WAY.ALIPAY,
name:"支付宝支付",
path:"/static/product/way_zfb.png",
},
],
wayShow:false,
addressShow:false,// 收件地址选择
addressType:'',// 收件地址数据类型
addressIndex:0,// 收件地址数据类型
shopsIndex:0,// 收件地址数据类型
selectAddress:{},// 收件地址选择
wayOption:[],
// leftPath:'',
// leftPathType:'',
};
},
onLoad(option) {
const ids = option.ids;
console.log("ids",ids);
if(ids && ids!=="null"){
this.ids = ids;
this.getOrder();
// const idsArr = ids.split(",");
// console.log("idsArr.length",idsArr.length);
// if(idsArr.length >1){
// this.leftPath = "/pages/sort/sort";
// this.leftPathType = "switchTab"
// }else{
// this.leftPath = "/pages/productInfo/productInfo?id="+ids;
// this.leftPathType = "navigateTo"
// }
}
const addressShow = option.addressShow;
if(addressShow && addressShow !=="null"){
this.addressShow = addressShow;
}
},
mounted() {
this.getWayOption();
},
methods: {
getValue,
assembleAddress,
// 增加收货地址
addAdress(){
const ids = this.ids;
// addressShow = true;
uni.navigateTo({
url:"/pages/mine_address_add/mine_address_add?ids="+ids,
})
},
async getWayOption(){
const result = await getSupportPay();
if(result && result.bizcode === 100){
this.wayOption = result.data;
}
},
async getOrder(){
const ids = this.ids;
if(!ids || ids ===0){
@@ -253,28 +278,43 @@
* @param {Object} addIndex 需要修改店铺的数据节点
* @param {Object} index 需要修改的数据节点
*/
quantityFun(type,index,addIndex,pIndex){
let currentQuantity = this.orderInfo.shops[index].addrTimes[addIndex].goods[pIndex].num;// 当前数量
async quantityFun(type,index,addIndex,pIndex){
const data = this.orderInfo.shops[index].addrTimes[addIndex].goods[pIndex];
let currentQuantity = Number(data.num);// 当前数量
let currentTotalPrice = Number(data.totalPrice);// 当前金额
let currentAmount = Number(this.orderInfo.amount);// 总金额
if(type === "minus"){
if(currentQuantity === 1){
this.$refs.uToastRef.show({
type: 'error',
message: "不能再减拉,不能小于最低购买数量~",
});
});x3
}else{
currentQuantity = currentQuantity - 1;
currentAmount = currentAmount - data.unitPrice;
currentTotalPrice = currentTotalPrice - data.unitPrice;
}
}else if(type === "add"){
// 需要判断一下库存
currentQuantity = currentQuantity + 1;
currentAmount = currentAmount + data.unitPrice;
currentTotalPrice = currentTotalPrice + data.unitPrice;
}
const params={
id:data.id,
goodsNum:currentQuantity,
}
const result = await updateGoodsNum(params);
if(result && result.bizcode === 100){
this.orderInfo.shops[index].addrTimes[addIndex].goods[pIndex].num = currentQuantity;
this.orderInfo.shops[index].addrTimes[addIndex].goods[pIndex].totalPrice = currentTotalPrice.toFixed(2);
this.orderInfo.amount = currentAmount.toFixed(2);
}
this.orderInfo.shops[index].addrTimes[addIndex].goods[pIndex].num = currentQuantity;
},
// 获取备注
getRemark(){
const orderInfo = this.orderInfo;
console.log("orderInfo",orderInfo);
const remarkArr = [];
if(orderInfo && Object.keys(orderInfo).length!==0){
const remarObj={};
@@ -292,7 +332,6 @@
}
remarkArr.push(remarObj);
}
console.log("remarkArr",remarkArr);
return remarkArr;
},
/**
@@ -300,6 +339,15 @@
*/
async goPay(){
const orderInfo = this.orderInfo;
if(!orderInfo.address || Object.keys(orderInfo.address).length === 0){
this.$refs.uToastRef.show({
type: 'error',
message: "请选择收货地址",
});
return;
}
const way = orderInfo.paymentMethod;
if(!way || way === 0){
this.$refs.uToastRef.show({
@@ -308,6 +356,7 @@
});
return;
}
const params={
addrId:orderInfo.address.id,// 收货地址ID
cartIds:this.ids,//结算的购物车ID,多个以逗号分割,ALL表示全选
@@ -319,93 +368,48 @@
// 提交订单成功,就唤起支付
if(resp && resp.bizcode === 100){
const item = resp.data;
if(params.payway === PAYMENT_WAY.WECHAT){// APP微信支付
if(item.wechat && Object.keys(item.wechat).length !==0){
this.appWxpay(item.wechat);
}else{
this.$refs.uToastRef.show({
type: 'error',
message: "订单支付失败",
});
}
}else if(params.payway === PAYMENT_WAY.ALIPAY){// 支付宝支付
if(item.alipay && Object.keys(item.alipay).length !==0){
this.zfbPay(item.alipay);
}else{
this.$refs.uToastRef.show({
type: 'error',
message: "订单支付失败",
});
}
if(item.status === 1){
jumpWayOk();
return;
}
if(item.wechat && Object.keys(item.wechat).length !==0){
this.appWxpay(item.wechat,item.orderId,item.orderNum);
}else if(item.alipay && Object.keys(item.alipay).length !==0 && item.alipay){
this.zfbPay(item.alipay,item.orderId,item.orderNum);
}else{
this.$refs.uToastRef.show({
type: 'error',
message: "订单支付失败",
});
setTimeout(()=>{
jumpWayError()
},2000)
}
}else{
this.getOrder();
}
},
// app 微信支付
appWxpay(item){
const newThis = this;
const orderInfo = {
"appid": item.appId, // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
"noncestr": item.nonceStr, // 随机字符串
"package": "Sign=WXPay", // 固定值
"partnerid": item.partnerId, // 微信支付商户号
"prepayid": item.prepayId, // 统一下单订单号
"timestamp": item.timeStamp, // 时间戳(单位:秒)
"sign": item.sign // 签名,这里用的 MD5/RSA 签名
};
uni.requestPayment({
provider:"wxpay",
orderInfo: orderInfo,
success: function(res) {
console.log('success:' + res);
newThis.payFeedbackFun(item.orderId,res.orderNum,1);
newThis.jumpWayOk();
},
fail: function(err) {
console.log('fail:',err);
this.$refs.uToastRef.show({
type: 'error',
message: "支付失败",
});
}
});
async appWxpay(alipay,orderId,orderNum){
try {
const result = await appWxpayFun(alipay,orderId,orderNum);
console.log('支付成功', result);
// 处理支付成功后的逻辑,如更新订单状态等
} catch (error) {
console.error('支付失败', error);
// 处理支付失败后的逻辑,如提示用户等
}
},
// 支付宝支付
zfbPay(item){
const that = this;
uni.requestPayment({
provider: 'alipay',
orderInfo: item.orderStr,
success(res) {
console.log("res",res);
that.payFeedbackFun(item.orderId,item.orderNum,1);
that.jumpWayOk();
},
//调用失败的回调
fail(err) {
console.log('fail:',err);
this.$refs.uToastRef.show({
type: 'error',
message: "支付失败",
});
}
})
},
// 跳转到支付成功页面
jumpWayOk(){
uni.navigateTo({
url:"/pages/order_submit_ok/order_submit_ok",
})
},
// 支付结果回调
async payFeedbackFun(orderId,orderNum,status){
const params = {
orderId,
orderNum,
status,
async zfbPay(alipay,orderId,orderNum){
try {
const result = await zfbPayFun(alipay,orderId,orderNum);
console.log('支付成功', result);
// 处理支付成功后的逻辑,如更新订单状态等
} catch (error) {
console.error('支付失败', error);
// 处理支付失败后的逻辑,如提示用户等
}
console.log("params",params);
const response = await feedback(params);
console.log("反馈结果",response);
},
// 地址选中
getAddressValueFunc(item){
@@ -431,6 +435,12 @@
this.addressType = type;
this.addressIndex = addIndex;
this.shopsIndex = index;
},
jumpProductInfo(item){
console.log("item",item);
uni.navigateTo({
url:"/pages/productInfo/productInfo?id="+item.goodsId,
})
}
}
}
@@ -538,12 +548,16 @@
}
.order_item_content{
display: flex;
margin-top: 20rpx;
.content_info_right{
margin-left: 20rpx;
display: grid;
width: calc(100% - 160rpx);
}
.content_info_left_total{
}
.content_info_title {
width: 266px;
width: 460rpx;
}
.content_info_tag{
font-size: 20rpx;
@@ -600,21 +614,7 @@
}
}
.order_way_warp{
display: flex;
justify-content: space-between;
align-items: center;
background: #FFFFFF;
border-radius: 24rpx;
margin-top: 30rpx;
padding: 30rpx;
font-weight: 500;
font-size: 26rpx;
color: #222222;
.order_way_right{
display: flex;
}
}
.order_pay_but{
position: fixed;
bottom: 0;
@@ -637,54 +637,8 @@
font-size: 36rpx;
color: $app-bt-bj;
}
}
.way_popup_warp{
padding: 30rpx;
min-height: 800rpx;
width: calc(100% - 60rpx);
.way_popup_title{
text-align: center;
margin-bottom: 60rpx;
}
.way_item{
display: flex;
justify-content: space-between;
line-height: 82rpx;
.way_item_{
display: flex;
align-items: center;
}
.way_item_val{
font-weight: bold;
font-size: 30rpx;
color: #222222;
margin-left: 20rpx;
}
}
}
.popup_but{
position: fixed;
bottom: 64rpx;
background: $app-bt-bj;
border-radius: 16rpx;
color: #FFFFFF;
text-align: center;
padding: 20rpx 0;
width: calc(100% - 60rpx);
}
.address_popup_warp{
padding: 30rpx;
height: 1200rpx;
overflow-y: hidden;
.address_popup_title{
text-align: center;
margin-bottom: 20rpx;
}
.address_popup_content{
height: calc(100% - 180rpx);
overflow-y: auto;
}
}
</style>
+14 -5
View File
@@ -1,15 +1,21 @@
<template>
<view class="order_sumbit_ok_warp">
<view class="ok_img">
<up-image src="/static/product/ok.png" width="120" height="120" bgColor="#f1f6ff00"></up-image>
<view class="ok_img_msg">支付成功</view>
<Header leftTitle="" left-path-type="switchTab" left-path="/pages/mine/mine"/>
<view class="order_sumbit_ok_content_warp">
<view class="ok_img">
<up-image src="/static/product/ok.png" width="120" height="120" bgColor="#f1f6ff00"></up-image>
<view class="ok_img_msg">支付成功</view>
</view>
<view class="ok_but" @click="jumpHome">确认</view>
</view>
<view class="ok_but" @click="jumpHome">确认</view>
</view>
</template>
<script>
import Header from '@/components/header.vue';
export default {
components:{Header},
data() {
return {
@@ -29,7 +35,10 @@
.order_sumbit_ok_warp{
height: calc(100vh - 80rpx);
text-align: center;
padding: 40rpx;
.order_sumbit_ok_content_warp{
padding: 40rpx;
}
.ok_img{
display: grid;
.ok_img_msg{
File diff suppressed because one or more lines are too long
+30 -21
View File
@@ -5,6 +5,7 @@
<up-swiper
:list="swiperList"
height="280"
@change="e => currentNum = e.current"
>
<template #indicator>
<view
@@ -27,7 +28,9 @@
<view class="content_data">
<view class="content_data_price">
<text>¥</text>
<text style="font-size: 60rpx;" v-if="orderInfo.maxPrice && orderInfo.maxPrice !==0">{{orderInfo.minPrice}} - {{orderInfo.maxPrice}}</text>
<text style="font-size: 60rpx;" v-if="orderInfo.minPrice && orderInfo.maxPrice">
{{orderInfo.minPrice}} - {{orderInfo.maxPrice}}
</text>
<text style="font-size: 60rpx;" v-else>{{orderInfo.minPrice}}</text>
<text class="price_o">¥{{orderInfo.adPrice}}</text>
</view>
@@ -119,6 +122,7 @@
:round="10"
:closeOnClickOverlay="false"
:closeable="true"
@close="specificationShow=false"
mode="bottom"
>
<view class="specification_warp">
@@ -146,7 +150,8 @@
{{selectSpecificationTempl.price}}
</text>
<view style="font-size: 50rpx" v-else>
{{orderInfo.minPrice}} - {{orderInfo.maxPrice}}
{{orderInfo.minPrice}}
<text v-if="orderInfo.maxPrice">- {{orderInfo.maxPrice}}</text>
</view>
<view class="price_content_coupon_warp" v-if="orderInfo.couponPrice && orderInfo.couponPrice !==0">优惠卷{{orderInfo.couponPrice}}</view>
</view>
@@ -186,11 +191,11 @@
<view class="quantity_but" @click="quantityFun('add')">+</view>
</view>
</view>
<view v-if="specificationShowType === 'buy'" class="specification_buy_but" @click="byFun">去支付</view>
<view v-else-if="specificationShowType === 'addCart'" class="specification_buy_but" @click="addCart">加入购物车</view>
<view v-if="specificationShowType === 'buy'" class="specification_buy_but" @click="addCart(true)">去支付</view>
<view v-else-if="specificationShowType === 'addCart'" class="specification_buy_but" @click="addCart(false)">加入购物车</view>
<view v-else class="product_but_right popup_but">
<view class ='but_comm join_warp' @click="addCart">加入购物车</view>
<view class="but_comm buy_warp" @click="byFun">立即购买</view>
<view class ='but_comm join_warp' @click="addCart(false)">加入购物车</view>
<view class="but_comm buy_warp" @click="addCart(true)">立即购买</view>
</view>
</view>
</view>
@@ -213,7 +218,7 @@
return {
id:0,
swiperList:[],
currentNum:1,
currentNum:0,
specificationShow:false,
specificationShowType:'',// 弹框类型
orderInfo:{},
@@ -369,16 +374,9 @@
}
this.orderInfo.quantity = currentQuantity;
},
// 立即购买,确定订单页面
byFun(){
// 先加入购物车,再去购买
this.addCart();
uni.navigateTo({
url: '/pages/order_submit/order_submit',
})
},
// 加入购入车
async addCart(){
async addCart(isBy = false){
const selectTempl = this.selectSpecificationTempl;
if(!selectTempl || Object.keys(selectTempl).length ===0){
uni.showToast({
@@ -395,15 +393,25 @@
}
const resp = await addGoods(params);
if(resp && resp.bizcode === 100){
uni.showToast({
title: '成功加入购物车',
icon: 'success', // 可选 success/loading/none
duration: 2000 // 持续时长,单位ms
});
if(isBy){
uni.navigateTo({
url: '/pages/order_submit/order_submit?ids='+resp.data,
})
}else{
uni.showToast({
title: '成功加入购物车',
icon: 'success', // 可选 success/loading/none
duration: 2000 // 持续时长,单位ms
});
}
setTimeout(()=>{
this.checkSpecification(false,null);
},2000)
}
},
// 跳转到分享页面
jumpShare(){
}
}
@@ -720,6 +728,7 @@
}
.popup_but{
background-color: #FFFFFF;
.but_comm{
width: 40%;
}
+25 -4
View File
@@ -95,9 +95,11 @@
>
<template #label>
<text>已阅读并同意</text>
<text class="policy_a_warp">《哈希优品服务协议》</text>
<text>及</text>
<text class="policy_a_warp">《隐私政策》</text>
<text class="policy_a_warp" @click="jumpUserAgreement">《服务协议》</text>
<text>、</text>
<text class="policy_a_warp" @click="jumpPrivacyAgreement">《隐私政策》</text>
<text>、</text>
<text class="policy_a_warp" @click="jumpProductAgreement">《售后保障协议》</text>
</template>
</up-checkbox>
</view>
@@ -110,6 +112,7 @@
import { getUserList } from '@/api/common.js';
import { register } from '@/api/auth.js';
import { setStorageFun,TOKEN_NAME,USER_KEY,USER_DATA,USER_LOGIN_TIME } from '@/utils/auth.js';
import CryptoJS from 'crypto-js';
export default {
data() {
@@ -193,7 +196,7 @@
const params = {
mobile:form.mobile,
smsCode:form.smsCode,
password:form.loginPassword,
password:CryptoJS.MD5(form.loginPassword).toString(),
inviteCode:form.referralCode,
}
const resp = await register(params);
@@ -254,6 +257,24 @@
this.countdown = false;
}
},
// 用户协议
jumpUserAgreement(){
uni.navigateTo({
url: '/pages/mine_user_agreement/mine_user_agreement?backPath=register'
})
},
// 隐私协议
jumpPrivacyAgreement(){
uni.navigateTo({
url: '/pages/mine_privacy_agreement/mine_privacy_agreement?backPath=register'
})
},
// 售后保障协议
jumpProductAgreement(){
uni.navigateTo({
url: '/pages/mine_product_agreement/mine_product_agreement?backPath=login'
})
},
}
}
</script>
+7 -6
View File
@@ -13,6 +13,7 @@
'width': '590rpx',
}"
v-model="form.keyword"
clearable
>
<template #prefix>
<up-image src="/static/common/search.png" width="20" height="20" bgColor="#f1f6ff00" @click="jumpHome"></up-image>
@@ -26,7 +27,7 @@
<!-- 历史搜索 -->
<view class="search_history" v-if="!poductList || poductList.length === 0">
<view class="search_history_title">
<view>历史搜索</view>
<view>猜你喜欢</view>
<up-image src="/static/common/delete.png" width="20" height="20" bgColor="#f1f6ff00" @click="isShowSearch = true;"></up-image>
</view>
<view class="search_history_cotent" v-if="searchList && searchList.length !==0">
@@ -62,7 +63,7 @@
<text>¥</text>
<text style="font-size: 36rpx;">{{item.adPrice}}</text>
</view>
<view>已售{{item.price}}件</view>
<view>已售9999件</view>
</view>
</view>
</view>
@@ -78,7 +79,7 @@
<text>¥</text>
<text style="font-size: 36rpx;">{{item.adPrice}}</text>
</view>
<view>已售{{item.price}}件</view>
<view>已售9999件</view>
</view>
</view>
</view>
@@ -136,9 +137,9 @@
}
},
onLoad(option) {
const id = option.categoryId;
if(id && id !==0){
this.form.categoryId = id;
const keyword = option.keyword;
if(keyword && keyword !==0 && keyword !== "undefined"){
this.form.keyword = keyword;
this.searchClickFun();
}
},
+216 -161
View File
@@ -1,121 +1,127 @@
<template>
<view
:style="{'height':isDataNull ? 'calc(100vh - 134rpx)':'calc(100vh - 256rpx)'}"
class="shopping_cart_warp"
>
<view class="shopping_cart_header">
<view class="cart">购物车({{shoppingTotal}})</view>
<view class="enit_but" @click="isEdit = true">编辑</view>
</view>
<!-- 购物车列表 -->
<up-loading-page :loading="listLoading"></up-loading-page>
<view
class="shopping_cart_content"
<view>
<view
:style="{'height':isDataNull ? 'calc(100vh - 134rpx)':'calc(100vh - 410rpx)'}"
class="shopping_cart_warp"
>
<view v-if="!isDataNull" class="shopping_cart_content_item" v-for="(item,index) in shoppingList" :key="item.id" >
<!-- 头部 -->
<up-checkbox
:customStyle="{marginBottom: '8px'}"
name="isCheck"
usedAlone
v-model:checked="item.isCheck"
shape="circle"
activeColor="#FF7C41"
size="19"
iconSize="18"
@change="(event)=>shoppingChange(event,index)"
>
<template #label>
<view class="content_item_header">
<up-image :src="item.shopLogo ?item.shopLogo :'/static/shopping/store.png'" width="22" height="22" bgColor="#f1f6ff00" shape="circle"></up-image>
<view class="order_product_title">{{item.shopName}}{{item.id}}</view>
</view>
</template>
</up-checkbox>
<view >
<view class="content_item_info" v-for="(pItem,pIndex) in item.product" :key="pItem.id">
<up-checkbox
:customStyle="{marginBottom: '8px'}"
name="isCheck"
usedAlone
v-model:checked="pItem.isCheck"
shape="circle"
activeColor="#FF7C41"
size="19"
iconSize="18"
:disabled="!pItem.isAvail"
@change="(event)=>productChange(event,index,pIndex)"
>
</up-checkbox>
<view class="info_item" @click="jumpInfo(pItem)">
<up-image :src="pItem.mainGraph" width="100" height="100" bgColor="#f1f6ff00"></up-image>
<view class="content_info">
<view class="shopping_content_info_title">{{pItem.name}}</view>
<view class="content_info_description">
{{pItem.goodsSpece}}
</view>
<view class="shopping_info_amount">
<view>
<view style="color: #FF7C41FF;">
<text style="font-size: 22rpx;">¥</text>
<text style="font-size: 32rpx;">{{pItem.unitPrice}}</text>
</view>
<view class="shopping_info_amount_original">¥{{pItem.unitPrice}}</view>
<view class="shopping_cart_header">
<view class="cart">购物车({{shoppingTotal}})</view>
<view class="enit_but" @click="isEdit = true" v-if="!isEdit" v-show="!isDataNull">编辑</view>
<view class="enit_but" @click="isEdit = false" v-else v-show="isDataNull">取消</view>
</view>
<!-- 购物车列表 -->
<up-loading-page :loading="listLoading"></up-loading-page>
<view
class="shopping_cart_content"
>
<view v-if="!isDataNull" class="shopping_cart_content_item" v-for="(item,index) in shoppingList" :key="item.id" >
<!-- 店铺头部 -->
<up-checkbox
:customStyle="{marginBottom: '8px'}"
name="isCheck"
usedAlone
v-model:checked="item.isCheck"
shape="circle"
activeColor="#FF7C41"
size="19"
iconSize="18"
@change="(event)=>shoppingChange(event,index)"
>
<template #label>
<view class="content_item_header">
<up-image :src="item.shopLogo ?item.shopLogo :'/static/shopping/store.png'" width="22" height="22" bgColor="#f1f6ff00" shape="circle"></up-image>
<view class="order_product_title">{{item.shopName}}{{item.id}}</view>
</view>
</template>
</up-checkbox>
<view >
<view class="content_item_info" v-for="(pItem,pIndex) in item.product" :key="pItem.id">
<!-- 单个商品 -->
<up-checkbox
:customStyle="{marginBottom: '8px'}"
name="isCheck"
usedAlone
v-model:checked="pItem.isCheck"
shape="circle"
activeColor="#FF7C41"
size="19"
iconSize="18"
:disabled="!isEdit && [1,2].includes(pItem.goodsStatus)"
@change="(event)=>productChange(event,index,pIndex)"
>
</up-checkbox>
<view class="info_item" >
<up-image :src="pItem.mainGraph" width="100" height="100" bgColor="#f1f6ff00" @click="jumpInfo(pItem)"></up-image>
<view class="content_info">
<view class="shopping_content_info_title" @click="jumpInfo(pItem)">{{pItem.name}}</view>
<view class="content_info_description">
{{pItem.goodsSpece}}
</view>
<view>
<view class="shopping_info_quantity">
<view class="quantity_but" @click="quantityFun('minus',index,pIndex,pItem.id)">-</view>
<view class="quantity_value">{{pItem.buyNum}}</view>
<view class="quantity_but" @click="quantityFun('add',index,pIndex,pItem.id)">+</view>
<view class="shopping_info_amount">
<view>
<view style="color: #FF7C41;">
<text style="font-size: 22rpx;">¥</text>
<text style="font-size: 32rpx;">{{pItem.unitPrice}}</text>
</view>
<view class="shopping_info_amount_original">¥{{pItem.unitPrice}}</view>
</view>
<view>
<view class="shopping_info_quantity">
<view class="quantity_but" @click="quantityFun('minus',index,pIndex,pItem.id)">-</view>
<view class="quantity_value">{{pItem.buyNum}}</view>
<view class="quantity_but" @click="quantityFun('add',index,pIndex,pItem.id)">+</view>
</view>
<view v-if="[1].includes(pItem.goodsStatus)" class="insufficient_stock">库存不足</view>
<view v-if="[2].includes(pItem.goodsStatus)" class="insufficient_stock">商品已下架</view>
</view>
<view v-if="!pItem.isAvail" class="insufficient_stock">库存不足</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view v-else class="not_order_warp">
<up-image src="/static/common/not_shopping.png" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="not_order_msg_warp">购物车是空的</view>
</view>
<choiceness/>
</view>
<view v-else class="not_order_warp">
<up-image src="/static/common/not_shopping.png" width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="not_order_msg_warp">购物车是空的</view>
<!-- 操作按钮 -->
<view v-if="!isDataNull">
<view class="shopping_cart_but">
<!-- 全选 -->
<view class="shopping_cart_but_total">
<up-checkbox
name="isAll"
usedAlone
v-model:checked="isAll"
shape="circle"
activeColor="#FF7C41"
size="19"
iconSize="18"
@change="isAllChange"
>
<template #label>
<text style="font-size: 26rpx;color: #444444;">全选</text>
</template>
</up-checkbox>
<text style="margin-left: 20rpx;font-size: 24rpx;color: #444444;" v-if="!isEdit">合计:</text>
<text style="font-size: 24rpx;" v-if="!isEdit">¥</text>
<text style="font-size: 32rpx;" v-if="!isEdit">{{total}}</text>
</view>
<view v-if="isEdit" class="delete_but_css" @click="deleteShopping">
删除({{count}})
</view>
<view v-else class="add_but_css" @click="settleShopping">
结算({{count}})
</view>
</view>
</view>
<choiceness/>
<up-toast ref="uToastRef"></up-toast>
</view>
<!-- 操作按钮 -->
<view v-if="!isDataNull">
<view class="shopping_cart_but">
<view class="shopping_cart_but_total">
<up-checkbox
name="isAll"
usedAlone
v-model:checked="isAll"
shape="circle"
activeColor="#FF7C41"
size="19"
iconSize="18"
@change="isAllChange"
>
<template #label>
<text style="font-size: 26rpx;color: #444444;">全选</text>
</template>
</up-checkbox>
<text style="margin-left: 20rpx;font-size: 24rpx;color: #444444;">合计:</text>
<text style="font-size: 24rpx;">¥</text>
<text style="font-size: 32rpx;">{{total}}</text>
</view>
<view v-if="isEdit" class="delete_but_css" @click="deleteShopping">
删除
</view>
<view v-else class="add_but_css" @click="settleShopping">
结算({{count}})
</view>
</view>
</view>
<up-toast ref="uToastRef"></up-toast>
<CustomTabBar :tabIndex="2"/>
</view>
</template>
@@ -123,9 +129,10 @@
import choiceness from '@/components/choiceness/choiceness.vue';
import { getCartList,updateGoodsNum,removeGoods } from '@/api/cart.js';
import CustomTabBar from '@/components/custom-tab-bar.vue';
export default {
components:{choiceness},
components:{choiceness,CustomTabBar},
data() {
return {
shoppingTotal:0,// 总条数
@@ -139,8 +146,16 @@
listLoading:false,
}
},
onLoad() {
onShow() {
/*#ifdef APP-PLUS*/
uni.hideTabBar({
animation: false
})
/*#endif*/
this.getCartList();
},
onLoad() {
},
methods: {
/**
@@ -148,19 +163,28 @@
*/
async getCartList(){
this.listLoading = true;
let result = [];
const resp = await getCartList();
if(resp && resp.bizcode === 100){
// 处理了后的数据
const data = this.transformedArray(resp.data);
this.shoppingTotal = resp.data.length;
this.shoppingList = data;
const data = resp.data || []
if(data && data.length!==0){
// 处理了后的数据
result = this.transformedArray(data);
}
this.shoppingTotal = data.length;
}
this.shoppingList = result;
this.listLoading = false;
this.total=0;// 总合计的金额
this.count=0;// 总条数
this.isDataNull = result.length === 0 ? true:false;
},
// 处理购物车的数据
transformedArray(originalArray){
const newOriginalArray = [];
if(!originalArray || originalArray.length === 0){
return newOriginalArray;
}
originalArray.map(curr=>{
const existingShop = newOriginalArray.find(shop => shop.shopId === curr.shopId && shop.shopName === curr.shopName);
if (existingShop) {
@@ -175,7 +199,7 @@
goodsSpece: curr.goodsSpece,// 规格
specsId: curr.specsId,// 规格Id
isCheck:false,// 用作于全选
isAvail:curr.isAvail,// 是否有库存
goodsStatus:curr.goodsStatus,//商品状态:0-可下单,1-库存不够,2-商品已下架
});
} else {
// 如果商店不存在,则创建一个新商店对象,并初始化 productObj 数组
@@ -195,7 +219,7 @@
goodsSpece: curr.goodsSpece,// 规格
specsId: curr.specsId,// 规格Id
isCheck:false,// 用作于全选
isAvail:curr.isAvail,// 是否有库存,用作于全选
goodsStatus:curr.goodsStatus,//商品状态:0-可下单,1-库存不够,2-商品已下架
}]
});
}
@@ -209,7 +233,14 @@
* @param {Object} cItem 需要修改的数据节点
*/
async quantityFun(type,index,pIndex,id){
// 选中的当前商品
const currentData = this.shoppingList[index].product[pIndex];
let currentQuantity = this.shoppingList[index].product[pIndex].buyNum;// 当前数量
let total = Number(this.total);
let count = Number(this.count);
const data = this.shoppingList[index].product[pIndex];
if(type === "minus"){
if(currentQuantity === 1){
this.$refs.uToastRef.show({
@@ -219,19 +250,26 @@
return;
}else{
currentQuantity = currentQuantity - 1;
total = total - data.unitPrice;
count = count - 1;
}
}else if(type === "add"){
// 需要判断一下库存
currentQuantity = currentQuantity + 1;
total = total + data.unitPrice;
count = count + 1;
}
const params={
id,
goodsNum:currentQuantity,
}
const result = await updateGoodsNum(params);
console.log("result",result);
if(result && result.bizcode === 100){
this.shoppingList[index].product[pIndex].buyNum = currentQuantity;
if(currentData.isCheck){
this.total = total.toFixed(2);
this.count = count;
}
}
},
/**
@@ -250,7 +288,6 @@
url:"/pages/order_submit/order_submit?ids="+deleteId.join(","),
})
this.isAll = false;
this.selectCheck(false);
},
/**
* 删除选中的
@@ -259,7 +296,7 @@
const then = this;
uni.showModal({
title: '提示',
content: '您确定要删除选中的所有商品吗?',
content: '您确定要删除选中的('+this.getCheckList().length+'件)商品吗?',
success: function (res) {
if (res.confirm) {
then.deleteShoppingFun();
@@ -283,8 +320,6 @@
const result = await removeGoods(params);
if(result && result.bizcode === 100){
this.isEdit = false;
this.isAll = false;
this.selectCheck(false);
this.$refs.uToastRef.show({
type: 'success',
message: "删除成功",
@@ -313,17 +348,11 @@
})
return deleteId;
},
// 全部选中 or 全部取消选中
isAllChange(val){
this.selectCheck(val);
},
/**
* 编辑是否选中
*/
selectCheck(isAll){
// 全部选中 or 全部取消选中
isAllChange(isAll){
const currentShoppingList = this.shoppingList;
currentShoppingList.map(item=>{
currentShoppingList.map((item,index)=>{
if(isAll){
item.isCheck = true;
}else{
@@ -337,7 +366,13 @@
}
}
})
this.shoppingList = currentShoppingList;
this.shoppingList = currentShoppingList;
if(isAll){
this.checkIsAll();
}else{
this.total = 0;
this.count = 0;
}
},
/**
@@ -345,7 +380,6 @@
* @param {Object} item
*/
jumpInfo(item){
console.log("item",item);
uni.navigateTo({
url:'/pages/productInfo/productInfo?id='+item.goodsId,
})
@@ -353,40 +387,61 @@
// 单个产品的单选按钮选中与取消选中
productChange(val,index,pIndex){
let total = this.total;
let count = this.count;
const data = this.shoppingList[index].product[pIndex];
if(val){
total = total + data.buyNum * data.unitPrice;
count = count + data.buyNum;
}else{
total = total - data.buyNum * data.unitPrice;
count = count - data.buyNum;
}
this.total = total;
this.count = count;
setTimeout(()=>{
// 检查全选按钮
this.checkIsAll();
},300);
},
// 单个店铺的单选按钮选中与取消选中
shoppingChange(val,index){
let total = this.total;
let count = this.count;
shoppingChange(isAll,index){
const data = this.shoppingList[index];
data.product.map(item=>{
if(val){
item.isCheck = true;
total = total + item.buyNum * item.unitPrice;
count = count + item.buyNum;
}else{
item.isCheck = false;
total = total - item.buyNum * item.unitPrice;
count = count - item.buyNum;
}
})
if(isAll){
data.product.forEach(o => o.isCheck=true);
}else{
data.product.forEach(o => o.isCheck=false);
}
this.shoppingList[index] = data;
this.total = total;
this.count = count;
setTimeout(()=>{
// 检查全选按钮
this.checkIsAll();
},300);
},
/**
* 检查是否全选
*/
checkIsAll(){
let total = 0;
let count = 0;
const shoppingList = this.shoppingList;
if(shoppingList && shoppingList.length !==0){
let sumFlag = false;
shoppingList.map(item=>{
let flag = true;
item.product.map(oItem=>{
if(oItem.isCheck){
total = total + oItem.buyNum * oItem.unitPrice;
count = count + oItem.buyNum;
}else{
flag = false;
}
})
if(flag){
item.isCheck = true;
sumFlag = true;
}else{
item.isCheck = false;
}
})
this.shoppingList = shoppingList;
this.isAll = sumFlag;
// 删除不需要显示价格
if(!this.isEdit){
this.total = total.toFixed(2);
}
this.count = count;
}
},
}
@@ -415,7 +470,7 @@
}
.shopping_cart_content{
margin-top: 30rpx;
height: calc(100vh - 304rpx);
height: calc(100vh - 456rpx);
overflow-y: auto;
.shopping_cart_content_item{
background-color: #FFFFFF;
@@ -468,7 +523,7 @@
.shopping_cart_but{
position: fixed;
bottom: 0;
bottom: 140rpx;
left: 0;
width: calc(100% - 40rpx);
background: #FFFFFF;
+72 -51
View File
@@ -7,10 +7,10 @@
<view>分类</view>
<view v-if="selCategory === 1" class="category_item_sel_but"></view>
</view>
<view :class="selCategory === 2 ? 'category_item category_item_sel':'category_item'" @click="checkCategory(2)">
<!-- <view :class="selCategory === 2 ? 'category_item category_item_sel':'category_item'" @click="checkCategory(2)">
<view>品牌</view>
<view v-if="selCategory === 2" class="category_item_sel_but"></view>
</view>
</view> -->
</view>
<!-- 搜索 -->
<view style="width: 200rpx;" @click="jumpSearch">
@@ -32,54 +32,53 @@
</view>
</scroll-view>
<!-- 商品类别数据 -->
<block>
<scroll-view scroll-y class="right-box">
<!-- banner图 -->
<view style="padding: 0rpx 20rpx;">
<up-swiper
:list="bannerList"
height="80px"
></up-swiper>
</view>
<view class="page-view">
<!-- 这里还有一层循环 -->
<up-loading-page :loading="tabbarContentLoading"></up-loading-page>
<view class="class-item" v-for="(item,index) in tabbarContentList" :key="index">
<view class="item-title">
<text>{{item.name}}</text>
</view>
<view class="item-container" v-if="item.foods && item.foods.length !==0">
<view
class="thumb-box"
v-for="(item1, index1) in item.foods"
:key="index1"
@click="jumpProduct(item1)"
>
<image class="item-menu-image" :src="item1.icon?item1.icon:'/static/common/def_img.jpg'" mode=""></image>
<view class="item-menu-name">{{item1.name}}</view>
</view>
</view>
<view v-else class="not_order_warp">
<view class="not_order_warp_img"><up-image src="/static/common/not_shopping.png" width="100" height="100" bgColor="#f1f6ff00"></up-image></view>
<view class="not_order_msg_warp">暂无分类,快去添加吧~</view>
<scroll-view scroll-y class="right-box">
<!-- banner图 -->
<view style="padding: 0rpx 20rpx;">
<up-swiper
:list="bannerList"
height="80px"
></up-swiper>
</view>
<view class="page-view">
<!-- 这里还有一层循环 -->
<up-loading-page :loading="tabbarContentLoading"></up-loading-page>
<view class="class-item" v-for="(item,index) in tabbarContentList" :key="index">
<view class="item-title">
<text>{{item.name}}</text>
</view>
<view class="item-container" v-if="item.foods && item.foods.length !==0">
<view
class="thumb-box"
v-for="(item1, index1) in item.foods"
:key="index1"
@click="jumpSearch(item1)"
>
<image class="item-menu-image" :src="item1.icon?item1.icon:'/static/common/def_img.jpg'" mode=""></image>
<view class="item-menu-name">{{item1.name}}</view>
</view>
</view>
<view v-else class="not_order_warp">
<view class="not_order_warp_img"><up-image src="/static/common/not_shopping.png" width="100" height="100" bgColor="#f1f6ff00"></up-image></view>
<view class="not_order_msg_warp">暂无分类,快去添加吧~</view>
</view>
</view>
</scroll-view>
</block>
</view>
</scroll-view>
</view>
<CustomTabBar :tabIndex="1"/>
</view>
</template>
<script>
import classifyData from '@/common/classify.data.js';
import { getCascadeCategory } from '@/api/common.js';
import CustomTabBar from '@/components/custom-tab-bar.vue';
export default {
components:{CustomTabBar},
data() {
return {
selCategory:1,
tabbar: classifyData,
scrollTop: 0, //tab标题的滚动条位置
current: null, // 预设当前项的值
menuHeight: 0, // 左边菜单的高度
@@ -94,13 +93,36 @@
tabbarContentLoading:false,
}
},
mounted() {
onShow() {
/*#ifdef APP-PLUS*/
uni.hideTabBar({
animation: false
})
/*#endif*/
},
onShow() {
const then = this;
this.getSort(0).then(resp=>{
if(resp && resp.length !==0){
const fData = resp[0];
this.tabbarList = resp;
this.swichMenu(fData,0);
const sortId = uni.getStorageSync('sortId');
// 如果有默认的参数就默认选中参数
if(sortId && sortId !==0){
let fData = {};
let currentIndex = 0;
resp.map((item,index)=>{
if(item.id === sortId){
fData = item;
currentIndex = index;
return;
}
})
this.swichMenu(fData,currentIndex);
}else{
const fData = resp[0];
// 否则就选中第一个
this.swichMenu(fData,0);
}
}
});
},
@@ -108,9 +130,13 @@
checkCategory(val){
this.selCategory = val;
},
jumpSearch(){
jumpSearch(item){
let path = "/pages/search/search";
if(item && Object.keys(item).length !==0){
path = path+"?keyword="+item.name;
}
uni.navigateTo({
url:'/pages/search/search',
url:path,
})
},
// 查询分类
@@ -164,20 +190,14 @@
}).exec();
})
},
// 跳转到搜索页面
jumpProduct(item){
uni.navigateTo({
url:'/pages/search/search?categoryId='+item.id,
})
}
}
},
}
</script>
<style lang="scss" scoped>
.sort_warp{
padding: 130rpx 0rpx 0rpx;
height: calc(100vh - 130rpx);
height: calc(100vh - 270rpx);// 130 上边的导航栏,140下边的导航栏
}
.sort_header{
display: flex;
@@ -215,7 +235,7 @@
display: flex;
overflow: hidden;
margin-top: 20rpx;
height: calc(100vh - 216rpx);
height: calc(100vh - 356rpx);
}
.u-search-inner {
@@ -235,11 +255,12 @@
.u-tab-view {
width: 200rpx;
height: 100%;
background: #f6f6f6;
}
.u-tab-item {
height: 110rpx;
background: #f6f6f6;
// background: #f6f6f6;
box-sizing: border-box;
display: flex;
align-items: center;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long