This commit is contained in:
parent
7c36041677
commit
ecc4df957b
|
@ -1,8 +1,8 @@
|
|||
let BASE_URL
|
||||
import store from "@/store/user.js"
|
||||
// 环境
|
||||
let env = "dev"
|
||||
// let env = "prod"
|
||||
// let env = "dev"
|
||||
let env = "prod"
|
||||
|
||||
switch(env){
|
||||
case 'prod': BASE_URL = 'https://ceshi-erp.lihaink.cn';break;
|
||||
|
|
17
pages.json
17
pages.json
|
@ -9,20 +9,19 @@
|
|||
}
|
||||
},
|
||||
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "购物",
|
||||
"disableScroll": true,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/login/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "登录",
|
||||
"enablePullDownRefresh": false,
|
||||
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "购物",
|
||||
"disableScroll": true,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -75,15 +75,23 @@
|
|||
const isAgree = ref(false); //是否同意协议
|
||||
|
||||
const weixinLogin = () => {
|
||||
if (!isAgree.value) return uni.$u.toast('请先阅读并同意协议')
|
||||
|
||||
if (!isAgree.value) return uni.$u.toast('请先阅读并同意协议');
|
||||
uni.showLoading({
|
||||
title: '登录中'
|
||||
})
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res) => {
|
||||
userLoginWeixinApi({
|
||||
code: res.code
|
||||
}).then(res=>{
|
||||
console.log(res);
|
||||
userStore.setUserInfo(res.data);
|
||||
userStore.setToken(res.data.token);
|
||||
uni.hideLoading();
|
||||
if(!res.data.supplier) uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
else uni.$u.toast('功能开发中')
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
<image class="bg" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/e3a7b202404261113002322.webp"
|
||||
mode="widthFix"></image>
|
||||
<view class="u-card">
|
||||
<up-avatar src="" size="80"></up-avatar>
|
||||
<up-avatar :src="userInfo.avatar" size="80"></up-avatar>
|
||||
<view class="content">
|
||||
<view class="u-phone">151****6699</view>
|
||||
<view class="u-id">ID: 6655</view>
|
||||
<view class="u-phone">{{userInfo.nickname}}</view>
|
||||
<view class="u-id">ID: {{userInfo.id}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -56,6 +56,11 @@
|
|||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import useUserStore from "@/store/user";
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
const userInfo = userStore.userInfo;
|
||||
|
||||
const navTo = (type=0) => {
|
||||
uni.navigateTo({
|
||||
|
|
|
@ -37,51 +37,57 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue"
|
||||
import modal from "@/components/modal.vue";
|
||||
import { addressListsApi, addressEditApi, addressDeleteApi } from "@/api/user.js";
|
||||
import { onShow } from "@dcloudio/uni-app";
|
||||
import { ref } from "vue"
|
||||
import modal from "@/components/modal.vue";
|
||||
import { addressListsApi, addressEditApi, addressDeleteApi } from "@/api/user.js";
|
||||
import { onShow } from "@dcloudio/uni-app";
|
||||
|
||||
const navTo = (url)=>{
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
const navTo = (url) => {
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
})
|
||||
}
|
||||
|
||||
const show = ref(false);
|
||||
const deleteInfo = ref({});
|
||||
const showDelete = (item) => {
|
||||
if(addressList.value.length<=1) return uni.$u.toast('最后一个地址无法删除!');
|
||||
deleteInfo.value = item;
|
||||
show.value = true;
|
||||
}
|
||||
|
||||
const updateDefault = (item) => {
|
||||
addressEditApi({
|
||||
...item,
|
||||
is_default: !item.is_default
|
||||
}).then(res => {
|
||||
getAddressLists()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const deleteAddress = () => {
|
||||
addressDeleteApi({
|
||||
address_id: deleteInfo.value.address_id
|
||||
}).then(res => {
|
||||
getAddressLists();
|
||||
})
|
||||
show.value = false;
|
||||
|
||||
}
|
||||
|
||||
const addressList = ref([]);
|
||||
const getAddressLists = () => {
|
||||
addressListsApi().then(res => {
|
||||
addressList.value = res.data.lists;
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
onShow(() => {
|
||||
getAddressLists();
|
||||
})
|
||||
}
|
||||
|
||||
const show = ref(false);
|
||||
const deleteInfo = ref({});
|
||||
const showDelete = (item)=>{
|
||||
deleteInfo.value = item;
|
||||
show.value = true;
|
||||
}
|
||||
|
||||
const updateDefault = (item)=>{
|
||||
addressEditApi({
|
||||
...item,
|
||||
is_default: !item.is_default
|
||||
})
|
||||
}
|
||||
|
||||
const deleteAddress = ()=>{
|
||||
addressDeleteApi({
|
||||
address_id: deleteInfo.value.address_id
|
||||
})
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
const addressList = ref([]);
|
||||
const getAddressLists = ()=>{
|
||||
addressListsApi().then(res=>{
|
||||
addressList.value = res.data.lists;
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
onShow(()=>{
|
||||
getAddressLists();
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -118,11 +124,12 @@ onShow(()=>{
|
|||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 26rpx;
|
||||
|
||||
.left{
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
image{
|
||||
|
||||
image {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin-right: 6rpx;
|
||||
|
@ -137,7 +144,7 @@ onShow(()=>{
|
|||
.btn {
|
||||
display: flex;
|
||||
margin-left: 20rpx;
|
||||
|
||||
|
||||
&:active {
|
||||
color: rgba(#7a7a7a, 0.8);
|
||||
transition: background-color 0.5s;
|
||||
|
@ -147,20 +154,26 @@ onShow(()=>{
|
|||
}
|
||||
}
|
||||
}
|
||||
.bottom-fixed{
|
||||
|
||||
.bottom-fixed {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
height: 120rpx;
|
||||
height: calc(constant(safe-area-inset-bottom) + 120rpx); /* 适用于iOS设备 */
|
||||
height: calc(env(safe-area-inset-bottom) + 120rpx); /* 适用于Android设备 */
|
||||
height: calc(constant(safe-area-inset-bottom) + 120rpx);
|
||||
/* 适用于iOS设备 */
|
||||
height: calc(env(safe-area-inset-bottom) + 120rpx);
|
||||
/* 适用于Android设备 */
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
padding: 20rpx;
|
||||
padding-bottom: calc(constant(safe-area-inset-bottom) + 20rpx); /* 适用于iOS设备 */
|
||||
padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx); /* 适用于Android设备 */
|
||||
padding-bottom: calc(constant(safe-area-inset-bottom) + 20rpx);
|
||||
/* 适用于iOS设备 */
|
||||
padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx);
|
||||
/* 适用于Android设备 */
|
||||
}
|
||||
|
||||
@keyframes disappear {
|
||||
to {
|
||||
opacity: 0;
|
||||
|
|
|
@ -2,122 +2,149 @@
|
|||
<view class="shop-item">
|
||||
<view class="item-title" @click="navTo">
|
||||
<view>{{datas.number}}</view>
|
||||
<view>待付款</view>
|
||||
<view v-if="datas.paid==0">
|
||||
<text>待付款</text>
|
||||
</view>
|
||||
<view v-else>
|
||||
<text v-if="datas.status==0">待发货</text>
|
||||
<text v-if="datas.status==1">待收货</text>
|
||||
<text v-if="datas.status==2||datas.status==3">已完成</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-body" @click="navTo">
|
||||
<view class="body-content">
|
||||
<view v-for="(item,index) in datas.goods_list" :key="index">
|
||||
<view style="display: flex;flex: 1;flex-shrink: 0;">
|
||||
<view v-for="(item,index) in datas.goods_list" :key="index">
|
||||
<image class="image" :src="item.imgs"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
style="display: flex;flex-direction: column;align-items: center;justify-content: center;width: 100rpx;">
|
||||
<up-icon name="arrow-right-double" color="#20B128"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="all">共5件商品, 总金额 <text>¥{{datas.total}}</text> </view>
|
||||
<view class="all">共 {{datas.goods_count}} 件商品, 总金额 <text>¥{{datas.total}}</text> </view>
|
||||
</view>
|
||||
<view v-if="type==1" class="item-btn">
|
||||
<view v-if="datas.paid=0" class="item-btn">
|
||||
<view style="width: 80px;"><up-button size="small" plain color="#989898" shape="circle">取消订单</up-button></view>
|
||||
<view style="width: 80px;"><up-button size="small" plain color="#20B128" shape="circle">立即支付</up-button></view>
|
||||
</view>
|
||||
<view v-if="type==2||type==0" class="item-btn">
|
||||
<view style="width: 80px;"><up-button size="small" plain color="#989898" shape="circle">申请售后</up-button></view>
|
||||
<view style="width: 80px;"><up-button size="small" plain color="#20B128" shape="circle">确认收货</up-button></view>
|
||||
<view style="width: 80px;"><up-button size="small" plain color="#20B128" shape="circle">再次购买</up-button></view>
|
||||
<view v-else class="item-btn">
|
||||
<!-- <view style="width: 80px;"><up-button size="small" plain color="#989898" shape="circle">申请售后</up-button></view> -->
|
||||
<view v-if="datas.status==1" style="width: 80px;"><up-button size="small" plain color="#20B128"
|
||||
shape="circle">确认收货</up-button></view>
|
||||
<view v-if="datas.status==2||datas.status==3" style="width: 80px;"><up-button size="small" plain color="#20B128"
|
||||
shape="circle">再次购买</up-button></view>
|
||||
<view @click="navTo" style="width: 80px;"><up-button size="small" plain color="#20B128"
|
||||
shape="circle">查看详情</up-button></view>
|
||||
</view>
|
||||
<view v-if="type==3" class="item-close">
|
||||
<!-- <view v-if="type==3" class="item-close">
|
||||
<view class="title">
|
||||
<view class="type">退款申请中</view>
|
||||
<view>等待商家处理</view>
|
||||
</view>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
type:{
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
datas:{
|
||||
type: Object,
|
||||
default: ()=>{}
|
||||
}
|
||||
})
|
||||
|
||||
const navTo = ()=>{
|
||||
uni.navigateTo({
|
||||
url: `/pagesOrder/detail/detail?type=0&id=${props.datas.id}`
|
||||
// 订单状态(0:待发货;1:待收货;2:已完成;3:已完成)
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
datas: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
const navTo = () => {
|
||||
uni.navigateTo({
|
||||
url: `/pagesOrder/detail/detail?type=${props.datas.paid}&id=${props.datas.id}`
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
.shop-item{
|
||||
.shop-item {
|
||||
width: 710rpx;
|
||||
margin-bottom: 20rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 14rpx;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
.item-title{
|
||||
|
||||
.item-title {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.item-body{
|
||||
|
||||
.item-body {
|
||||
margin: 20rpx 0;
|
||||
.body-content{
|
||||
|
||||
.body-content {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
color: #989898;
|
||||
|
||||
|
||||
.image{
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
|
||||
.image {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
margin-right: 20rpx;
|
||||
border-radius: 14rpx;
|
||||
}
|
||||
.title{
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 28rpx;
|
||||
color: #444;
|
||||
}
|
||||
.tips{
|
||||
|
||||
.tips {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 24rpx;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
.all{
|
||||
|
||||
.all {
|
||||
text-align: right;
|
||||
font-size: 26rpx;
|
||||
text{
|
||||
|
||||
text {
|
||||
color: #F55726;
|
||||
}
|
||||
}
|
||||
}
|
||||
.item-btn{
|
||||
|
||||
.item-btn {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
view{
|
||||
|
||||
view {
|
||||
width: 80rpx;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
.item-close{
|
||||
|
||||
.item-close {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background-color: #F6F6F6;
|
||||
padding: 15rpx;
|
||||
border-radius: 14rpx;
|
||||
|
||||
.title{
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
.type{
|
||||
|
||||
.type {
|
||||
font-weight: 600;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
const tablist = ref([
|
||||
{ name: '全部' },
|
||||
{ name: '待付款' },
|
||||
{ name: '待发货' },
|
||||
{ name: '待收货' },
|
||||
// { name: '退款/售后' },
|
||||
]);
|
||||
|
@ -61,10 +62,13 @@
|
|||
[],
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
])
|
||||
const getOrderList = (type=0)=>{
|
||||
const getOrderList = (type=0, status='', paid=1)=>{
|
||||
orderListApi({
|
||||
...where.value
|
||||
...where.value,
|
||||
status: status,
|
||||
paid: paid
|
||||
}).then(res=>{
|
||||
orderList.value[type] = res.data.lists;
|
||||
})
|
||||
|
@ -75,7 +79,10 @@
|
|||
tabsActive.value = +options.type;
|
||||
swiperCurrent.value = +options.type;
|
||||
}
|
||||
getOrderList();
|
||||
getOrderList(0);
|
||||
getOrderList(1, '', 0);
|
||||
getOrderList(2, 0);
|
||||
getOrderList(3, 1);
|
||||
})
|
||||
|
||||
</script>
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
:customStyle="{color:'#666666'}">修改</up-button></view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="!isAddress" class="m-card row">
|
||||
<view v-if="!addressInfo.address_id" class="m-card row">
|
||||
<up-cell-group>
|
||||
<up-cell title="我的地址" :isLink="true" :border="false" @click="showAddress=true"></up-cell>
|
||||
<up-cell title="我的地址" :isLink="true" :border="false" @click="openAddress()"></up-cell>
|
||||
</up-cell-group>
|
||||
</view>
|
||||
<view v-else class="m-card m-address">
|
||||
|
@ -123,7 +123,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
import { onLoad, onShow } from "@dcloudio/uni-app"
|
||||
import { nextTick, ref } from "vue"
|
||||
import addressPopup from "@/components/addressPopup.vue";
|
||||
import shopListPopupVue from "@/components/shopListPopup.vue";
|
||||
|
@ -169,6 +169,12 @@
|
|||
isAddress.value = true;
|
||||
console.log(e);
|
||||
}
|
||||
const openAddress = ()=>{
|
||||
if(addressList.length>0) showAddress.value=true;
|
||||
else uni.navigateTo({
|
||||
url: '/pagesOrder/addressEdit/addressEdit'
|
||||
})
|
||||
}
|
||||
|
||||
// 提货点相关
|
||||
const shopListShow = ref(false);
|
||||
|
@ -275,6 +281,8 @@
|
|||
|
||||
onLoad(options=>{
|
||||
checkOrder();
|
||||
})
|
||||
onShow(()=>{
|
||||
getAddressList();
|
||||
})
|
||||
</script>
|
||||
|
|
|
@ -15,8 +15,9 @@ const useUserStore = defineStore("user", () => {
|
|||
|
||||
userInfo.value = {
|
||||
"nickname": "哈哈",
|
||||
"id": 1,
|
||||
"mobile": "17685151643",
|
||||
"avatar": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/avatar.png",
|
||||
"avatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/tFJnfhVKlAlIecticsOhjAu8CHa6ibZacWrcHHkiahu7f0dQlWYgwu1b0TPLSLlO1xCTa6KN1krqg3XSIo3vq6uCQ/132",
|
||||
"token": "a8670fe7f1014c0f5125f6ca0c3b9cb3"
|
||||
}
|
||||
|
||||
|
@ -27,7 +28,7 @@ const useUserStore = defineStore("user", () => {
|
|||
}
|
||||
token.value = "a8670fe7f1014c0f5125f6ca0c3b9cb3"
|
||||
|
||||
return { userInfo, setToken, token, setToken }
|
||||
return { userInfo, setUserInfo, token, setToken }
|
||||
})
|
||||
|
||||
export default useUserStore;
|
|
@ -118,8 +118,8 @@ require("./uni_modules/uview-plus/libs/config/props/upload.js");
|
|||
require("./uni_modules/uview-plus/libs/config/zIndex.js");
|
||||
require("./uni_modules/uview-plus/libs/function/platform.js");
|
||||
if (!Math) {
|
||||
"./pages/index/index.js";
|
||||
"./pages/login/login.js";
|
||||
"./pages/index/index.js";
|
||||
"./pages/cart/cart.js";
|
||||
"./pages/my/my.js";
|
||||
"./pagesOrder/order/order.js";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"pages": [
|
||||
"pages/index/index",
|
||||
"pages/login/login",
|
||||
"pages/index/index",
|
||||
"pages/cart/cart",
|
||||
"pages/my/my"
|
||||
],
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
"use strict";
|
||||
const _imports_0$1 = "/static/tab/ba.png";
|
||||
const _imports_1$1 = "/static/tab/ca.png";
|
||||
const _imports_1$1 = "/static/icon/n-check.png";
|
||||
const _imports_0$1 = "/static/icon/check.png";
|
||||
const _imports_0 = "/static/tab/ba.png";
|
||||
const _imports_1 = "/static/tab/ca.png";
|
||||
const _imports_2 = "/static/icon/cart.png";
|
||||
const _imports_1 = "/static/icon/n-check.png";
|
||||
const _imports_0 = "/static/icon/check.png";
|
||||
exports._imports_0 = _imports_0$1;
|
||||
exports._imports_0$1 = _imports_0;
|
||||
exports._imports_1 = _imports_1$1;
|
||||
|
|
|
@ -72,9 +72,9 @@ const _sfc_main = {
|
|||
f: common_vendor.t(item.detail),
|
||||
g: addressType.value == index
|
||||
}, addressType.value == index ? {
|
||||
h: common_assets._imports_0$1
|
||||
h: common_assets._imports_0
|
||||
} : {
|
||||
i: common_assets._imports_1$1
|
||||
i: common_assets._imports_1
|
||||
}, {
|
||||
j: index,
|
||||
k: common_vendor.o(($event) => addressType.value = index, index)
|
||||
|
|
|
@ -180,9 +180,9 @@ const _sfc_main = {
|
|||
return common_vendor.e({
|
||||
a: !item.check
|
||||
}, !item.check ? {
|
||||
b: common_assets._imports_1$1
|
||||
b: common_assets._imports_1
|
||||
} : {
|
||||
c: common_assets._imports_0$1
|
||||
c: common_assets._imports_0
|
||||
}, {
|
||||
d: common_vendor.o(($event) => checkItem(item, !item.check), index),
|
||||
e: item.imgs,
|
||||
|
@ -228,9 +228,9 @@ const _sfc_main = {
|
|||
o: common_vendor.o(animationfinish),
|
||||
p: common_vendor.unref(checkAll) != cartInfo.value.count
|
||||
}, common_vendor.unref(checkAll) != cartInfo.value.count ? {
|
||||
q: common_assets._imports_1$1
|
||||
q: common_assets._imports_1
|
||||
} : {
|
||||
r: common_assets._imports_0$1
|
||||
r: common_assets._imports_0
|
||||
}, {
|
||||
s: common_vendor.unref(checkAll)
|
||||
}, common_vendor.unref(checkAll) ? {
|
||||
|
|
|
@ -218,9 +218,9 @@ const _sfc_main = {
|
|||
showAction: false,
|
||||
modelValue: keyword.value
|
||||
}),
|
||||
e: common_assets._imports_0,
|
||||
e: common_assets._imports_0$1,
|
||||
f: common_vendor.o(($event) => navTo("/pages/cart/cart")),
|
||||
g: common_assets._imports_1,
|
||||
g: common_assets._imports_1$1,
|
||||
h: common_vendor.o(($event) => navTo("/pages/my/my")),
|
||||
i: common_vendor.f(goodClassList.value, (item, index, i0) => {
|
||||
return {
|
||||
|
|
|
@ -26,19 +26,30 @@ if (!Math) {
|
|||
const _sfc_main = {
|
||||
__name: "login",
|
||||
setup(__props) {
|
||||
store_user.useUserStore();
|
||||
const userStore = store_user.useUserStore();
|
||||
const showWeixin = common_vendor.ref(true);
|
||||
const isAgree = common_vendor.ref(false);
|
||||
const weixinLogin = () => {
|
||||
if (!isAgree.value)
|
||||
return common_vendor.index.$u.toast("请先阅读并同意协议");
|
||||
common_vendor.index.showLoading({
|
||||
title: "登录中"
|
||||
});
|
||||
common_vendor.index.login({
|
||||
provider: "weixin",
|
||||
success: (res) => {
|
||||
api_user.userLoginWeixinApi({
|
||||
code: res.code
|
||||
}).then((res2) => {
|
||||
console.log(res2);
|
||||
userStore.setUserInfo(res2.data);
|
||||
userStore.setToken(res2.data.token);
|
||||
common_vendor.index.hideLoading();
|
||||
if (!res2.data.supplier)
|
||||
common_vendor.index.reLaunch({
|
||||
url: "/pages/index/index"
|
||||
});
|
||||
else
|
||||
common_vendor.index.$u.toast("功能开发中");
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
|
@ -176,10 +187,10 @@ const _sfc_main = {
|
|||
w: !isAgree.value
|
||||
}, !isAgree.value ? {
|
||||
x: common_vendor.o(($event) => isAgree.value = true),
|
||||
y: common_assets._imports_1$1
|
||||
y: common_assets._imports_1
|
||||
} : {
|
||||
z: common_vendor.o(($event) => isAgree.value = false),
|
||||
A: common_assets._imports_0$1
|
||||
A: common_assets._imports_0
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const store_user = require("../../store/user.js");
|
||||
if (!Array) {
|
||||
const _easycom_up_navbar2 = common_vendor.resolveComponent("up-navbar");
|
||||
const _easycom_up_avatar2 = common_vendor.resolveComponent("up-avatar");
|
||||
|
@ -17,6 +18,8 @@ if (!Math) {
|
|||
const _sfc_main = {
|
||||
__name: "my",
|
||||
setup(__props) {
|
||||
const userStore = store_user.useUserStore();
|
||||
const userInfo = userStore.userInfo;
|
||||
const navTo = (type = 0) => {
|
||||
common_vendor.index.navigateTo({
|
||||
url: `/pagesOrder/order/order?type=${type}`
|
||||
|
@ -30,26 +33,28 @@ const _sfc_main = {
|
|||
autoBack: true
|
||||
}),
|
||||
b: common_vendor.p({
|
||||
src: "",
|
||||
src: common_vendor.unref(userInfo).avatar,
|
||||
size: "80"
|
||||
}),
|
||||
c: common_vendor.o(($event) => navTo(1)),
|
||||
d: common_vendor.o(($event) => navTo(2)),
|
||||
e: common_vendor.o(($event) => navTo()),
|
||||
f: common_vendor.p({
|
||||
c: common_vendor.t(common_vendor.unref(userInfo).nickname),
|
||||
d: common_vendor.t(common_vendor.unref(userInfo).id),
|
||||
e: common_vendor.o(($event) => navTo(1)),
|
||||
f: common_vendor.o(($event) => navTo(2)),
|
||||
g: common_vendor.o(($event) => navTo()),
|
||||
h: common_vendor.p({
|
||||
title: "我的地址",
|
||||
isLink: true,
|
||||
url: "/pagesOrder/addressList/addressList"
|
||||
}),
|
||||
g: common_vendor.p({
|
||||
i: common_vendor.p({
|
||||
title: "意见反馈",
|
||||
isLink: true
|
||||
}),
|
||||
h: common_vendor.p({
|
||||
j: common_vendor.p({
|
||||
title: "关于我们",
|
||||
isLink: true
|
||||
}),
|
||||
i: common_vendor.p({
|
||||
k: common_vendor.p({
|
||||
title: "退出登录",
|
||||
isLink: true,
|
||||
url: "/pages/login/login"
|
||||
|
|
|
@ -1 +1 @@
|
|||
<view><up-navbar wx:if="{{a}}" u-i="39cfeb26-0" bind:__l="__l" u-p="{{a}}"></up-navbar><view class="user-info"><image class="bg" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/e3a7b202404261113002322.webp" mode="widthFix"></image><view class="u-card"><up-avatar wx:if="{{b}}" u-i="39cfeb26-1" bind:__l="__l" u-p="{{b}}"></up-avatar><view class="content"><view class="u-phone">151****6699</view><view class="u-id">ID: 6655</view></view></view></view><view class="order-info-box"><view class="order-info"><view class="info-head">我的订单</view><view class="info-list"><view class="list-item" bindtap="{{c}}"><image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/f335a202404261401535608.png"></image><view class="">待付款</view></view><view class="list-item" bindtap="{{d}}"><image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/45241202404261403353935.png"></image><view class="">待收货</view></view><view class="list-item" bindtap="{{e}}"><image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/abdcd202404261406199643.png"></image><view class="">全部订单</view></view></view></view></view><view class="card"><up-cell-group u-s="{{['d']}}" u-i="39cfeb26-2" bind:__l="__l"><up-cell wx:if="{{f}}" u-i="39cfeb26-3,39cfeb26-2" bind:__l="__l" u-p="{{f}}"></up-cell></up-cell-group></view><view class="card"><up-cell-group u-s="{{['d']}}" u-i="39cfeb26-4" bind:__l="__l"><up-cell wx:if="{{g}}" u-i="39cfeb26-5,39cfeb26-4" bind:__l="__l" u-p="{{g}}"></up-cell><up-cell wx:if="{{h}}" u-i="39cfeb26-6,39cfeb26-4" bind:__l="__l" u-p="{{h}}"></up-cell><up-cell wx:if="{{i}}" u-i="39cfeb26-7,39cfeb26-4" bind:__l="__l" u-p="{{i}}"></up-cell></up-cell-group></view></view>
|
||||
<view><up-navbar wx:if="{{a}}" u-i="39cfeb26-0" bind:__l="__l" u-p="{{a}}"></up-navbar><view class="user-info"><image class="bg" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/e3a7b202404261113002322.webp" mode="widthFix"></image><view class="u-card"><up-avatar wx:if="{{b}}" u-i="39cfeb26-1" bind:__l="__l" u-p="{{b}}"></up-avatar><view class="content"><view class="u-phone">{{c}}</view><view class="u-id">ID: {{d}}</view></view></view></view><view class="order-info-box"><view class="order-info"><view class="info-head">我的订单</view><view class="info-list"><view class="list-item" bindtap="{{e}}"><image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/f335a202404261401535608.png"></image><view class="">待付款</view></view><view class="list-item" bindtap="{{f}}"><image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/45241202404261403353935.png"></image><view class="">待收货</view></view><view class="list-item" bindtap="{{g}}"><image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/abdcd202404261406199643.png"></image><view class="">全部订单</view></view></view></view></view><view class="card"><up-cell-group u-s="{{['d']}}" u-i="39cfeb26-2" bind:__l="__l"><up-cell wx:if="{{h}}" u-i="39cfeb26-3,39cfeb26-2" bind:__l="__l" u-p="{{h}}"></up-cell></up-cell-group></view><view class="card"><up-cell-group u-s="{{['d']}}" u-i="39cfeb26-4" bind:__l="__l"><up-cell wx:if="{{i}}" u-i="39cfeb26-5,39cfeb26-4" bind:__l="__l" u-p="{{i}}"></up-cell><up-cell wx:if="{{j}}" u-i="39cfeb26-6,39cfeb26-4" bind:__l="__l" u-p="{{j}}"></up-cell><up-cell wx:if="{{k}}" u-i="39cfeb26-7,39cfeb26-4" bind:__l="__l" u-p="{{k}}"></up-cell></up-cell-group></view></view>
|
|
@ -27,6 +27,8 @@ const _sfc_main = {
|
|||
const show = common_vendor.ref(false);
|
||||
const deleteInfo = common_vendor.ref({});
|
||||
const showDelete = (item) => {
|
||||
if (addressList.value.length <= 1)
|
||||
return common_vendor.index.$u.toast("最后一个地址无法删除!");
|
||||
deleteInfo.value = item;
|
||||
show.value = true;
|
||||
};
|
||||
|
@ -34,11 +36,15 @@ const _sfc_main = {
|
|||
api_user.addressEditApi({
|
||||
...item,
|
||||
is_default: !item.is_default
|
||||
}).then((res) => {
|
||||
getAddressLists();
|
||||
});
|
||||
};
|
||||
const deleteAddress = () => {
|
||||
api_user.addressDeleteApi({
|
||||
address_id: deleteInfo.value.address_id
|
||||
}).then((res) => {
|
||||
getAddressLists();
|
||||
});
|
||||
show.value = false;
|
||||
};
|
||||
|
@ -60,9 +66,9 @@ const _sfc_main = {
|
|||
c: common_vendor.t(item.detail),
|
||||
d: item.is_default
|
||||
}, item.is_default ? {
|
||||
e: common_assets._imports_0$1
|
||||
e: common_assets._imports_0
|
||||
} : {
|
||||
f: common_assets._imports_1$1
|
||||
f: common_assets._imports_1
|
||||
}, {
|
||||
g: common_vendor.o(($event) => updateDefault(item), index),
|
||||
h: "5e66515e-0-" + i0,
|
||||
|
|
|
@ -72,9 +72,9 @@ const _sfc_main = {
|
|||
a: common_vendor.t(item.name),
|
||||
b: cancelType.value == item.value
|
||||
}, cancelType.value == item.value ? {
|
||||
c: common_assets._imports_0$1
|
||||
c: common_assets._imports_0
|
||||
} : {
|
||||
d: common_assets._imports_1$1
|
||||
d: common_assets._imports_1
|
||||
}, {
|
||||
e: item.value,
|
||||
f: common_vendor.o(($event) => cancelType.value = item.value, item.value)
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
"use strict";
|
||||
const common_vendor = require("../../../common/vendor.js");
|
||||
if (!Array) {
|
||||
const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
|
||||
const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
|
||||
(_easycom_up_button2 + _easycom_up_icon2)();
|
||||
const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
|
||||
(_easycom_up_icon2 + _easycom_up_button2)();
|
||||
}
|
||||
const _easycom_up_button = () => "../../../uni_modules/uview-plus/components/u-button/u-button.js";
|
||||
const _easycom_up_icon = () => "../../../uni_modules/uview-plus/components/u-icon/u-icon.js";
|
||||
const _easycom_up_button = () => "../../../uni_modules/uview-plus/components/u-button/u-button.js";
|
||||
if (!Math) {
|
||||
(_easycom_up_button + _easycom_up_icon)();
|
||||
(_easycom_up_icon + _easycom_up_button)();
|
||||
}
|
||||
const _sfc_main = {
|
||||
__name: "good",
|
||||
|
@ -27,63 +27,75 @@ const _sfc_main = {
|
|||
const props = __props;
|
||||
const navTo = () => {
|
||||
common_vendor.index.navigateTo({
|
||||
url: `/pagesOrder/detail/detail?type=0&id=${props.datas.id}`
|
||||
url: `/pagesOrder/detail/detail?type=${props.datas.paid}&id=${props.datas.id}`
|
||||
});
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(__props.datas.number),
|
||||
b: common_vendor.o(navTo),
|
||||
c: common_vendor.f(__props.datas.goods_list, (item, index, i0) => {
|
||||
b: __props.datas.paid == 0
|
||||
}, __props.datas.paid == 0 ? {} : common_vendor.e({
|
||||
c: __props.datas.status == 0
|
||||
}, __props.datas.status == 0 ? {} : {}, {
|
||||
d: __props.datas.status == 1
|
||||
}, __props.datas.status == 1 ? {} : {}, {
|
||||
e: __props.datas.status == 2 || __props.datas.status == 3
|
||||
}, __props.datas.status == 2 || __props.datas.status == 3 ? {} : {}), {
|
||||
f: common_vendor.o(navTo),
|
||||
g: common_vendor.f(__props.datas.goods_list, (item, index, i0) => {
|
||||
return {
|
||||
a: item.imgs,
|
||||
b: index
|
||||
};
|
||||
}),
|
||||
d: common_vendor.t(__props.datas.total),
|
||||
e: common_vendor.o(navTo),
|
||||
f: __props.type == 1
|
||||
}, __props.type == 1 ? {
|
||||
g: common_vendor.p({
|
||||
size: "small",
|
||||
plain: true,
|
||||
color: "#989898",
|
||||
shape: "circle"
|
||||
}),
|
||||
h: common_vendor.p({
|
||||
size: "small",
|
||||
plain: true,
|
||||
color: "#20B128",
|
||||
shape: "circle"
|
||||
})
|
||||
} : {}, {
|
||||
i: __props.type == 2 || __props.type == 0
|
||||
}, __props.type == 2 || __props.type == 0 ? {
|
||||
j: common_vendor.p({
|
||||
name: "arrow-right-double",
|
||||
color: "#20B128"
|
||||
}),
|
||||
i: common_vendor.t(__props.datas.goods_count),
|
||||
j: common_vendor.t(__props.datas.total),
|
||||
k: common_vendor.o(navTo),
|
||||
l: __props.datas.paid = 0
|
||||
}, (__props.datas.paid = 0) ? {
|
||||
m: common_vendor.p({
|
||||
size: "small",
|
||||
plain: true,
|
||||
color: "#989898",
|
||||
shape: "circle"
|
||||
}),
|
||||
k: common_vendor.p({
|
||||
n: common_vendor.p({
|
||||
size: "small",
|
||||
plain: true,
|
||||
color: "#20B128",
|
||||
shape: "circle"
|
||||
}),
|
||||
l: common_vendor.p({
|
||||
})
|
||||
} : common_vendor.e({
|
||||
o: __props.datas.status == 1
|
||||
}, __props.datas.status == 1 ? {
|
||||
p: common_vendor.p({
|
||||
size: "small",
|
||||
plain: true,
|
||||
color: "#20B128",
|
||||
shape: "circle"
|
||||
})
|
||||
} : {}, {
|
||||
m: __props.type == 3
|
||||
}, __props.type == 3 ? {
|
||||
n: common_vendor.p({
|
||||
name: "arrow-right"
|
||||
q: __props.datas.status == 2 || __props.datas.status == 3
|
||||
}, __props.datas.status == 2 || __props.datas.status == 3 ? {
|
||||
r: common_vendor.p({
|
||||
size: "small",
|
||||
plain: true,
|
||||
color: "#20B128",
|
||||
shape: "circle"
|
||||
})
|
||||
} : {});
|
||||
} : {}, {
|
||||
s: common_vendor.p({
|
||||
size: "small",
|
||||
plain: true,
|
||||
color: "#20B128",
|
||||
shape: "circle"
|
||||
}),
|
||||
t: common_vendor.o(navTo)
|
||||
}));
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"up-button": "../../../uni_modules/uview-plus/components/u-button/u-button",
|
||||
"up-icon": "../../../uni_modules/uview-plus/components/u-icon/u-icon"
|
||||
"up-icon": "../../../uni_modules/uview-plus/components/u-icon/u-icon",
|
||||
"up-button": "../../../uni_modules/uview-plus/components/u-button/u-button"
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
<view class="shop-item"><view class="item-title" bindtap="{{b}}"><view>{{a}}</view><view>待付款</view></view><view class="item-body" bindtap="{{e}}"><view class="body-content"><view wx:for="{{c}}" wx:for-item="item" wx:key="b"><image class="image" src="{{item.a}}"></image></view></view><view class="all">共5件商品, 总金额 <text>¥{{d}}</text></view></view><view wx:if="{{f}}" class="item-btn"><view style="width:80px"><up-button wx:if="{{g}}" u-s="{{['d']}}" u-i="e1c5d592-0" bind:__l="__l" u-p="{{g}}">取消订单</up-button></view><view style="width:80px"><up-button wx:if="{{h}}" u-s="{{['d']}}" u-i="e1c5d592-1" bind:__l="__l" u-p="{{h}}">立即支付</up-button></view></view><view wx:if="{{i}}" class="item-btn"><view style="width:80px"><up-button wx:if="{{j}}" u-s="{{['d']}}" u-i="e1c5d592-2" bind:__l="__l" u-p="{{j}}">申请售后</up-button></view><view style="width:80px"><up-button wx:if="{{k}}" u-s="{{['d']}}" u-i="e1c5d592-3" bind:__l="__l" u-p="{{k}}">确认收货</up-button></view><view style="width:80px"><up-button wx:if="{{l}}" u-s="{{['d']}}" u-i="e1c5d592-4" bind:__l="__l" u-p="{{l}}">再次购买</up-button></view></view><view wx:if="{{m}}" class="item-close"><view class="title"><view class="type">退款申请中</view><view>等待商家处理</view></view><up-icon wx:if="{{n}}" u-i="e1c5d592-5" bind:__l="__l" u-p="{{n}}"></up-icon></view></view>
|
||||
<view class="shop-item"><view class="item-title" bindtap="{{f}}"><view>{{a}}</view><view wx:if="{{b}}"><text>待付款</text></view><view wx:else><text wx:if="{{c}}">待发货</text><text wx:if="{{d}}">待收货</text><text wx:if="{{e}}">已完成</text></view></view><view class="item-body" bindtap="{{k}}"><view class="body-content"><view style="display:flex;flex:1;flex-shrink:0"><view wx:for="{{g}}" wx:for-item="item" wx:key="b"><image class="image" src="{{item.a}}"></image></view></view><view style="display:flex;flex-direction:column;align-items:center;justify-content:center;width:100rpx"><up-icon wx:if="{{h}}" u-i="e1c5d592-0" bind:__l="__l" u-p="{{h}}"></up-icon></view></view><view class="all">共 {{i}} 件商品, 总金额 <text>¥{{j}}</text></view></view><view wx:if="{{l}}" class="item-btn"><view style="width:80px"><up-button wx:if="{{m}}" u-s="{{['d']}}" u-i="e1c5d592-1" bind:__l="__l" u-p="{{m}}">取消订单</up-button></view><view style="width:80px"><up-button wx:if="{{n}}" u-s="{{['d']}}" u-i="e1c5d592-2" bind:__l="__l" u-p="{{n}}">立即支付</up-button></view></view><view wx:else class="item-btn"><view wx:if="{{o}}" style="width:80px"><up-button wx:if="{{p}}" u-s="{{['d']}}" u-i="e1c5d592-3" bind:__l="__l" u-p="{{p}}">确认收货</up-button></view><view wx:if="{{q}}" style="width:80px"><up-button wx:if="{{r}}" u-s="{{['d']}}" u-i="e1c5d592-4" bind:__l="__l" u-p="{{r}}">再次购买</up-button></view><view bindtap="{{t}}" style="width:80px"><up-button wx:if="{{s}}" u-s="{{['d']}}" u-i="e1c5d592-5" bind:__l="__l" u-p="{{s}}">查看详情</up-button></view></view></view>
|
|
@ -40,12 +40,14 @@
|
|||
}
|
||||
.shop-item .item-body .body-content {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
color: #989898;
|
||||
}
|
||||
.shop-item .item-body .body-content .image {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
margin-right: 20rpx;
|
||||
border-radius: 14rpx;
|
||||
}
|
||||
.shop-item .item-body .body-content .title {
|
||||
display: flex;
|
||||
|
|
|
@ -30,6 +30,7 @@ const _sfc_main = {
|
|||
const tablist = common_vendor.ref([
|
||||
{ name: "全部" },
|
||||
{ name: "待付款" },
|
||||
{ name: "待发货" },
|
||||
{ name: "待收货" }
|
||||
// { name: '退款/售后' },
|
||||
]);
|
||||
|
@ -43,13 +44,16 @@ const _sfc_main = {
|
|||
page_size: 25
|
||||
});
|
||||
const orderList = common_vendor.ref([
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
[]
|
||||
]);
|
||||
const getOrderList = (type = 0) => {
|
||||
const getOrderList = (type = 0, status = "", paid = 1) => {
|
||||
api_order.orderListApi({
|
||||
...where.value
|
||||
...where.value,
|
||||
status,
|
||||
paid
|
||||
}).then((res) => {
|
||||
orderList.value[type] = res.data.lists;
|
||||
});
|
||||
|
@ -59,7 +63,10 @@ const _sfc_main = {
|
|||
tabsActive.value = +options.type;
|
||||
swiperCurrent.value = +options.type;
|
||||
}
|
||||
getOrderList();
|
||||
getOrderList(0);
|
||||
getOrderList(1, "", 0);
|
||||
getOrderList(2, 0);
|
||||
getOrderList(3, 1);
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
},
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "3.4.2",
|
||||
"appid": "wxce2948c50d808b66",
|
||||
"appid": "wxdee751952c8c2027",
|
||||
"projectname": "purchase-let",
|
||||
"condition": {
|
||||
"search": {
|
||||
|
|
|
@ -2,10 +2,15 @@
|
|||
const common_vendor = require("../common/vendor.js");
|
||||
const useUserStore = common_vendor.defineStore("user", () => {
|
||||
const userInfo = common_vendor.ref(common_vendor.index.getStorageSync("userInfo") || {});
|
||||
const setUserInfo = (data) => {
|
||||
userInfo.value = data;
|
||||
common_vendor.index.setStorageSync("userInfo", data);
|
||||
};
|
||||
userInfo.value = {
|
||||
"nickname": "哈哈",
|
||||
"id": 1,
|
||||
"mobile": "17685151643",
|
||||
"avatar": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/avatar.png",
|
||||
"avatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/tFJnfhVKlAlIecticsOhjAu8CHa6ibZacWrcHHkiahu7f0dQlWYgwu1b0TPLSLlO1xCTa6KN1krqg3XSIo3vq6uCQ/132",
|
||||
"token": "a8670fe7f1014c0f5125f6ca0c3b9cb3"
|
||||
};
|
||||
const token = common_vendor.ref(common_vendor.index.getStorageSync("token") || "");
|
||||
|
@ -14,6 +19,6 @@ const useUserStore = common_vendor.defineStore("user", () => {
|
|||
common_vendor.index.setStorageSync("token", data);
|
||||
};
|
||||
token.value = "a8670fe7f1014c0f5125f6ca0c3b9cb3";
|
||||
return { userInfo, setToken, token, setToken };
|
||||
return { userInfo, setUserInfo, token, setToken };
|
||||
});
|
||||
exports.useUserStore = useUserStore;
|
||||
|
|
|
@ -42,7 +42,7 @@ function baseRequest(url, method, data, {
|
|||
})
|
||||
}
|
||||
} else if (res.data.code == 0) {
|
||||
reslove(res.data);
|
||||
reject(res.data);
|
||||
} else if (res.data.code == 1) {
|
||||
reslove(res.data);
|
||||
} else if (res.data.code == 200) {
|
||||
|
|
Loading…
Reference in New Issue