Compare commits

..

No commits in common. "73cccb0c2462fbfcea0e6452b59a7f9d933e5499" and "b53fefd79f93c7f1782cfdc6224689db355c758c" have entirely different histories.

7 changed files with 550 additions and 889 deletions

View File

@ -1,33 +1,27 @@
<template> <template>
<!-- fixed -->
<up-popup :show="show" closeable round="10" @close="close"> <up-popup :show="show" closeable round="10" @close="close">
<view class="address-popup"> <view class="address-popup">
<view class="head-title">提货点</view> <view class="head-title">选择提货点</view>
<view class="list-admin"> <view class="list-admin">
<up-search placeholder="请输入提货点名称" @search="searchKeyword" v-model="keyword" <up-search placeholder="请输入提货点名称" @search="searchKeyword" v-model="keyword"
@custom="searchKeyword"></up-search> @custom="searchKeyword"></up-search>
</view> </view>
<scroll-view style="height: 600rpx;padding-bottom: 20rpx;" scroll-y> <scroll-view style="height: 600rpx;padding-bottom: 20rpx;" scroll-y>
<view class="list-li border" v-for="(item,index) in list" :key="index" @click="addressType=index"> <view class="row" v-for="(item,index) in list" :key="index" @click="addressType=index">
<view class="list-li-top"> <view class="content">
<view class=""> <view class="top">
<text>{{item.mer_name}}</text> <view class="name">{{item.mer_name}}</view>
<text v-if="index==0&&item.distance" <u-tag v-if="item.distance" style="pointer-events: none;" :text="item.distance"
style="background-color: #38BE41;color: white;font-size: 18rpx;margin-left: 24rpx;padding: 0 5rpx;">距离最近</text> type="success" plain size="mini"></u-tag>
<text v-if="item.distance" class="distance">步行{{item.distance}}</text>
</view> </view>
<view class="bottom u-line-2">{{item.service_phone}}</view>
</view> </view>
<view class=""> <image v-if="addressType==index" src="@/static/icon/check.png"></image>
{{item.mer_address||'sdsd'}} <image v-else src="@/static/icon/n-check.png"></image>
</view>
<view class="check">
<image style="width: 36rpx;height: 36rpx" v-if="addressType==index"
src="@/static/icon/check.png">
</image>
<image style="width: 36rpx;height: 36rpx" v-else src="@/static/icon/n-check.png"></image>
</view>
</view> </view>
</scroll-view> </scroll-view>
<up-button color="#20B128" shape="circle" @click="submitAddress">确认</up-button> <up-button color="#20B128" shape="circle" @click="submitAddress">确认提货点</up-button>
</view> </view>
</up-popup> </up-popup>
</template> </template>
@ -137,38 +131,6 @@
} }
} }
.border {
border-bottom: 1px solid #F3F3F3;
}
.list-li {
padding: 30rpx 0;
font-size: 24rpx;
position: relative;
.list-li-top {
display: flex;
justify-content: space-between;
margin-bottom: 10rpx;
font-size: 30rpx;
}
.distance {
border: 1px solid #40AE36;
font-size: 18rpx;
color: #40AE36;
margin-left: 20rpx;
padding: 0 5rpx;
}
.check {
position: absolute;
right: 20rpx;
top: 50%;
transform: translateY(-50%);
}
}
@keyframes disappear { @keyframes disappear {
to { to {
opacity: 0; opacity: 0;

View File

@ -0,0 +1,11 @@
<template>
<view class="">
商品详情
</view>
</template>
<script>
</script>
<style>
</style>

View File

@ -1,149 +0,0 @@
<template>
<view class="content">
<view class="card" v-for="item in 10">
<view class="head">
<text>PF171504442988969633</text>
<text style="color: #989898;">2023-04-25</text>
</view>
<view class="card-content">
<view class="card-content-l" style="width: 152rpx;height: 152rpx;">
<image style="width: 152rpx;height: 152rpx;" src="../../static/logo.png" mode=""></image>
<view class="status">
未报价
</view>
</view>
<view class="card-content-r">
<view class="title ellipsis">
正宗新疆哈密瓜网纹瓜
</view>
<view class="need">
需求量 100
</view>
<view class="ipt">
<up-input placeholderStyle='fontSize:24rpx' placeholder="点击数入报价数量" v-model="value1"
style="margin-right: 10rpx;background-color:#F6F6F6;border: none;"></up-input>
<up-input placeholderStyle='fontSize:24rpx' style="background-color: #F6F6F6;border: none;"
placeholder="点击数入产品报价" v-model="value2"></up-input>
</view>
</view>
<view class="status-png">
<image :src="errPng" style="width: 108rpx; height: 84rpx;"></image>
</view>
</view>
<view class="card-footer">
共100斤&nbsp; &nbsp;合计:<text style="font-size: 28rpx;color: #FC452F;font-weight: 700;">500.00</text>
</view>
<up-line style="margin-top: 30rpx;" color="#F3F3F3"></up-line>
</view>
<view class="submit-btn">
<up-button shape='circle' color='#20B128' text="提交"></up-button>
</view>
</view>
</template>
<script setup>
import {
ref,
reactive
} from "vue"
const value1 = ref('')
const value2 = ref('')
// url
const successPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/739c3202405071458553459.png')
const errPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/04c2c202405071501462462.png')
// url
</script>
<style lang="scss">
.content {
padding: 20rpx;
padding-bottom: 150rpx;
.card {
width: 710rpx;
margin: 0 auto;
padding: 20rpx;
box-sizing: border-box;
background-color: white;
.head {
font-size: 28rpx;
display: flex;
justify-content: space-between;
margin-bottom: 30rpx;
}
.card-content {
display: flex;
position: relative;
.card-content-l {
margin-right: 20rpx;
position: relative;
.status {
width: 152rpx;
height: 40rpx;
background-color: rgba(0, 0, 0, .3);
text-align: center;
color: white;
font-size: 24rpx;
line-height: 40rpx;
position: absolute;
bottom: 0;
}
}
.card-content-r {
display: flex;
flex-direction: column;
justify-content: space-between;
.title {
font-size: 30rpx;
width: 500rpx;
}
.need {
color: #777777;
font-size: 24rpx;
}
.ipt {
display: flex;
height: 56rpx;
}
}
.status-png {
position: absolute;
right: 20rpx;
}
}
.card-footer {
margin-top: 30rpx;
text-align: right;
font-size: 28rpx;
color: #060606;
}
}
.submit-btn {
position: fixed;
bottom: 50rpx;
width: 710rpx;
margin: 0 auto;
}
}
.ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>

View File

@ -1,148 +1,18 @@
<template> <template>
<view class="content"> <view class="">
<up-sticky bgColor="#fff"> <up-navbar placeholder style="z-index: 10080;">
<view class="head"> <template #left>
<up-search placeholder="请输入提货点名称" @search="searchKeyword" v-model="keyword" <view style="font-size: 30rpx;font-weight: bold;" @click="test">报价单</view>
@custom="searchKeyword"></up-search> </template>
<view class=""> </up-navbar>
<view class="" style="display: flex;justify-content: space-around;margin-top: 24rpx;color:#777777">
<view :class="{act: tabIndex==1}" @click="tabIndex=1">
订单列表
</view>
<view :class="{act: tabIndex==2}" @click="tabIndex=2">
报价记录
</view>
</view>
<view style="height: 8rpx;" />
<view class="line" :style="{left:tabIndex==1?tabsLeft+'px':tabsRight+'px'}" />
</view>
</view>
</up-sticky>
<view class="card" v-for="item in 10">
<view class="card-head">
<text>PF171504442988969633</text>
<text style="color:#20B128 ;">待报价</text>
<text style="color:#FC452F ;">已成交</text>
<text style="color:#777777 ;">未成交</text>
</view>
<view style="padding-right: 20rpx;">
<view class="card-content">
<image v-for="(item,index) in 10" style="width: 152rpx;height: 152rpx;margin-right: 20rpx;"
src="../../static/logo.png" mode="">
</image>
</view>
</view>
<view class="total"> dgfsdhjg
<view style="display: flex;align-items: center;color: #777777;"
@click="navgo('/pageQuota/quotation/detail')">
共4件 <up-icon name="arrow-right"></up-icon>
</view>
</view>
<view class="card-foot" v-if='false'>
温馨提示请于2024年05月20日前发货
</view>
</view>
</view> </view>
</template> </template>
<script setup> <script>
import {
ref,
reactive
} from "vue"
const navgo = (url) => {
uni.navigateTo({
url
})
}
//
const keyword = ref('')
const searchKeyword = () => {
console.log("sousuo1")
}
//
// tabsindex
const tabIndex = ref(1)
const {
windowWidth
} = uni.getSystemInfoSync();
const tabsLeft = ref(((windowWidth / 2) - 26) / 2)
const tabsRight = ref(tabsLeft.value + (windowWidth / 2))
// tabsindex
</script> </script>
<style lang="scss"> <style>
.content {
.head {
padding: 20rpx;
background-color: white;
position: relative;
.act {
color: #20B128;
}
.line {
width: 26px;
height: 5rpx;
background-color: #20B128;
border-radius: 50rpx;
position: absolute;
transition: 300ms;
}
}
.card {
width: 710rpx;
margin: 20rpx auto;
background-color: white;
box-sizing: border-box;
border-radius: 16rpx 16rpx 0 0;
position: relative;
.card-head {
padding: 20rpx;
display: flex;
justify-content: space-between;
margin-bottom: 12rpx;
}
.card-content {
padding: 20rpx;
overflow-x: auto;
white-space: nowrap;
padding-right: 152rpx;
}
.total {
width: 152rpx;
height: 160rpx;
position: absolute;
// border: 1px dashed black;
display: flex;
justify-content: space-around;
align-items: center;
top: 100rpx;
right: 20rpx;
background-color: white;
}
.card-foot {
background-color: #FFF1EC;
color: #FC452F;
text-indent: 2em;
font-size: 24rpx;
height: 74rpx;
line-height: 74rpx;
}
}
}
</style> </style>

View File

@ -44,103 +44,95 @@
], ],
"subPackages": [{ "subPackages": [{
"root": "pagesOrder", "root": "pagesOrder",
"pages": [{ "pages": [{
"path": "order/order", "path": "order/order",
"style": { "style": {
"navigationBarTitleText": "我的订单", "navigationBarTitleText": "我的订单",
"enablePullDownRefresh": false "enablePullDownRefresh": false
}
},
{
"path": "detail/detail",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "addressList/addressList",
"style": {
"navigationBarTitleText": "地址管理",
"enablePullDownRefresh": false
}
},
{
"path": "addressEdit/addressEdit",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "settle/settle",
"style": {
"navigationBarTitleText": "确认订单",
"enablePullDownRefresh": false
}
} }
] },
}, {
{ "path": "detail/detail",
"root": "pageQuota", "style": {
"pages": [{ "navigationBarTitleText": "",
"path": "quotation/index", "enablePullDownRefresh": false
"style": {
"navigationBarTitleText": "报价单",
"enablePullDownRefresh": false
}
},
{
"path": "quotation/detail",
"style": {
"navigationBarTitleText": "报价明细",
"enablePullDownRefresh": false
}
} }
},
{
"path": "addressList/addressList",
"style": {
"navigationBarTitleText": "地址管理",
"enablePullDownRefresh": false
}
},
{
"path": "addressEdit/addressEdit",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "settle/settle",
"style": {
"navigationBarTitleText": "确认订单",
"enablePullDownRefresh": false
}
}
]
}, {
"root": "pageQuota",
"pages": [{
"path": "quotation/index",
"style": {
"navigationBarTitleText": "报价单",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "goodDetail/index",
"style": {
"navigationBarTitleText": "商品详情",
"enablePullDownRefresh": false
}
}
]
}],
] "globalStyle": {
} "navigationBarTextStyle": "black",
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#fff",
"backgroundColor": "#fff"
},
// "tabBar": {
// "color": "#999999",
// "selectedColor": "#20b128",
// "borderStyle": "white",
// "backgroundColor": "#FFFFFF",
// "list": [{
// "pagePath": "pages/index/index",
// "text": "首页",
// "iconPath": "static/tab/a.png",
// "selectedIconPath": "static/tab/aa.png"
// },
// {
// "pagePath": "pages/cart/cart",
// "text": "购物车",
// "iconPath": "static/tab/b.png",
// "selectedIconPath": "static/tab/ba.png"
// },
// {
// "pagePath": "pages/my/my",
// "text": "我的",
// "iconPath": "static/tab/c.png",
// "selectedIconPath": "static/tab/ca.png"
// }
] // ]
}, // },
"uniIdRouter": {}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#fff",
"backgroundColor": "#fff"
},
// "tabBar": {
// "color": "#999999",
// "selectedColor": "#20b128",
// "borderStyle": "white",
// "backgroundColor": "#FFFFFF",
// "list": [{
// "pagePath": "pages/index/index",
// "text": "首页",
// "iconPath": "static/tab/a.png",
// "selectedIconPath": "static/tab/aa.png"
// },
// {
// "pagePath": "pages/cart/cart",
// "text": "购物车",
// "iconPath": "static/tab/b.png",
// "selectedIconPath": "static/tab/ba.png"
// },
// {
// "pagePath": "pages/my/my",
// "text": "我的",
// "iconPath": "static/tab/c.png",
// "selectedIconPath": "static/tab/ca.png"
// }
// ]
// },
"uniIdRouter": {}
} }

