This commit is contained in:
weipengfei 2024-05-06 10:11:25 +08:00
parent ecc4df957b
commit b80a7eb45e
8 changed files with 117 additions and 56 deletions

View File

@ -1,12 +1,14 @@
let BASE_URL let BASE_URL
import store from "@/store/user.js" import store from "@/store/user.js"
// 环境 // 环境
// let env = "dev" let env = "dev"
let env = "prod" // let env = "test"
// let env = "prod"
switch(env){ switch(env){
case 'prod': BASE_URL = 'https://ceshi-erp.lihaink.cn';break; case 'prod': BASE_URL = 'https://erp.lihaink.cn';break;
default: BASE_URL = 'http://192.168.1.22:8787'; case 'test': BASE_URL = 'https://ceshi-erp.lihaink.cn';break;
default: BASE_URL = 'http://192.168.1.22:8546';
} }
let HTTP_REQUEST_URL let HTTP_REQUEST_URL

View File

@ -14,8 +14,10 @@
<block v-if="showWeixin"> <block v-if="showWeixin">
<up-transition :show="showWeixin"> <up-transition :show="showWeixin">
<view class="btn"> <view class="btn">
<up-button open-type="getPhoneNumber" @click="weixinLogin" color="#20B128" size="large"><up-icon <up-button @click="weixinLogin" color="#20B128" size="large"><up-icon
name="weixin-fill" color="#fff" size="28"></up-icon></up-button> name="weixin-fill" color="#fff" size="28"></up-icon></up-button>
<!-- <up-button ref="phoneRef" open-type="getPhoneNumber" @click="getPhoneNumber" color="#20B128" size="large"><up-icon
name="weixin-fill" color="#fff" size="28"></up-icon></up-button> -->
</view> </view>
<view class="btn"> <view class="btn">
<up-button color="#ECFFEE" @click="showWeixin=false" size="large"><text style="color: #20B128;">使用短信验证登录</text></up-button> <up-button color="#ECFFEE" @click="showWeixin=false" size="large"><text style="color: #20B128;">使用短信验证登录</text></up-button>
@ -79,14 +81,19 @@
uni.showLoading({ uni.showLoading({
title: '登录中' title: '登录中'
}) })
// return console.log(phoneRef.value) ;
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
success: (res) => { success: (res) => {
return console.log(res);
userLoginWeixinApi({ userLoginWeixinApi({
code: res.code code: res.code
}).then(res=>{ }).then(res=>{
userStore.setUserInfo(res.data); userStore.setUserInfo(res.data);
userStore.setToken(res.data.token); userStore.setToken(res.data.token);
if(!res.data.mobile) {
return console.log("=====");
}
uni.hideLoading(); uni.hideLoading();
if(!res.data.supplier) uni.reLaunch({ if(!res.data.supplier) uni.reLaunch({
url: '/pages/index/index' url: '/pages/index/index'
@ -101,6 +108,7 @@
}) })
} }
const phoneRef = ref(null)
const getPhoneNumber = (e) => { const getPhoneNumber = (e) => {
console.log(e); console.log(e);
} }

View File

@ -19,17 +19,19 @@
:customStyle="{color:'#666666'}">修改</up-button></view> :customStyle="{color:'#666666'}">修改</up-button></view>
</view> </view>
</view> </view>
<view class="m-card m-good"> <view class="m-card m-good" v-for="(item,index) in datas.goods_list">
<image class="image" src="../../static/logo.png"></image> <view class="image">
<up-image :src="item.imgs" width="160rpx" height="160rpx"></up-image>
</view>
<view class="body-content"> <view class="body-content">
<view> <view>
<view class="title"> <view class="title">
<view>黄牛肉20kg</view> <view>{{item.class_name}}</view>
<view>¥10.00</view> <view>¥{{item.sell}}</view>
</view> </view>
<view class="tips"> <view class="tips">
<view>我不吃牛肉</view> <view>数量</view>
<view>x5</view> <view>x{{item.nums}}</view>
</view> </view>
</view> </view>
<view class="time"> <view class="time">
@ -38,9 +40,9 @@
</view> </view>
</view> </view>
<view class="m-card good-info"> <view class="m-card good-info">
<view class="row"> <view v-if="datas.goods_list" class="row">
<view>商品总价 <text>共计5件商品</text></view> <view>商品总价 <text>共计{{datas.goods_list.length}}商品</text></view>
<view><text>¥</text>50<text>.00</text></view> <view><text>¥</text>{{c_price(datas.total, 0)}}<text>.{{c_price(datas.total, 1)}}</text></view>
</view> </view>
<view class="row"> <view class="row">
<view>运费</view> <view>运费</view>
@ -48,24 +50,25 @@
</view> </view>
<view class="row-need"> <view class="row-need">
<view style="margin-right: 10rpx;">需付款</view> <view style="margin-right: 10rpx;">需付款</view>
<view><text>¥</text>50<text>.00</text></view> <view><text>¥</text>{{c_price(datas.total, 0)}}<text>.{{c_price(datas.total, 1)}}</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>订单编号</view> <view>订单编号</view>
<up-copy content="wxo13546486484784555"> <up-copy :content="datas.number">
<text>wxo13546486484784555 | 复制</text> <text>{{datas.number}} | 复制</text>
</up-copy> </up-copy>
</view> </view>
<view class="row"> <view class="row">
<view>下单时间</view> <view>下单时间</view>
<view>2024-04-25 15:00:00</view> <view>{{datas.create_time}}</view>
</view> </view>
<view class="row" style="margin-bottom: 0;"> <view class="row" style="margin-bottom: 0;">
<view>支付状态</view> <view>支付状态</view>
<view class="red">待支付</view> <view v-if="datas.paid">已支付</view>
<view v-else class="red">待支付</view>
</view> </view>
</view> </view>
<view style="width: 100%;height: 200rpx;"></view> <view style="width: 100%;height: 200rpx;"></view>
@ -73,7 +76,7 @@
<view class="fiexd-btn-box"> <view class="fiexd-btn-box">
<view style="color: #777777;" @click="showCancel=true">取消订单</view> <view style="color: #777777;" @click="showCancel=true">取消订单</view>
<view style="width: 450rpx;"> <view style="width: 450rpx;">
<up-button color="#20B128" shape="circle">立即支付 ¥50.00</up-button> <up-button color="#20B128" shape="circle">立即支付 ¥{{datas.total}}</up-button>
</view> </view>
</view> </view>
@ -122,15 +125,26 @@
const datas = ref({}) const datas = ref({})
const getDetails = ()=>{ const getDetails = ()=>{
orderDetailApi().then(res=>{ orderDetailApi({
order_id: datas.value.id
}).then(res=>{
datas.value = res.data;
}) })
} }
const c_price = (price, index=0)=>{
price = price + '';
return price.split('.')[index] || (index ? '00' : '0');
}
onLoad((option) => { onLoad((option) => {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: option.type == 1 ? '等待付款' : '订单详情' title: option.type == 1 ? '等待付款' : '订单详情'
}) })
if(option.id) {
datas.value.id = option.id;
getDetails()
}
}) })
</script> </script>
@ -190,6 +204,8 @@
width: 160rpx; width: 160rpx;
height: 160rpx; height: 160rpx;
margin-right: 20rpx; margin-right: 20rpx;
border-radius: 14rpx;
overflow: hidden;
} }
.body-content { .body-content {

View File

@ -26,7 +26,7 @@ if (!Math) {
const _sfc_main = { const _sfc_main = {
__name: "login", __name: "login",
setup(__props) { setup(__props) {
const userStore = store_user.useUserStore(); store_user.useUserStore();
const showWeixin = common_vendor.ref(true); const showWeixin = common_vendor.ref(true);
const isAgree = common_vendor.ref(false); const isAgree = common_vendor.ref(false);
const weixinLogin = () => { const weixinLogin = () => {
@ -38,19 +38,7 @@ const _sfc_main = {
common_vendor.index.login({ common_vendor.index.login({
provider: "weixin", provider: "weixin",
success: (res) => { success: (res) => {
api_user.userLoginWeixinApi({ return console.log(res);
code: res.code
}).then((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) => { fail: (err) => {
console.log(err); console.log(err);
@ -58,6 +46,7 @@ const _sfc_main = {
} }
}); });
}; };
common_vendor.ref(null);
const loginForm = common_vendor.ref({ const loginForm = common_vendor.ref({
phone: "15366662222", phone: "15366662222",
code: "" code: ""
@ -130,7 +119,6 @@ const _sfc_main = {
}), }),
e: common_vendor.o(weixinLogin), e: common_vendor.o(weixinLogin),
f: common_vendor.p({ f: common_vendor.p({
["open-type"]: "getPhoneNumber",
color: "#20B128", color: "#20B128",
size: "large" size: "large"
}), }),

View File

@ -2,22 +2,25 @@
const common_vendor = require("../../common/vendor.js"); const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js"); const common_assets = require("../../common/assets.js");
const dict_cancelDict = require("../../dict/cancelDict.js"); const dict_cancelDict = require("../../dict/cancelDict.js");
const api_order = require("../../api/order.js");
require("../../utils/request.js"); require("../../utils/request.js");
require("../../config/app.js"); require("../../config/app.js");
require("../../store/user.js"); require("../../store/user.js");
if (!Array) { if (!Array) {
const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon"); const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
const _easycom_up_button2 = common_vendor.resolveComponent("up-button"); const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
const _easycom_up_image2 = common_vendor.resolveComponent("up-image");
const _easycom_up_copy2 = common_vendor.resolveComponent("up-copy"); const _easycom_up_copy2 = common_vendor.resolveComponent("up-copy");
const _easycom_up_popup2 = common_vendor.resolveComponent("up-popup"); const _easycom_up_popup2 = common_vendor.resolveComponent("up-popup");
(_easycom_up_icon2 + _easycom_up_button2 + _easycom_up_copy2 + _easycom_up_popup2)(); (_easycom_up_icon2 + _easycom_up_button2 + _easycom_up_image2 + _easycom_up_copy2 + _easycom_up_popup2)();
} }
const _easycom_up_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.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"; const _easycom_up_button = () => "../../uni_modules/uview-plus/components/u-button/u-button.js";
const _easycom_up_image = () => "../../uni_modules/uview-plus/components/u-image/u-image.js";
const _easycom_up_copy = () => "../../uni_modules/uview-plus/components/u-copy/u-copy.js"; const _easycom_up_copy = () => "../../uni_modules/uview-plus/components/u-copy/u-copy.js";
const _easycom_up_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js"; const _easycom_up_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
if (!Math) { if (!Math) {
(_easycom_up_icon + _easycom_up_button + _easycom_up_copy + _easycom_up_popup + addressPopup + modal)(); (_easycom_up_icon + _easycom_up_button + _easycom_up_image + _easycom_up_copy + _easycom_up_popup + addressPopup + modal)();
} }
const addressPopup = () => "../../components/addressPopup.js"; const addressPopup = () => "../../components/addressPopup.js";
const modal = () => "../../components/modal.js"; const modal = () => "../../components/modal.js";
@ -39,14 +42,29 @@ const _sfc_main = {
showAddress.value = false; showAddress.value = false;
console.log(e); console.log(e);
}; };
common_vendor.ref({}); const datas = common_vendor.ref({});
const getDetails = () => {
api_order.orderDetailApi({
order_id: datas.value.id
}).then((res) => {
datas.value = res.data;
});
};
const c_price = (price, index = 0) => {
price = price + "";
return price.split(".")[index] || (index ? "00" : "0");
};
common_vendor.onLoad((option) => { common_vendor.onLoad((option) => {
common_vendor.index.setNavigationBarTitle({ common_vendor.index.setNavigationBarTitle({
title: option.type == 1 ? "等待付款" : "订单详情" title: option.type == 1 ? "等待付款" : "订单详情"
}); });
if (option.id) {
datas.value.id = option.id;
getDetails();
}
}); });
return (_ctx, _cache) => { return (_ctx, _cache) => {
return { return common_vendor.e({
a: common_vendor.p({ a: common_vendor.p({
name: "map" name: "map"
}), }),
@ -59,15 +77,41 @@ const _sfc_main = {
color: "#666666" color: "#666666"
} }
}), }),
d: common_vendor.p({ d: common_vendor.f(datas.value.goods_list, (item, index, i0) => {
content: "wxo13546486484784555" return {
a: "666b5ad0-2-" + i0,
b: common_vendor.p({
src: item.imgs,
width: "160rpx",
height: "160rpx"
}), }),
e: common_vendor.o(($event) => showCancel.value = true), c: common_vendor.t(item.class_name),
f: common_vendor.p({ d: common_vendor.t(item.sell),
e: common_vendor.t(item.nums)
};
}),
e: datas.value.goods_list
}, datas.value.goods_list ? {
f: common_vendor.t(datas.value.goods_list.length),
g: common_vendor.t(c_price(datas.value.total, 0)),
h: common_vendor.t(c_price(datas.value.total, 1))
} : {}, {
i: common_vendor.t(c_price(datas.value.total, 0)),
j: common_vendor.t(c_price(datas.value.total, 1)),
k: common_vendor.t(datas.value.number),
l: common_vendor.p({
content: datas.value.number
}),
m: common_vendor.t(datas.value.create_time),
n: datas.value.paid
}, datas.value.paid ? {} : {}, {
o: common_vendor.o(($event) => showCancel.value = true),
p: common_vendor.t(datas.value.total),
q: common_vendor.p({
color: "#20B128", color: "#20B128",
shape: "circle" shape: "circle"
}), }),
g: common_vendor.f(common_vendor.unref(dict_cancelDict.list), (item, index, i0) => { r: common_vendor.f(common_vendor.unref(dict_cancelDict.list), (item, index, i0) => {
return common_vendor.e({ return common_vendor.e({
a: common_vendor.t(item.name), a: common_vendor.t(item.name),
b: cancelType.value == item.value b: cancelType.value == item.value
@ -80,27 +124,27 @@ const _sfc_main = {
f: common_vendor.o(($event) => cancelType.value = item.value, item.value) f: common_vendor.o(($event) => cancelType.value = item.value, item.value)
}); });
}), }),
h: common_vendor.o(submitCancel), s: common_vendor.o(submitCancel),
i: common_vendor.p({ t: common_vendor.p({
color: "#20B128", color: "#20B128",
shape: "circle" shape: "circle"
}), }),
j: common_vendor.o(($event) => showCancel.value = false), v: common_vendor.o(($event) => showCancel.value = false),
k: common_vendor.p({ w: common_vendor.p({
show: showCancel.value, show: showCancel.value,
closeable: true, closeable: true,
round: "10" round: "10"
}), }),
l: common_vendor.o(($event) => showAddress.value = false), x: common_vendor.o(($event) => showAddress.value = false),
m: common_vendor.o(changeAddress), y: common_vendor.o(changeAddress),
n: common_vendor.p({ z: common_vendor.p({
show: showAddress.value show: showAddress.value
}), }),
o: common_vendor.p({ A: common_vendor.p({
show: false, show: false,
content: "您还没有添加收货地址,请点击添加" content: "您还没有添加收货地址,请点击添加"
}) })
}; });
}; };
} }
}; };

View File

@ -4,6 +4,7 @@
"usingComponents": { "usingComponents": {
"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", "up-button": "../../uni_modules/uview-plus/components/u-button/u-button",
"up-image": "../../uni_modules/uview-plus/components/u-image/u-image",
"up-copy": "../../uni_modules/uview-plus/components/u-copy/u-copy", "up-copy": "../../uni_modules/uview-plus/components/u-copy/u-copy",
"up-popup": "../../uni_modules/uview-plus/components/u-popup/u-popup", "up-popup": "../../uni_modules/uview-plus/components/u-popup/u-popup",
"address-popup": "../../components/addressPopup", "address-popup": "../../components/addressPopup",

View File

@ -1 +1 @@
<view class=""><view class="count_down"> 还剩<text>00:28:36</text>订单自动取消 </view><view class="m-card m-address"><view class="address-info"><view class="top"><up-icon wx:if="{{a}}" u-i="666b5ad0-0" bind:__l="__l" u-p="{{a}}"></up-icon><view class="t-name">小王</view><view>155****9999</view></view><view class="bottom u-line-2"> 四川泸州市龙马潭区莲花池街道商业街1号 </view></view><view class="address-btn"><view style="width:80px"><up-button wx:if="{{c}}" u-s="{{['d']}}" bindclick="{{b}}" u-i="666b5ad0-1" bind:__l="__l" u-p="{{c}}">修改</up-button></view></view></view><view class="m-card m-good"><image class="image" src="/static/logo.png"></image><view class="body-content"><view><view class="title"><view>黄牛肉20kg</view><view>¥10.00</view></view><view class="tips"><view>我不吃牛肉</view><view>x5</view></view></view><view class="time"> 预计48小时发货 </view></view></view><view class="m-card good-info"><view class="row"><view>商品总价 <text>共计5件商品</text></view><view><text>¥</text>50<text>.00</text></view></view><view class="row"><view>运费</view><view><text>¥</text>0<text>.00</text></view></view><view class="row-need"><view style="margin-right:10rpx">需付款</view><view><text>¥</text>50<text>.00</text></view></view></view><view class="m-card good-info"><view class="head-title">订单信息</view><view class="row"><view>订单编号</view><up-copy wx:if="{{d}}" u-s="{{['d']}}" u-i="666b5ad0-2" bind:__l="__l" u-p="{{d}}"><text>wxo13546486484784555 | 复制</text></up-copy></view><view class="row"><view>下单时间</view><view>2024-04-25 15:00:00</view></view><view class="row" style="margin-bottom:0"><view>支付状态</view><view class="red">待支付</view></view></view><view style="width:100%;height:200rpx"></view><view class="fiexd-btn-box"><view style="color:#777777" bindtap="{{e}}">取消订单</view><view style="width:450rpx"><up-button wx:if="{{f}}" u-s="{{['d']}}" u-i="666b5ad0-3" bind:__l="__l" u-p="{{f}}">立即支付 ¥50.00</up-button></view></view><up-popup wx:if="{{k}}" u-s="{{['d']}}" bindclose="{{j}}" u-i="666b5ad0-4" bind:__l="__l" u-p="{{k}}"><view class="cancel-popup"><view class="head-title">订单取消</view><view wx:for="{{g}}" wx:for-item="item" wx:key="e" class="row" bindtap="{{item.f}}"><view>{{item.a}}</view><image wx:if="{{item.b}}" src="{{item.c}}"></image><image wx:else src="{{item.d}}"></image></view><up-button wx:if="{{i}}" u-s="{{['d']}}" bindclick="{{h}}" u-i="666b5ad0-5,666b5ad0-4" bind:__l="__l" u-p="{{i}}">提交</up-button></view></up-popup><address-popup wx:if="{{n}}" bindclose="{{l}}" bindchange="{{m}}" u-i="666b5ad0-6" bind:__l="__l" u-p="{{n}}"></address-popup><modal wx:if="{{o}}" u-i="666b5ad0-7" bind:__l="__l" u-p="{{o}}"></modal></view> <view class=""><view class="count_down"> 还剩<text>00:28:36</text>订单自动取消 </view><view class="m-card m-address"><view class="address-info"><view class="top"><up-icon wx:if="{{a}}" u-i="666b5ad0-0" bind:__l="__l" u-p="{{a}}"></up-icon><view class="t-name">小王</view><view>155****9999</view></view><view class="bottom u-line-2"> 四川泸州市龙马潭区莲花池街道商业街1号 </view></view><view class="address-btn"><view style="width:80px"><up-button wx:if="{{c}}" u-s="{{['d']}}" bindclick="{{b}}" u-i="666b5ad0-1" bind:__l="__l" u-p="{{c}}">修改</up-button></view></view></view><view wx:for="{{d}}" wx:for-item="item" class="m-card m-good"><view class="image"><up-image wx:if="{{item.b}}" u-i="{{item.a}}" bind:__l="__l" u-p="{{item.b}}"></up-image></view><view class="body-content"><view><view class="title"><view>{{item.c}}</view><view>¥{{item.d}}</view></view><view class="tips"><view>数量</view><view>x{{item.e}}</view></view></view><view class="time"> 预计48小时发货 </view></view></view><view class="m-card good-info"><view wx:if="{{e}}" class="row"><view>商品总价 <text>共计{{f}}款商品</text></view><view><text>¥</text>{{g}}<text>.{{h}}</text></view></view><view class="row"><view>运费</view><view><text>¥</text>0<text>.00</text></view></view><view class="row-need"><view style="margin-right:10rpx">需付款</view><view><text>¥</text>{{i}}<text>.{{j}}</text></view></view></view><view class="m-card good-info"><view class="head-title">订单信息</view><view class="row"><view>订单编号</view><up-copy wx:if="{{l}}" u-s="{{['d']}}" u-i="666b5ad0-3" bind:__l="__l" u-p="{{l}}"><text>{{k}} | 复制</text></up-copy></view><view class="row"><view>下单时间</view><view>{{m}}</view></view><view class="row" style="margin-bottom:0"><view>支付状态</view><view wx:if="{{n}}">已支付</view><view wx:else class="red">待支付</view></view></view><view style="width:100%;height:200rpx"></view><view class="fiexd-btn-box"><view style="color:#777777" bindtap="{{o}}">取消订单</view><view style="width:450rpx"><up-button wx:if="{{q}}" u-s="{{['d']}}" u-i="666b5ad0-4" bind:__l="__l" u-p="{{q}}">立即支付 ¥{{p}}</up-button></view></view><up-popup wx:if="{{w}}" u-s="{{['d']}}" bindclose="{{v}}" u-i="666b5ad0-5" bind:__l="__l" u-p="{{w}}"><view class="cancel-popup"><view class="head-title">订单取消</view><view wx:for="{{r}}" wx:for-item="item" wx:key="e" class="row" bindtap="{{item.f}}"><view>{{item.a}}</view><image wx:if="{{item.b}}" src="{{item.c}}"></image><image wx:else src="{{item.d}}"></image></view><up-button wx:if="{{t}}" u-s="{{['d']}}" bindclick="{{s}}" u-i="666b5ad0-6,666b5ad0-5" bind:__l="__l" u-p="{{t}}">提交</up-button></view></up-popup><address-popup wx:if="{{z}}" bindclose="{{x}}" bindchange="{{y}}" u-i="666b5ad0-7" bind:__l="__l" u-p="{{z}}"></address-popup><modal wx:if="{{A}}" u-i="666b5ad0-8" bind:__l="__l" u-p="{{A}}"></modal></view>

View File

@ -70,6 +70,8 @@
width: 160rpx; width: 160rpx;
height: 160rpx; height: 160rpx;
margin-right: 20rpx; margin-right: 20rpx;
border-radius: 14rpx;
overflow: hidden;
} }
.m-good .body-content { .m-good .body-content {
width: 490rpx; width: 490rpx;