View File

@ -1,96 +1,95 @@
<template> <template>
<view class=""> <view class="">
<!-- <view class="m-card row"> <!-- <view class="m-card row">
<up-cell-group> <up-cell-group>
<up-cell title="请添加自提点" :isLink="true" :border="false" @click="shopListShow=true"></up-cell> <up-cell title="请添加自提点" :isLink="true" :border="false" @click="shopListShow=true"></up-cell>
</up-cell-group> </up-cell-group>
</view> --> </view> -->
<view class="m-card m-address"> <view class="m-card m-address">
<view class="address-info"> <view class="address-info">
<view class="top" style="align-items: flex-start;"> <view class="top" style="align-items: flex-start;">
<view style="color: #333;display: flex;align-items: center;"> <view style="color: #333;display: flex;align-items: center;">
<up-icon name="map"></up-icon> <up-icon name="map"></up-icon>
<text style="margin: 0 10rpx;">自提点</text> <text style="margin: 0 10rpx;">自提点</text>
</view> </view>
<view v-if="shopInfo.mer_id"> <view v-if="shopInfo.mer_id">
<view>{{shopInfo.mer_name}}</view> <view>{{shopInfo.mer_name}}</view>
<view> <view>
<text>{{shopInfo.service_phone}}</text> <text>{{shopInfo.service_phone}}</text>
<text <text style="color: #20b128;margin-left: 10rpx;font-size: 22rpx;">{{shopInfo.distance}}</text>
style="color: #20b128;margin-left: 10rpx;font-size: 22rpx;">{{shopInfo.distance}}</text> </view>
</view> </view>
</view> </view>
</view> </view>
</view> <view class="address-btn">
<view class="address-btn"> <view style="width: 80px;"><up-button @click="shopListShow=true" size="small" shape="circle" color="#f6f6f6"
<view style="width: 80px;"><up-button @click="shopListShow=true" size="small" shape="circle" :customStyle="{color:'#666666'}">修改</up-button></view>
color="#f6f6f6" :customStyle="{color:'#666666'}">修改</up-button></view> </view>
</view> </view>
</view> <view v-if="!addressInfo.address_id" class="m-card row">
<view v-if="!addressInfo.address_id" class="m-card row"> <up-cell-group>
<up-cell-group> <up-cell title="我的地址" :isLink="true" :border="false" @click="openAddress()"></up-cell>
<up-cell title="我的地址" :isLink="true" :border="false" @click="openAddress()"></up-cell> </up-cell-group>
</up-cell-group> </view>
</view> <view v-else class="m-card m-address">
<view v-else class="m-card m-address"> <view class="address-info">
<view class="address-info"> <view class="top">
<view class="top"> <up-icon name="account"></up-icon>
<up-icon name="account"></up-icon> <view class="t-name">{{addressInfo.real_name}}</view>
<view class="t-name">{{addressInfo.real_name}}</view> <view>{{addressInfo.phone}}</view>
<view>{{addressInfo.phone}}</view> </view>
</view> <view class="bottom u-line-2">
<view class="bottom u-line-2"> {{addressInfo.detail}}
{{addressInfo.detail}} </view>
</view> </view>
</view> <view class="address-btn">
<view class="address-btn"> <view style="width: 80px;"><up-button @click="showAddress = true" size="small" shape="circle" color="#f6f6f6"
<view style="width: 80px;"><up-button @click="showAddress = true" size="small" shape="circle" :customStyle="{color:'#666666'}">修改</up-button></view>
color="#f6f6f6" :customStyle="{color:'#666666'}">修改</up-button></view> </view>
</view> </view>
</view> <view class="m-card m-good" v-for="(item,index) in cartList" :key="index">
<view class="m-card m-good" v-for="(item,index) in cartList" :key="index"> <view class="image" >
<view class="image"> <up-image width="160rpx" height="160rpx" :src="item.imgs"></up-image>
<up-image width="160rpx" height="160rpx" :src="item.imgs"></up-image> </view>
</view> <view class="body-content">
<view class="body-content"> <view>
<view> <view class="title">
<view class="title"> <view>{{item.name}}</view>
<view>{{item.name}}</view> <view>¥{{item.price}}</view>
<view>¥{{item.price}}</view> </view>
</view> <view class="tips">
<view class="tips"> <view>{{item.unit_name}}</view>
<view>{{item.unit_name}}</view> <view>x{{item.cart_num}}</view>
<view>x{{item.cart_num}}</view> </view>
</view> </view>
</view> <view class="time">
<view class="time"> {{orderInfo.delivery_msg}}
{{orderInfo.delivery_msg}} </view>
</view> </view>
</view> </view>
</view> <view class="m-card good-info">
<view class="m-card good-info"> <view class="head-title">价格明细</view>
<view class="head-title">价格明细</view> <view class="row">
<view class="row"> <view>商品总价 <text>共计{{cartList.length}}款商品</text></view>
<view>商品总价 <text>共计{{cartList.length}}款商品</text></view> <view><text>¥</text>{{c_price(orderInfo.total, 0)}}<text>.{{c_price(orderInfo.total, 1)}}</text></view>
<view><text>¥</text>{{c_price(orderInfo.total, 0)}}<text>.{{c_price(orderInfo.total, 1)}}</text></view> </view>
</view> <view class="row">
<view class="row"> <view>运费</view>
<view>运费</view> <view><text>¥</text>0<text>.00</text></view>
<view><text>¥</text>0<text>.00</text></view> </view>
</view> </view>
</view> <view class="m-card good-info">
<view class="m-card good-info"> <view class="head-title">支付方式</view>
<view class="head-title">支付方式</view> <view class="row">
<view class="row"> <view class="icon-text"><up-icon name="weixin-circle-fill" color="#20b128" size="22"
<view class="icon-text"><up-icon name="weixin-circle-fill" color="#20b128" size="22" style="margin-right: 10rpx;"></up-icon> </view>
style="margin-right: 10rpx;"></up-icon> </view> <view class="icon">
<view class="icon"> <image v-if="true" src="@/static/icon/check.png"></image>
<image v-if="true" src="@/static/icon/check.png"></image> <image v-else src="@/static/icon/n-check.png"></image>
<image v-else src="@/static/icon/n-check.png"></image> </view>
</view> </view>
</view> </view>
</view> <!-- <view class="m-card order-remark">
<!-- <view class="m-card order-remark">
<view class="head-title"> <view class="head-title">
<text>订单备注</text> <text>订单备注</text>
<text>0/200</text> <text>0/200</text>
@ -98,370 +97,355 @@
<up-textarea style="background-color: #F6F6F6;" v-model="formData.remark" placeholder="暂无备注内容" <up-textarea style="background-color: #F6F6F6;" v-model="formData.remark" placeholder="暂无备注内容"
:height="100"></up-textarea> :height="100"></up-textarea>
</view> --> </view> -->
<view style="width: 100%;height: 200rpx;"></view> <view style="width: 100%;height: 200rpx;"></view>
<view class="fiexd-btn-box"> <view class="fiexd-btn-box">
<view class="tips"> <view class="tips">
<view style="margin-right: 20rpx;"> {{ cartList.length }} </view> <view style="margin-right: 20rpx;"> {{ cartList.length }} </view>
<view class="all"> <view class="all">
<text style="color: #000;">合计: </text> <text style="color: #000;">合计: </text>
<text></text> <text></text>
<block v-if="orderInfo.total"> <block v-if="orderInfo.total">
<text style="font-size: 32rpx;font-weight: bold;">{{c_price(orderInfo.total, 0)}}</text> <text style="font-size: 32rpx;font-weight: bold;">{{c_price(orderInfo.total, 0)}}</text>
<text>.{{c_price(orderInfo.total, 1)}}</text> <text>.{{c_price(orderInfo.total, 1)}}</text>
</block> </block>
</view> </view>
</view> </view>
<view style="width: 200rpx;"> <view style="width: 200rpx;">
<up-button color="#20B128" shape="circle" @click="submitOrder" :throttleTime="1000">提交订单</up-button> <up-button color="#20B128" shape="circle" @click="submitOrder" :throttleTime="1000">提交订单</up-button>
</view> </view>
</view> </view>
<addressPopup v-if="addressList.length>0" :show="showAddress" :list="addressList" @close="showAddress=false" <addressPopup v-if="addressList.length>0" :show="showAddress" :list="addressList" @close="showAddress=false" @change="changeAddress" />
@change="changeAddress" /> <shopListPopupVue v-if="merchantList.length>0" :show="shopListShow" :list="merchantList" @close="shopListShow=false" @change="changeShop" @search="searchShop" />
<shopListPopupVue v-if="merchantList.length>0" :show="shopListShow" :list="merchantList" <modal title="尚未设置收货地址" content="您还没有添加收货地址,请点击添加" cancleText="添加地址" confirmText="继续支付" :show="toastAddressShow"
@close="shopListShow=false" @change="changeShop" @search="searchShop" /> @close="addAddress" @change="goPay" />
<modal title="尚未设置收货地址" content="您还没有添加收货地址,请点击添加" cancleText="添加地址" confirmText="继续支付" :show="toastAddressShow" </view>
@close="addAddress" @change="goPay" />
</view>
</template> </template>
<script setup> <script setup>
import { import { onLoad, onShow } from "@dcloudio/uni-app"
onLoad, import { nextTick, ref } from "vue"
onShow import addressPopup from "@/components/addressPopup.vue";
} from "@dcloudio/uni-app" import shopListPopupVue from "@/components/shopListPopup.vue";
import { import modal from "@/components/modal.vue"
nextTick, import useCartStore from "@/store/cart.js";
ref import { checkOrderApi } from "@/api/cart.js";
} from "vue" import { addressListsApi, merchantListApi } from "@/api/user.js";
import addressPopup from "@/components/addressPopup.vue"; import { createOrderApi } from "@/api/order.js";
import shopListPopupVue from "@/components/shopListPopup.vue";
import modal from "@/components/modal.vue"
import useCartStore from "@/store/cart.js";
import {
checkOrderApi
} from "@/api/cart.js";
import {
addressListsApi,
merchantListApi
} from "@/api/user.js";
import {
createOrderApi
} from "@/api/order.js";
const cartStore = useCartStore(); const cartStore = useCartStore();
const formData = ref({ const formData = ref({
remark: "" remark: ""
}) })
const isAddress = ref(false); const isAddress = ref(false);
const toastAddressShow = ref(false); const toastAddressShow = ref(false);
// //
const addressList = ref([]); const addressList = ref([]);
const getAddressList = () => { const getAddressList = ()=>{
addressListsApi().then(res => { addressListsApi().then(res=>{
addressList.value = res.data.lists; addressList.value = res.data.lists;
addressList.value.forEach(item => { addressList.value.forEach(item=>{
if (item.is_default) { if(item.is_default) {
addressInfo.value = item; addressInfo.value = item;
isAddress.value = true; isAddress.value = true;
} }
}) })
if (!isAddress.value && addressList.value.length > 0) { if(!isAddress.value && addressList.value.length>0){
addressInfo.value = addressList.value[0]; addressInfo.value = addressList.value[0];
isAddress.value = true; isAddress.value = true;
} }
}) })
} }
// //
const showAddress = ref(false); const showAddress = ref(false);
const addressInfo = ref({}); const addressInfo = ref({});
const changeAddress = (e) => { const changeAddress = (e) => {
addressInfo.value = e; addressInfo.value = e;
showAddress.value = false; showAddress.value = false;
isAddress.value = true; isAddress.value = true;
} }
const openAddress = () => { const openAddress = ()=>{
if (addressList.length > 0) showAddress.value = true; if(addressList.length>0) showAddress.value=true;
else uni.navigateTo({ else uni.navigateTo({
url: '/pagesOrder/addressEdit/addressEdit' url: '/pagesOrder/addressEdit/addressEdit'
}) })
} }
// //
const shopListShow = ref(false); const shopListShow = ref(false);
const merchantList = ref([]); const merchantList = ref([]);
const myAddressInfo = ref({ const myAddressInfo = ref({
long: "", long: "",
lat: "" lat: ""
}) })
const shopInfo = ref({ const shopInfo = ref({
mer_id: '' mer_id: ''
}); });
const getMerchantList = (mer_name = null) => { const getMerchantList = (mer_name=null)=>{
merchantListApi({ merchantListApi({
...myAddressInfo.value, ...myAddressInfo.value,
mer_name: mer_name ? mer_name : '' mer_name: mer_name ? mer_name : ''
}).then(res => { }).then(res=>{
merchantList.value = res.data.lists; merchantList.value = res.data.lists;
if (mer_name === null && myAddressInfo.value.long && merchantList.value.length > 0 && !shopInfo if(mer_name===null && myAddressInfo.value.long && merchantList.value.length>0 && !shopInfo.value.mer_id) {
.value.mer_id) { shopInfo.value = merchantList.value[0];
shopInfo.value = merchantList.value[0]; }
} })
}) }
} getMerchantList('');
getMerchantList(''); //
// const LoadAddress = ()=>{
const LoadAddress = () => { uni.getLocation({
uni.getLocation({ success: (res) => {
success: (res) => {}, },
fail: (err) => { fail: (err) => {
uni.$u.toast('定位失败, 请手动选择提货点!') uni.$u.toast('定位失败, 请手动选择提货点!')
}, },
complete: (res) => { complete: (res) => {
myAddressInfo.value.long = res.longitude || ""; myAddressInfo.value.long = res.longitude || "";
myAddressInfo.value.lat = res.latitude || ""; myAddressInfo.value.lat = res.latitude || "";
getMerchantList(); getMerchantList();
} }
}) })
} }
LoadAddress(); LoadAddress();
const changeShop = (e) => { const changeShop = (e)=>{
shopInfo.value = e; shopInfo.value = e;
shopListShow.value = false; shopListShow.value = false;
} }
const searchShop = (e) => { const searchShop = (e)=>{
getMerchantList(e) getMerchantList(e)
} }
// //
const addAddress = () => { const addAddress = () => {
toastAddressShow.value = false; toastAddressShow.value = false;
nextTick(() => { nextTick(()=>{
showAddress.value = true; showAddress.value = true;
}) })
} }
// //
const goPay = () => { const goPay = ()=>{
toastAddressShow.value = false; toastAddressShow.value = false;
isAddress.value = true; isAddress.value = true;
submitOrder(); submitOrder();
} }
// //
const submitOrder = () => { const submitOrder = () => {
if (!isAddress.value) return toastAddressShow.value = true; if (!isAddress.value) return toastAddressShow.value = true;
createOrder(); createOrder();
} }
// //
const cartList = ref([]); const cartList = ref([]);
const orderInfo = ref({}); const orderInfo = ref({});
const checkOrder = () => { const checkOrder = ()=>{
checkOrderApi({ checkOrderApi({
cart_id: cartStore.cartList cart_id: cartStore.cartList
}).then(res => { }).then(res=>{
cartList.value = res.data.cart_list; cartList.value = res.data.cart_list;
orderInfo.value = res.data.order; orderInfo.value = res.data.order;
}) })
} }
const createOrder = () => { const createOrder = ()=>{
createOrderApi({ createOrderApi({
cart_id: cartStore.cartList, cart_id: cartStore.cartList,
address_id: addressInfo.value.address_id, address_id: addressInfo.value.address_id,
mer_id: shopInfo.value.mer_id, mer_id: shopInfo.value.mer_id,
pay_type: 1 pay_type: 1
}).then(res => { }).then(res=>{
if (!res.data?.nonceStr) return uni.$u.toast('支付失败!'); if(!res.data?.nonceStr) return uni.$u.toast('支付失败!');
uni.requestPayment({ uni.requestPayment({
provider: 'wxpay', provider: 'wxpay',
timeStamp: res.data.timeStamp, timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr, nonceStr: res.data.nonceStr,
package: res.data.package, package: res.data.package,
signType: res.data.signType, signType: res.data.signType,
paySign: res.data.paySign, paySign: res.data.paySign,
success: (e) => { success: (e) => {
if (e.errMsg == 'requestPayment:ok') { if(e.errMsg == 'requestPayment:ok'){
uni.showModal({ uni.showModal({
title: '订单支付成功', title: '订单支付成功',
confirmText: '查看订单', confirmText: '查看订单',
cancelText: '继续购买', cancelText: '继续购买',
success: (e) => { success: (e) => {
if (e.confirm) uni.navigateTo({ if(e.confirm) uni.navigateTo({
url: '/pagesOrder/order/order' url: '/pagesOrder/order/order'
}) })
else uni.navigateBack(); else uni.navigateBack();
} }
}) })
} else uni.$u.toast('支付失败') }else uni.$u.toast('支付失败')
}, },
fail: (e) => { fail: (e) => {
uni.$u.toast('用户取消支付') uni.$u.toast('用户取消支付')
} }
}) })
}).catch(err => { }).catch(err=>{
uni.$u.toast('网络错误') uni.$u.toast('网络错误')
}) })
} }
const c_price = (price, index = 0) => { const c_price = (price, index=0)=>{
price = price + ''; price = price + '';
return price.split('.')[index] || (index ? '00' : '0'); return price.split('.')[index] || (index ? '00' : '0');
} }
onLoad(options => { onLoad(options=>{
checkOrder(); checkOrder();
}) })
onShow(() => { onShow(()=>{
getAddressList(); getAddressList();
}) })
</script> </script>
<style lang="scss"> <style lang="scss">
.m-card { .m-card {
margin: 20rpx; margin: 20rpx;
border-radius: 14rpx; border-radius: 14rpx;
background-color: #fff; background-color: #fff;
padding: 20rpx; padding: 20rpx;
} }
.row { .row {
padding: 0; padding: 0;
overflow: hidden; overflow: hidden;
} }
.m-address { .m-address {
margin-bottom: 20rpx; margin-bottom: 20rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
color: #999999; color: #999999;
.address-info { .address-info {
width: 510rpx; width: 510rpx;
.top { .top {
display: flex; display: flex;
font-size: 28rpx; font-size: 28rpx;
.t-name { .t-name {
color: #444; color: #444;
margin: 0 10rpx; margin: 0 10rpx;
} }
} }
.bottom { .bottom {
font-size: 24rpx; font-size: 24rpx;
} }
} }
} }
.m-good { .m-good {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-bottom: 20rpx; margin-bottom: 20rpx;
.image { .image {
width: 160rpx; width: 160rpx;
height: 160rpx; height: 160rpx;
margin-right: 20rpx; margin-right: 20rpx;
border-radius: 14rpx; border-radius: 14rpx;
overflow: hidden; overflow: hidden;
} }
.body-content { .body-content {
width: 490rpx; width: 490rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
color: #989898; color: #989898;
.title { .title {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
font-size: 28rpx; font-size: 28rpx;
color: #444; color: #444;
} }
.tips { .tips {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
font-size: 24rpx; font-size: 24rpx;
margin-top: 10rpx; margin-top: 10rpx;
} }
.time { .time {
background-color: #F6F6F6; background-color: #F6F6F6;
padding: 5rpx 10rpx; padding: 5rpx 10rpx;
font-size: 26rpx; font-size: 26rpx;
color: #444; color: #444;
border-radius: 10rpx; border-radius: 10rpx;
} }
} }
} }
.good-info { .good-info {
margin-bottom: 20rpx; margin-bottom: 20rpx;
.head-title { .head-title {
margin-bottom: 18rpx; margin-bottom: 18rpx;
color: #000; color: #000;
font-weight: bold; font-weight: bold;
} }
.row { .row {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
margin-bottom: 18rpx; margin-bottom: 18rpx;
.red { .red {
color: #F55726; color: #F55726;
} }
.icon-text { .icon-text {
display: flex; display: flex;
} }
.icon { .icon {
image { image {
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
} }
} }
} }
.row-need { .row-need {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
color: #F55726; color: #F55726;
} }
text { text {
font-size: 22rpx; font-size: 22rpx;
} }
} }
.order-remark { .order-remark {
.head-title { .head-title {
margin-bottom: 18rpx; margin-bottom: 18rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
} }
.tips { .tips {
font-size: 28rpx; font-size: 28rpx;
color: #999; color: #999;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;
flex: 1; flex: 1;
margin-right: 20rpx; margin-right: 20rpx;
.all { .all {
color: #F55726; color: #F55726;
} }
} }
</style> </style>

View File

@ -1,48 +1,39 @@
// 导入定义仓库的方法 // 导入定义仓库的方法
import { import { defineStore } from 'pinia';
defineStore
} from 'pinia';
// 导入响应式和计算 // 导入响应式和计算
import { import { ref } from 'vue';
ref
} from 'vue';
const useUserStore = defineStore("user", () => { const useUserStore = defineStore("user", () => {
// 定义一个状态用户信息 // 定义一个状态用户信息
const userInfo = ref(uni.getStorageSync('userInfo') || {}); const userInfo = ref(uni.getStorageSync('userInfo') || {});
// 定义一个设置状态的方法 // 定义一个设置状态的方法
const setUserInfo = (data) => { const setUserInfo = (data) => {
userInfo.value = data; userInfo.value = data;
uni.setStorageSync('userInfo', data) uni.setStorageSync('userInfo', data)
} }
const token = ref(uni.getStorageSync('token') || ''); const token = ref(uni.getStorageSync('token') || '');
const setToken = (data) => { const setToken = (data) => {
token.value = data; token.value = data;
uni.setStorageSync('token', data) uni.setStorageSync('token', data)
} }
// #ifdef H5 // #ifdef H5
token.value = "31f74a72e2d05673ec14d2a6408718ef" token.value = "f9421a985006bf3f73bbaff6193da353"
userInfo.value = { userInfo.value = {
avatar: "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/default_avatar.png", avatar: "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/default_avatar.png",
id: 9, id: 9,
is_disable: 0, is_disable: 0,
is_new_user: 1, is_new_user: 1,
mobile: "19330904744", mobile: "19330904744",
nickname: "用户1714964250", nickname: "用户1714964250",
supplier: null, supplier: null,
token: "31f74a72e2d05673ec14d2a6408718ef" token: "f9421a985006bf3f73bbaff6193da353"
} }
// #endif // #endif
return { return { userInfo, setUserInfo, token, setToken }
userInfo,
setUserInfo,
token,
setToken
}
}) })
export default useUserStore; export default useUserStore;