This commit is contained in:
2025-01-08 09:44:25 +08:00
parent 06f6e29972
commit 4d21314fc6
60 changed files with 5477 additions and 4495 deletions
+2 -4
View File
@@ -1,9 +1,7 @@
VITE_APP_NAME=后台管理系统 VITE_APP_NAME=后台管理系统
VITE_SOCKET_URL=wss://server.gxwebsoft.com VITE_SOCKET_URL=wss://server.gxwebsoft.com
VITE_SERVER_URL=https://server.gxwebsoft.com/api VITE_SERVER_URL=https://gxtyzx-server.websoft.top/api
VITE_API_URL=https://modules.gxwebsoft.com/api VITE_API_URL=https://gxtyzx-modules.websoft.top/api
VITE_THINK_URL=https://gxtyzx-api.websoft.top/api VITE_THINK_URL=https://gxtyzx-api.websoft.top/api
#VITE_SERVER_URL=http://127.0.0.1:9090/api
#VITE_API_URL=http://127.0.0.1:9099/api
#VITE_THINK_URL=http://127.0.0.1:9099/api #VITE_THINK_URL=http://127.0.0.1:9099/api
+2 -5
View File
@@ -1,8 +1,5 @@
VITE_APP_NAME=后台管理系统 VITE_APP_NAME=后台管理系统
VITE_SOCKET_URL=wss://server.gxwebsoft.com VITE_SOCKET_URL=wss://server.gxwebsoft.com
VITE_SERVER_URL=https://server.gxwebsoft.com/api VITE_SERVER_URL=https://gxtyzx-server.websoft.top/api
VITE_API_URL=https://gxtyzx-modules.websoft.top/api
VITE_THINK_URL=https://gxtyzx-api.websoft.top/api VITE_THINK_URL=https://gxtyzx-api.websoft.top/api
VITE_API_URL=https://modules.gxwebsoft.com/api
#VITE_SERVER_URL=http://127.0.0.1:9090/api
#VITE_API_URL=http://127.0.0.1:9001/api
#VITE_THINK_URL=http://127.0.0.1:9099/api
+125
View File
@@ -0,0 +1,125 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="HtmlUnknownAttribute" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="2">
<item index="0" class="java.lang.String" itemvalue="class" />
<item index="1" class="java.lang.String" itemvalue="style" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="100">
<item index="0" class="java.lang.String" itemvalue="nobr" />
<item index="1" class="java.lang.String" itemvalue="noembed" />
<item index="2" class="java.lang.String" itemvalue="comment" />
<item index="3" class="java.lang.String" itemvalue="noscript" />
<item index="4" class="java.lang.String" itemvalue="embed" />
<item index="5" class="java.lang.String" itemvalue="script" />
<item index="6" class="java.lang.String" itemvalue="el-form" />
<item index="7" class="java.lang.String" itemvalue="el-input" />
<item index="8" class="java.lang.String" itemvalue="el-form-item" />
<item index="9" class="java.lang.String" itemvalue="el-button" />
<item index="10" class="java.lang.String" itemvalue="el-container" />
<item index="11" class="java.lang.String" itemvalue="el-header" />
<item index="12" class="java.lang.String" itemvalue="el-menu" />
<item index="13" class="java.lang.String" itemvalue="el-menu-item" />
<item index="14" class="java.lang.String" itemvalue="el-submenu" />
<item index="15" class="java.lang.String" itemvalue="el-breadcrumb" />
<item index="16" class="java.lang.String" itemvalue="el-breadcrumb-item" />
<item index="17" class="java.lang.String" itemvalue="el-dialog" />
<item index="18" class="java.lang.String" itemvalue="el-row" />
<item index="19" class="java.lang.String" itemvalue="el-col" />
<item index="20" class="java.lang.String" itemvalue="el-table-column" />
<item index="21" class="java.lang.String" itemvalue="el-table" />
<item index="22" class="java.lang.String" itemvalue="el-pagination" />
<item index="23" class="java.lang.String" itemvalue="el-upload" />
<item index="24" class="java.lang.String" itemvalue="el-select" />
<item index="25" class="java.lang.String" itemvalue="el-option" />
<item index="26" class="java.lang.String" itemvalue="el-date-picker" />
<item index="27" class="java.lang.String" itemvalue="el-switch" />
<item index="28" class="java.lang.String" itemvalue="u-swiper" />
<item index="29" class="java.lang.String" itemvalue="u-image" />
<item index="30" class="java.lang.String" itemvalue="u-button" />
<item index="31" class="java.lang.String" itemvalue="web-view" />
<item index="32" class="java.lang.String" itemvalue="u-avatar" />
<item index="33" class="java.lang.String" itemvalue="u-text" />
<item index="34" class="java.lang.String" itemvalue="u-grid" />
<item index="35" class="java.lang.String" itemvalue="u-grid-item" />
<item index="36" class="java.lang.String" itemvalue="u-icon" />
<item index="37" class="java.lang.String" itemvalue="u-cell-group" />
<item index="38" class="java.lang.String" itemvalue="u-cell" />
<item index="39" class="java.lang.String" itemvalue="u-tabs" />
<item index="40" class="java.lang.String" itemvalue="u-gap" />
<item index="41" class="java.lang.String" itemvalue="scroll-view" />
<item index="42" class="java.lang.String" itemvalue="u-toast" />
<item index="43" class="java.lang.String" itemvalue="u-subsection" />
<item index="44" class="java.lang.String" itemvalue="u-empty" />
<item index="45" class="java.lang.String" itemvalue="u-popup" />
<item index="46" class="java.lang.String" itemvalue="uqrcode" />
<item index="47" class="java.lang.String" itemvalue="temlate" />
<item index="48" class="java.lang.String" itemvalue="el-tree" />
<item index="49" class="java.lang.String" itemvalue="el-card" />
<item index="50" class="java.lang.String" itemvalue="el-tag" />
<item index="51" class="java.lang.String" itemvalue="u-modal" />
<item index="52" class="java.lang.String" itemvalue="rich-text" />
<item index="53" class="java.lang.String" itemvalue="u--text" />
<item index="54" class="java.lang.String" itemvalue="u-line-progress" />
<item index="55" class="java.lang.String" itemvalue="u--image" />
<item index="56" class="java.lang.String" itemvalue="page" />
<item index="57" class="java.lang.String" itemvalue="el-aside" />
<item index="58" class="java.lang.String" itemvalue="house" />
<item index="59" class="java.lang.String" itemvalue="el-dropdown" />
<item index="60" class="java.lang.String" itemvalue="arrowdown" />
<item index="61" class="java.lang.String" itemvalue="el-dropdown-menu" />
<item index="62" class="java.lang.String" itemvalue="caretleft" />
<item index="63" class="java.lang.String" itemvalue="close" />
<item index="64" class="java.lang.String" itemvalue="fold" />
<item index="65" class="java.lang.String" itemvalue="expand" />
<item index="66" class="java.lang.String" itemvalue="caretright" />
<item index="67" class="java.lang.String" itemvalue="upload" />
<item index="68" class="java.lang.String" itemvalue="el-cascader" />
<item index="69" class="java.lang.String" itemvalue="u-search" />
<item index="70" class="java.lang.String" itemvalue="u-scroll-list" />
<item index="71" class="java.lang.String" itemvalue="u-navbar" />
<item index="72" class="java.lang.String" itemvalue="u-loadmore" />
<item index="73" class="java.lang.String" itemvalue="u-parse" />
<item index="74" class="java.lang.String" itemvalue="u-number-box" />
<item index="75" class="java.lang.String" itemvalue="u-tag" />
<item index="76" class="java.lang.String" itemvalue="u-checkbox" />
<item index="77" class="java.lang.String" itemvalue="u-checkbox-group" />
<item index="78" class="java.lang.String" itemvalue="checkbox" />
<item index="79" class="java.lang.String" itemvalue="u-action-sheet" />
<item index="80" class="java.lang.String" itemvalue="u-line" />
<item index="81" class="java.lang.String" itemvalue="u-count-to" />
<item index="82" class="java.lang.String" itemvalue="u-swipe-action" />
<item index="83" class="java.lang.String" itemvalue="u-swipe-action-item" />
<item index="84" class="java.lang.String" itemvalue="u-form" />
<item index="85" class="java.lang.String" itemvalue="u-form-item" />
<item index="86" class="java.lang.String" itemvalue="u-input" />
<item index="87" class="java.lang.String" itemvalue="u-switch" />
<item index="88" class="java.lang.String" itemvalue="u-textarea" />
<item index="89" class="java.lang.String" itemvalue="u-picker" />
<item index="90" class="java.lang.String" itemvalue="u-sticky" />
<item index="91" class="java.lang.String" itemvalue="el-popover" />
<item index="92" class="java.lang.String" itemvalue="plus" />
<item index="93" class="java.lang.String" itemvalue="el-input-number" />
<item index="94" class="java.lang.String" itemvalue="el-checkbox" />
<item index="95" class="java.lang.String" itemvalue="el-checkbox-group" />
<item index="96" class="java.lang.String" itemvalue="el-radio-group" />
<item index="97" class="java.lang.String" itemvalue="el-radio-button" />
<item index="98" class="java.lang.String" itemvalue="el-collapse" />
<item index="99" class="java.lang.String" itemvalue="el-collapse-item" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
</profile>
</component>
+13 -12
View File
@@ -1,14 +1,15 @@
import request from '@/utils/request'; import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api'; import type { ApiResult, PageResult } from '@/api';
import type { UserInvoice, UserInvoiceParam } from './model'; import type { UserInvoice, UserInvoiceParam } from './model';
import { MODULES_API_URL } from '@/config/setting'; import { THINK_API_URL } from '@/config/setting';
import type {ThinkInvoice} from "@/api/think/thinkInvoice/model";
/** /**
* 分页查询发票 * 分页查询发票
*/ */
export async function pageUserInvoice(params: UserInvoiceParam) { export async function pageUserInvoice(params: UserInvoiceParam) {
const res = await request.get<ApiResult<PageResult<UserInvoice>>>( const res = await request.get<ApiResult<PageResult<UserInvoice>>>(
MODULES_API_URL + '/booking/user-invoice/page', THINK_API_URL + '/booking/booking-user-invoice/page',
{ {
params params
} }
@@ -24,7 +25,7 @@ export async function pageUserInvoice(params: UserInvoiceParam) {
*/ */
export async function listUserInvoice(params?: UserInvoiceParam) { export async function listUserInvoice(params?: UserInvoiceParam) {
const res = await request.get<ApiResult<UserInvoice[]>>( const res = await request.get<ApiResult<UserInvoice[]>>(
MODULES_API_URL + '/booking/user-invoice', THINK_API_URL + '/booking/booking-user-invoice',
{ {
params params
} }
@@ -40,7 +41,7 @@ export async function listUserInvoice(params?: UserInvoiceParam) {
*/ */
export async function addUserInvoice(data: UserInvoice) { export async function addUserInvoice(data: UserInvoice) {
const res = await request.post<ApiResult<unknown>>( const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/booking/user-invoice', THINK_API_URL + '/booking/booking-user-invoice',
data data
); );
if (res.data.code === 0) { if (res.data.code === 0) {
@@ -54,7 +55,7 @@ export async function addUserInvoice(data: UserInvoice) {
*/ */
export async function updateUserInvoice(data: UserInvoice) { export async function updateUserInvoice(data: UserInvoice) {
const res = await request.put<ApiResult<unknown>>( const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/booking/user-invoice', THINK_API_URL + '/booking/booking-user-invoice',
data data
); );
if (res.data.code === 0) { if (res.data.code === 0) {
@@ -68,7 +69,7 @@ export async function updateUserInvoice(data: UserInvoice) {
*/ */
export async function removeUserInvoice(id?: number) { export async function removeUserInvoice(id?: number) {
const res = await request.delete<ApiResult<unknown>>( const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/booking/user-invoice/' + id THINK_API_URL + '/booking/booking-user-invoice/' + id
); );
if (res.data.code === 0) { if (res.data.code === 0) {
return res.data.message; return res.data.message;
@@ -81,7 +82,7 @@ export async function removeUserInvoice(id?: number) {
*/ */
export async function removeBatchUserInvoice(data: (number | undefined)[]) { export async function removeBatchUserInvoice(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>( const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/booking/user-invoice/batch', THINK_API_URL + '/booking/booking-user-invoice/batch',
{ {
data data
} }
@@ -97,7 +98,7 @@ export async function removeBatchUserInvoice(data: (number | undefined)[]) {
*/ */
export async function getUserInvoice(id: number) { export async function getUserInvoice(id: number) {
const res = await request.get<ApiResult<UserInvoice>>( const res = await request.get<ApiResult<UserInvoice>>(
MODULES_API_URL + '/booking/user-invoice/' + id THINK_API_URL + '/booking/booking-user-invoice/' + id
); );
if (res.data.code === 0 && res.data.data) { if (res.data.code === 0 && res.data.data) {
return res.data.data; return res.data.data;
@@ -108,9 +109,9 @@ export async function getUserInvoice(id: number) {
/** /**
* 开具发票 * 开具发票
*/ */
export async function doInvoice(data: UserInvoice) { export async function doInvoice(data: ThinkInvoice) {
const res = await request.post<ApiResult<unknown>>( const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/booking/user-invoice/doInvoice', THINK_API_URL + '/think/think-invoice/doInvoice',
data data
); );
if (res.data.code === 0) { if (res.data.code === 0) {
@@ -123,9 +124,9 @@ export async function doInvoice(data: UserInvoice) {
/** /**
* 根据orderNo查询发票 * 根据orderNo查询发票
*/ */
export async function showInvoice(orderNo: string) { export async function showInvoice(id: number) {
const res = await request.get<ApiResult<UserInvoice>>( const res = await request.get<ApiResult<UserInvoice>>(
MODULES_API_URL + '/booking/user-invoice/showInvoice/' + orderNo THINK_API_URL + `/think/think-invoice/showInvoice/${id}`
); );
if (res.data.code === 0 && res.data.data) { if (res.data.code === 0 && res.data.data) {
return res.data.data; return res.data.data;
+12 -12
View File
@@ -1,6 +1,6 @@
import request from '@/utils/request'; import request from '@/utils/request';
import type {ApiResult, PageResult} from '@/api'; import type {ApiResult, PageResult} from '@/api';
import {MODULES_API_URL} from '@/config/setting'; import {THINK_API_URL} from '@/config/setting';
import type {Cart, CartParam, CartVo} from "@/api/shop/cart/model"; import type {Cart, CartParam, CartVo} from "@/api/shop/cart/model";
import type {Merchant} from "@/api/shop/merchant/model"; import type {Merchant} from "@/api/shop/merchant/model";
@@ -9,7 +9,7 @@ import type {Merchant} from "@/api/shop/merchant/model";
*/ */
export async function pageCart(params: CartParam) { export async function pageCart(params: CartParam) {
const res = await request.get<ApiResult<PageResult<Cart>>>( const res = await request.get<ApiResult<PageResult<Cart>>>(
MODULES_API_URL + '/shop/cart/page', THINK_API_URL + '/shop/cart/page',
{ {
params params
} }
@@ -25,7 +25,7 @@ export async function pageCart(params: CartParam) {
*/ */
export async function listCart(params?: CartParam) { export async function listCart(params?: CartParam) {
const res = await request.get<ApiResult<CartVo>>( const res = await request.get<ApiResult<CartVo>>(
MODULES_API_URL + '/shop/cart', THINK_API_URL + '/shop/cart',
{ {
params params
} }
@@ -41,7 +41,7 @@ export async function listCart(params?: CartParam) {
*/ */
export async function addCart(data: Cart) { export async function addCart(data: Cart) {
const res = await request.post<ApiResult<unknown>>( const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/shop/cart', THINK_API_URL + '/shop/cart',
data data
); );
console.log(res) console.log(res)
@@ -56,7 +56,7 @@ export async function addCart(data: Cart) {
*/ */
export async function updateCart(data: Cart) { export async function updateCart(data: Cart) {
const res = await request.put<ApiResult<unknown>>( const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/shop/cart', THINK_API_URL + '/shop/cart',
data data
); );
if (res.data.code === 0) { if (res.data.code === 0) {
@@ -70,7 +70,7 @@ export async function updateCart(data: Cart) {
*/ */
export async function removeCart(id?: number) { export async function removeCart(id?: number) {
const res = await request.delete<ApiResult<unknown>>( const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/shop/cart/' + id THINK_API_URL + '/shop/cart/' + id
); );
if (res.data.code === 0) { if (res.data.code === 0) {
return res.data.message; return res.data.message;
@@ -81,7 +81,7 @@ export async function removeCart(id?: number) {
// 按店铺ID更新选中 // 按店铺ID更新选中
export async function updateCartByMerchantId(id?: number) { export async function updateCartByMerchantId(id?: number) {
const res = await request.put<ApiResult<unknown>>( const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/shop/cart/updateCartByMerchantId/' + id THINK_API_URL + '/shop/cart/updateCartByMerchantId/' + id
); );
if (res.data.code === 0) { if (res.data.code === 0) {
return res.data.message; return res.data.message;
@@ -93,7 +93,7 @@ export async function updateCartByMerchantId(id?: number) {
// 全选操作 // 全选操作
export async function onSelectAll(yes: Boolean) { export async function onSelectAll(yes: Boolean) {
const res = await request.put<ApiResult<unknown>>( const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/shop/cart/onSelectAll/' + yes THINK_API_URL + '/shop/cart/onSelectAll/' + yes
); );
if (res.data.code === 0) { if (res.data.code === 0) {
return res.data; return res.data;
@@ -105,7 +105,7 @@ export async function onSelectAll(yes: Boolean) {
* 批量修改 * 批量修改
*/ */
export async function updateBatchCart(data: Cart[]) { export async function updateBatchCart(data: Cart[]) {
const res = await request.put<ApiResult<unknown>>(MODULES_API_URL + '/shop/cart/batch', data); const res = await request.put<ApiResult<unknown>>(THINK_API_URL + '/shop/cart/batch', data);
if (res.data.code === 0) { if (res.data.code === 0) {
return res.data.message; return res.data.message;
} }
@@ -117,7 +117,7 @@ export async function updateBatchCart(data: Cart[]) {
*/ */
export async function removeBatchCart(data: (number | undefined)[]) { export async function removeBatchCart(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>( const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/shop/cart/batch', THINK_API_URL + '/shop/cart/batch',
data data
); );
if (res.data.code === 0) { if (res.data.code === 0) {
@@ -131,7 +131,7 @@ export async function removeBatchCart(data: (number | undefined)[]) {
*/ */
export async function getCart(id: number) { export async function getCart(id: number) {
const res = await request.get<ApiResult<Cart>>( const res = await request.get<ApiResult<Cart>>(
MODULES_API_URL + '/shop/cart/' + id THINK_API_URL + '/shop/cart/' + id
); );
if (res.data.code === 0 && res.data.data) { if (res.data.code === 0 && res.data.data) {
return res.data.data; return res.data.data;
@@ -144,7 +144,7 @@ export async function getCart(id: number) {
*/ */
export async function myCart(params: CartParam) { export async function myCart(params: CartParam) {
const res = await request.get<ApiResult<Merchant[]>>( const res = await request.get<ApiResult<Merchant[]>>(
MODULES_API_URL + '/shop/cart/myCart', THINK_API_URL + '/shop/cart/myCart',
{ {
params params
} }
+3 -2
View File
@@ -123,8 +123,9 @@ export async function bindCard(data: ThinkCard) {
THINK_API_URL + '/think/think-card/bindCard', THINK_API_URL + '/think/think-card/bindCard',
data data
); );
if (res.data.code === 0 && res.data.data) { console.log('res.data.code', res.data.code)
return res.data.data; if (res.data.code === 0) {
return res.data;
} }
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
+106
View File
@@ -0,0 +1,106 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { ThinkCardsBills, ThinkCardsBillsParam } from './model';
import { MODULES_API_URL } from '@/config/setting';
/**
* 分页查询Vip卡每日账单
*/
export async function pageThinkCardsBills(params: ThinkCardsBillsParam) {
const res = await request.get<ApiResult<PageResult<ThinkCardsBills>>>(
MODULES_API_URL + '/think/think-cards-bills/page',
{
params
}
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询Vip卡每日账单列表
*/
export async function listThinkCardsBills(params?: ThinkCardsBillsParam) {
const res = await request.get<ApiResult<ThinkCardsBills[]>>(
MODULES_API_URL + '/think/think-cards-bills',
{
params
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 添加Vip卡每日账单
*/
export async function addThinkCardsBills(data: ThinkCardsBills) {
const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/think/think-cards-bills',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改Vip卡每日账单
*/
export async function updateThinkCardsBills(data: ThinkCardsBills) {
const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/think/think-cards-bills',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 删除Vip卡每日账单
*/
export async function removeThinkCardsBills(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/think/think-cards-bills/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 批量删除Vip卡每日账单
*/
export async function removeBatchThinkCardsBills(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/think/think-cards-bills/batch',
{
data
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 根据id查询Vip卡每日账单
*/
export async function getThinkCardsBills(id: number) {
const res = await request.get<ApiResult<ThinkCardsBills>>(
MODULES_API_URL + '/think/think-cards-bills/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
@@ -0,0 +1,35 @@
import type { PageParam } from '@/api';
/**
* Vip卡每日账单
*/
export interface ThinkCardsBills {
//
id?: number;
//
uid?: number;
//
cid?: number;
//
date?: string;
//
amount?: string;
// 租户id
tenantId?: number;
// 状态, 0已发布, 1待审核 2已驳回 3违规内容
status?: number;
// 是否删除, 0否, 1是
deleted?: number;
// 创建时间
createTime?: string;
// 修改时间
updateTime?: string;
}
/**
* Vip卡每日账单搜索条件
*/
export interface ThinkCardsBillsParam extends PageParam {
id?: number;
keywords?: string;
}
+1 -1
View File
@@ -44,7 +44,7 @@ export async function addThinkDeposit(data: ThinkDeposit) {
data data
); );
if (res.data.code === 0) { if (res.data.code === 0) {
return res.data.message; return res.data.data;
} }
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
+106
View File
@@ -0,0 +1,106 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { ThinkDepositItem, ThinkDepositItemParam } from './model';
import { THINK_API_URL } from '@/config/setting';
/**
* 分页查询押金物品
*/
export async function pageThinkDepositItem(params: ThinkDepositItemParam) {
const res = await request.get<ApiResult<PageResult<ThinkDepositItem>>>(
THINK_API_URL + '/think/think-deposit-item/page',
{
params
}
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询押金物品列表
*/
export async function listThinkDepositItem(params?: ThinkDepositItemParam) {
const res = await request.get<ApiResult<ThinkDepositItem[]>>(
THINK_API_URL + '/think/think-deposit-item',
{
params
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 添加押金物品
*/
export async function addThinkDepositItem(data: ThinkDepositItem) {
const res = await request.post<ApiResult<unknown>>(
THINK_API_URL + '/think/think-deposit-item',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改押金物品
*/
export async function updateThinkDepositItem(data: ThinkDepositItem) {
const res = await request.put<ApiResult<unknown>>(
THINK_API_URL + '/think/think-deposit-item',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 删除押金物品
*/
export async function removeThinkDepositItem(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
THINK_API_URL + '/think/think-deposit-item/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 批量删除押金物品
*/
export async function removeBatchThinkDepositItem(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
THINK_API_URL + '/think/think-deposit-item/batch',
{
data
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 根据id查询押金物品
*/
export async function getThinkDepositItem(id: number) {
const res = await request.get<ApiResult<ThinkDepositItem>>(
THINK_API_URL + '/think/think-deposit-item/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
@@ -0,0 +1,27 @@
import type { PageParam } from '@/api';
/**
* 押金物品
*/
export interface ThinkDepositItem {
//
id?: number;
//
title?: string;
//
amount?: string;
//
siteName?: string;
// 创建时间
createTime?: number;
// 租户id
tenantId?: number;
}
/**
* 押金物品搜索条件
*/
export interface ThinkDepositItemParam extends PageParam {
id?: number;
keywords?: string;
}
+1 -1
View File
@@ -44,7 +44,7 @@ export async function addThinkGoodsOrder(data: ThinkGoodsOrder) {
data data
); );
if (res.data.code === 0) { if (res.data.code === 0) {
return res.data.message; return res.data.data;
} }
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
+1 -1
View File
@@ -44,7 +44,7 @@ export async function addThinkInvoice(data: ThinkInvoice) {
data data
); );
if (res.data.code === 0) { if (res.data.code === 0) {
return res.data.message; return res.data;
} }
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
+106
View File
@@ -0,0 +1,106 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { ThinkMachineOpenLog, ThinkMachineOpenLogParam } from './model';
import { MODULES_API_URL } from '@/config/setting';
/**
* 分页查询闸机开门记录
*/
export async function pageThinkMachineOpenLog(params: ThinkMachineOpenLogParam) {
const res = await request.get<ApiResult<PageResult<ThinkMachineOpenLog>>>(
MODULES_API_URL + '/think/think-machine-open-log/page',
{
params
}
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询闸机开门记录列表
*/
export async function listThinkMachineOpenLog(params?: ThinkMachineOpenLogParam) {
const res = await request.get<ApiResult<ThinkMachineOpenLog[]>>(
MODULES_API_URL + '/think/think-machine-open-log',
{
params
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 添加闸机开门记录
*/
export async function addThinkMachineOpenLog(data: ThinkMachineOpenLog) {
const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/think/think-machine-open-log',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改闸机开门记录
*/
export async function updateThinkMachineOpenLog(data: ThinkMachineOpenLog) {
const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/think/think-machine-open-log',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 删除闸机开门记录
*/
export async function removeThinkMachineOpenLog(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/think/think-machine-open-log/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 批量删除闸机开门记录
*/
export async function removeBatchThinkMachineOpenLog(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/think/think-machine-open-log/batch',
{
data
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 根据id查询闸机开门记录
*/
export async function getThinkMachineOpenLog(id: number) {
const res = await request.get<ApiResult<ThinkMachineOpenLog>>(
MODULES_API_URL + '/think/think-machine-open-log/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
@@ -0,0 +1,31 @@
import type { PageParam } from '@/api';
/**
* 闸机开门记录
*/
export interface ThinkMachineOpenLog {
//
id?: number;
//
orderId?: number;
// 租户id
tenantId?: number;
// 备注
comments?: string;
// 状态, 0在线, 1离线
status?: number;
// 是否删除, 0否, 1是
deleted?: number;
// 注册时间
createTime?: string;
// 修改时间
updateTime?: string;
}
/**
* 闸机开门记录搜索条件
*/
export interface ThinkMachineOpenLogParam extends PageParam {
id?: number;
keywords?: string;
}
+10
View File
@@ -105,6 +105,16 @@ export async function getThinkOrder(id: number) {
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
export async function getThinkOrderByCode(code: string) {
const res = await request.get<ApiResult<ThinkOrder>>(
THINK_API_URL + `/think/think-order/by-code/${code}`
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
export async function thinkOrderRepay(data: ThinkOrder) { export async function thinkOrderRepay(data: ThinkOrder) {
const res = await request.post<ApiResult<ThinkOrder>>( const res = await request.post<ApiResult<ThinkOrder>>(
THINK_API_URL + '/think/think-order/repay', data THINK_API_URL + '/think/think-order/repay', data
+11
View File
@@ -104,6 +104,7 @@ export async function getThinkUsersVip(id: number) {
} }
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
export async function thinkUsersVipRepay(data: any) { export async function thinkUsersVipRepay(data: any) {
const res = await request.post<ApiResult<ThinkUsersVip>>( const res = await request.post<ApiResult<ThinkUsersVip>>(
THINK_API_URL + '/think/think-users-vip/repay', data THINK_API_URL + '/think/think-users-vip/repay', data
@@ -113,3 +114,13 @@ export async function thinkUsersVipRepay(data: any) {
} }
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
export async function thinkUsersVipLog(id: number) {
const res = await request.get<ApiResult<any[]>>(
THINK_API_URL + `/think/think-users-vip/log/${id}`
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
+106
View File
@@ -0,0 +1,106 @@
import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { ThinkVipCardsBills, ThinkVipCardsBillsParam } from './model';
import { MODULES_API_URL } from '@/config/setting';
/**
* 分页查询Vip卡每日账单
*/
export async function pageThinkVipCardsBills(params: ThinkVipCardsBillsParam) {
const res = await request.get<ApiResult<PageResult<ThinkVipCardsBills>>>(
MODULES_API_URL + '/think/think-vip-cards-bills/page',
{
params
}
);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 查询Vip卡每日账单列表
*/
export async function listThinkVipCardsBills(params?: ThinkVipCardsBillsParam) {
const res = await request.get<ApiResult<ThinkVipCardsBills[]>>(
MODULES_API_URL + '/think/think-vip-cards-bills',
{
params
}
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 添加Vip卡每日账单
*/
export async function addThinkVipCardsBills(data: ThinkVipCardsBills) {
const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/think/think-vip-cards-bills',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 修改Vip卡每日账单
*/
export async function updateThinkVipCardsBills(data: ThinkVipCardsBills) {
const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/think/think-vip-cards-bills',
data
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 删除Vip卡每日账单
*/
export async function removeThinkVipCardsBills(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/think/think-vip-cards-bills/' + id
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 批量删除Vip卡每日账单
*/
export async function removeBatchThinkVipCardsBills(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/think/think-vip-cards-bills/batch',
{
data
}
);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 根据id查询Vip卡每日账单
*/
export async function getThinkVipCardsBills(id: number) {
const res = await request.get<ApiResult<ThinkVipCardsBills>>(
MODULES_API_URL + '/think/think-vip-cards-bills/' + id
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
@@ -0,0 +1,35 @@
import type { PageParam } from '@/api';
/**
* Vip卡每日账单
*/
export interface ThinkVipCardsBills {
//
id?: number;
//
uid?: number;
//
vid?: number;
//
date?: string;
//
amount?: string;
// 租户id
tenantId?: number;
// 状态, 0已发布, 1待审核 2已驳回 3违规内容
status?: number;
// 是否删除, 0否, 1是
deleted?: number;
// 创建时间
createTime?: string;
// 修改时间
updateTime?: string;
}
/**
* Vip卡每日账单搜索条件
*/
export interface ThinkVipCardsBillsParam extends PageParam {
id?: number;
keywords?: string;
}
+2 -2
View File
@@ -12,6 +12,7 @@
"@types/socket.io-client": "^3.0.0", "@types/socket.io-client": "^3.0.0",
"@vitejs/plugin-vue": "^5.0.5", "@vitejs/plugin-vue": "^5.0.5",
"autoprefixer": "^9.8.8", "autoprefixer": "^9.8.8",
"coordtransform": "^2.1.2",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"dayjs": "^1.11.11", "dayjs": "^1.11.11",
"decimal.js": "^10.4.3", "decimal.js": "^10.4.3",
@@ -28,6 +29,5 @@
"repository": {}, "repository": {},
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"displayName": "websoft-app", "displayName": "websoft-app"
"devDependencies": {}
} }
+1 -1
View File
@@ -7,7 +7,7 @@
<uv-cell :title="`${item.title}`" :label="item.createTime" :cellStyle="{padding: '8px'}" <uv-cell :title="`${item.title}`" :label="item.createTime" :cellStyle="{padding: '8px'}"
:border="false" @click="openUrl('/package/article/detail?id='+item.articleId)"> :border="false" @click="openUrl('/package/article/detail?id='+item.articleId)">
<template v-slot:value> <template v-slot:value>
<uv-image :src="item.image" width="80px" height="80px"></uv-image> <uv-image v-if="item.image" :src="item.image" width="80px" height="80px"></uv-image>
</template> </template>
</uv-cell> </uv-cell>
</uv-cell-group> </uv-cell-group>
+82 -109
View File
@@ -5,62 +5,64 @@
<uv-tabs :list="next7day" :itemStyle="{height: '58px'}" :activeStyle="{ color: '#2ba91c'}" lineColor="#2ba91c" <uv-tabs :list="next7day" :itemStyle="{height: '58px'}" :activeStyle="{ color: '#2ba91c'}" lineColor="#2ba91c"
:inactiveStyle="{ color: '#808080' }" @change="onDateTime"></uv-tabs> :inactiveStyle="{ color: '#808080' }" @change="onDateTime"></uv-tabs>
</uv-sticky> </uv-sticky>
<view class="uni-padding-wrap uni-common-mt"> <template v-if="merchantId !== 37">
<uni-segmented-control :current="current" :values="items" activeColor="#2ba91c" inActiveColor="#ff0000" <view class="uni-padding-wrap uni-common-mt" v-if="fieldList && fieldList.length && fieldList[0].isHalf === 1">
@clickItem="onType"/> <uni-segmented-control :current="current" :values="items" activeColor="#2ba91c" inActiveColor="#ff0000"
@clickItem="onType"/>
</view>
</template>
</view>
<!-- 状态说明 -->
<view class="uni-badge-wrap">
<view class="badge-item">
<uv-badge :isDot="true" type="blank"></uv-badge>
<text class="web-text-secondary">可预约</text>
</view> </view>
<!-- 状态说明 --> <view class="badge-item">
<view class="uni-badge-wrap"> <uv-badge :isDot="true" type="info"></uv-badge>
<view class="badge-item"> <text class="web-text-secondary">已出售</text>
<uv-badge :isDot="true" type="blank"></uv-badge>
<text class="web-text-secondary">可预约</text>
</view>
<view class="badge-item">
<uv-badge :isDot="true" type="info"></uv-badge>
<text class="web-text-secondary">已出售</text>
</view>
<view class="badge-item">
<uv-badge :isDot="true" type="success"></uv-badge>
<text class="web-text-secondary">我的选择</text>
</view>
<view class="badge-item">
<uv-badge :isDot="true" type="warning"></uv-badge>
<text class="web-text-secondary">已预定半场</text>
</view>
</view> </view>
<!-- 场地列表 --> <view class="badge-item">
<view class="checkout-body web-text-primary" v-if="periodList.length > 0"> <uv-badge :isDot="true" type="success"></uv-badge>
<template v-for="(item,index) in periodList" :key="index"> <text class="web-text-secondary">我的选择</text>
<view class="period-item"> </view>
<view class="period">{{ item.timePeriod }}</view> <view class="badge-item">
<view class="field-list"> <uv-badge :isDot="true" type="warning"></uv-badge>
<template v-for="(field,index2) in fieldList" :key="index2"> <text class="web-text-secondary">已预定半场</text>
<view class="field" </view>
:class="isActive(field, item)" </view>
@click="onField(field, item)"> <!-- 场地列表 -->
<text class="field-name">{{ field.name }}</text> <view class="checkout-body web-text-primary" v-if="periodList.length > 0">
<text class="price">{{ item.price }}元</text> <template v-for="(item, index) in periodList" :key="index">
</view> <view class="period-item">
</template> <view class="period">{{ item.timePeriod }}</view>
</view>
</view>
</template>
<!-- 排版样式备份 -->
<view class="period-item" style="display: none;">
<view class="period">18:00 - 20:00</view>
<view class="field-list"> <view class="field-list">
<view class="field web-bg-info"> <template v-for="(field, index2) in fieldList" :key="index2">
<text class="field-name">1号场地</text> <view class="field"
<text class="price">580元</text> :class="isActive(field, item)"
</view> @click="onField(field, item)">
<view class="field web-bg-success active"> <text class="field-name">{{ field.name }}</text>
<text class="field-name">2号场地</text> <text class="price">{{ isHalf !== 1 ? item.price : item.halfPrice }}元</text>
<text class="price">580元</text> </view>
</view> </template>
<view class="field web-bg-warning"> </view>
<text class="field-name">3号场地</text> </view>
<text class="price">580元</text> </template>
</view> <!-- 排版样式备份 -->
<view class="period-item" style="display: none;">
<view class="period">18:00 - 20:00</view>
<view class="field-list">
<view class="field web-bg-info">
<text class="field-name">1号场地</text>
<text class="price">580元</text>
</view>
<view class="field web-bg-success active">
<text class="field-name">2号场地</text>
<text class="price">580元</text>
</view>
<view class="field web-bg-warning">
<text class="field-name">3号场地</text>
<text class="price">580元</text>
</view> </view>
</view> </view>
</view> </view>
@@ -180,7 +182,7 @@ export default {
} }
}, },
onLoad(option) { onLoad(option) {
this.merchantId = option.id this.merchantId = parseInt(option.id)
this.reload(); this.reload();
}, },
onShow() { onShow() {
@@ -194,7 +196,8 @@ export default {
const app = this const app = this
let totalPrice = 0; let totalPrice = 0;
app.selection.map(d => { app.selection.map(d => {
totalPrice = totalPrice + d.price if (app.isHalf === 1) totalPrice += d.halfPrice
else totalPrice += d.price
}) })
carStore.totalPrice = totalPrice carStore.totalPrice = totalPrice
console.log('totalPrice: ', totalPrice); console.log('totalPrice: ', totalPrice);
@@ -256,7 +259,9 @@ export default {
}, },
setDateList() { setDateList() {
this.next7day = [] this.next7day = []
for (let i = 0; i < 7; i++) { let day = 7
if (this.merchantId === 37) day = 7
for (let i = 0; i < day; i++) {
const day = dayjs().add(i, 'day') const day = dayjs().add(i, 'day')
this.next7day.push({ this.next7day.push({
week: day.format('d') === '0' ? '7' : day.format('d'), week: day.format('d') === '0' ? '7' : day.format('d'),
@@ -276,8 +281,14 @@ export default {
this.periodList = [] this.periodList = []
this.timeList.forEach(item => { this.timeList.forEach(item => {
const weekList = JSON.parse(item.week) const weekList = JSON.parse(item.week)
if (weekList.includes(this.week) && dayjs().isBefore(dayjs(this.dateTime + ' ' + item.timePeriod.split(' - ')[0]))) this.periodList.push(item) if (parseInt(this.merchantId) === 37) {
const today = dayjs().format('YYYY-MM-DD')
if (dayjs().isBefore(dayjs(today + ' 21:00:00')) || dayjs(this.dateTime).isAfter(dayjs())) this.periodList.push(item)
} else {
if (weekList.includes(this.week) && dayjs().isBefore(dayjs(this.dateTime + ' ' + item.timePeriod.split(' - ')[0]))) this.periodList.push(item)
}
}) })
// console.log(this.periodList)
}, },
onDisabled() { onDisabled() {
this.disabled = !this.disabled; this.disabled = !this.disabled;
@@ -305,7 +316,7 @@ export default {
}, },
async getFieldList() { async getFieldList() {
if (!this.periodList.length) { if (!this.periodList.length) {
return uni.showToast({ return uni.showToast({
title: '暂无可预订场地', title: '暂无可预订场地',
icon: 'none' icon: 'none'
}) })
@@ -324,53 +335,6 @@ export default {
periodVoList periodVoList
}) })
}, },
getBookingPeriod() {
const {
serverTime,
merchantId
} = this
const now = new Date();
const hours = now.getHours();
const minutes = now.getMinutes()
const week = this.week == 0 ? 7 : this.week
let startTime;
startTime = serverTime.today == this.dateTime ? String(hours) + String(minutes) : undefined
// 游泳馆当前21:30前都可以预定
if (merchantId === '3028' && Number(startTime) < 2130) {
startTime = undefined
}
PeriodApi.listPeriod({
merchantId: this.merchantId,
isStatus: 0,
week,
dateTime: `${this.dateTime}`,
startTime,
half: this.isHalf
}).then(list => {
this.periodList = list;
uni.hideLoading()
}).catch(err => {
this.periodList = [];
uni.showToast({
title: err.message,
icon: 'none'
})
uni.hideLoading()
if (err.message === '您还有未支付订单,请先支付') {
setTimeout(() => {
return uni.switchTab({
url: '/pages/order/order'
});
}, 1000)
}
})
},
callPhone(phone) {
uni.makePhoneCall({
phoneNumber: phone
});
},
openCarInfo() { openCarInfo() {
// this.showCarInfo = !this.showCarInfo; // this.showCarInfo = !this.showCarInfo;
// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center'] // 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
@@ -380,8 +344,11 @@ export default {
this.$refs.popup.close() this.$refs.popup.close()
}, },
onField(field, item) { onField(field, item) {
const timePeriod = item.timePeriod
const checkTimePeriod = field.periodVoList.find(d => (d.period === timePeriod && d.id === item.id))
// console.log('here', field, item)
// 已被预定 // 已被预定
if (field.sold) { if (checkTimePeriod.sold) {
return return
} }
const app = this const app = this
@@ -402,6 +369,7 @@ export default {
}) })
return false return false
} }
// console.log(field)
const split = item.timePeriod.split(' - ') const split = item.timePeriod.split(' - ')
const siteTime = field.periodVoList.find(d => d.period === item.timePeriod) const siteTime = field.periodVoList.find(d => d.period === item.timePeriod)
// 添加到购物车 // 添加到购物车
@@ -412,11 +380,12 @@ export default {
fieldId: field.id, fieldId: field.id,
fieldName: field.name, fieldName: field.name,
price: item.price, price: item.price,
halfPrice: item.halfPrice,
childrenPrice: item.childrenPrice, childrenPrice: item.childrenPrice,
adultNum: 1, adultNum: 1,
childrenNum: 0, childrenNum: 0,
siteName: merchant.name, siteName: merchant.name,
isChildren: item.isChildren, isChildren: 2,
isHalf: this.isHalf, isHalf: this.isHalf,
type: this.type, type: this.type,
timePeriod: item.timePeriod, timePeriod: item.timePeriod,
@@ -428,7 +397,7 @@ export default {
dateTime: `${this.dateTime}`, dateTime: `${this.dateTime}`,
comments: `${this.dateTime}(${getWeek(week)})${item.timePeriod}`, comments: `${this.dateTime}(${getWeek(week)})${item.timePeriod}`,
}) })
console.log(app.selection); // console.log(app.selection);
// console.log('period: ', period); // console.log('period: ', period);
// 是否支持儿童票 // 是否支持儿童票
// console.log('item.isChildren: ', item.isChildren); // console.log('item.isChildren: ', item.isChildren);
@@ -448,7 +417,10 @@ export default {
}, },
isActive(field, item) { isActive(field, item) {
const index = this.selection.find(d => d.key === getKey(`${this.dateTime}${item.timePeriod}${this.merchantId}${field.id}`)) const index = this.selection.find(d => d.key === getKey(`${this.dateTime}${item.timePeriod}${this.merchantId}${field.id}`))
if (item.sold) { const timePeriod = item.timePeriod
const checkTimePeriod = field.periodVoList.find(d => (d.period === timePeriod && d.id === item.id))
// console.log('checkTimePeriod', checkTimePeriod, timePeriod)
if (checkTimePeriod && checkTimePeriod.sold) {
if (item.isHalf === 1) { if (item.isHalf === 1) {
return 'web-bg-warning' return 'web-bg-warning'
} }
@@ -467,6 +439,7 @@ export default {
uni.navigateTo({ uni.navigateTo({
url: '/package/booking/confirm', url: '/package/booking/confirm',
success: (res) => { success: (res) => {
console.log(this.selection)
res.eventChannel.emit('data', this.selection) res.eventChannel.emit('data', this.selection)
} }
}) })
+278 -179
View File
@@ -25,15 +25,8 @@
<uv-cell <uv-cell
:title="`${item.fieldName}`" :title="`${item.fieldName}`"
:label="`${item.dateTime} ${getWeek(this.week)} ${item.timePeriod}`" :label="`${item.dateTime} ${getWeek(this.week)} ${item.timePeriod}`"
:value="form.sid === 37 ? '' : `¥${item.type === 1 ? item.price :item.halfPrice}`"
:cellStyle="{ padding: '10px 5px' }" :cellStyle="{ padding: '10px 5px' }"
v-if="childrenPrice > 0"
></uv-cell>
<uv-cell
:title="`${item.fieldName}`"
:label="`${item.dateTime} ${getWeek(this.week)} ${item.timePeriod}`"
:value="`¥${item.price}`"
:cellStyle="{ padding: '10px 5px' }"
v-else
/> />
<!-- <uv-cell iconStyle="checkbox-mark" :cellStyle="{ padding: '10px 0' }" :border="false" v-if="childrenPrice > 0"> <!-- <uv-cell iconStyle="checkbox-mark" :cellStyle="{ padding: '10px 0' }" :border="false" v-if="childrenPrice > 0">
<template v-slot:title> <template v-slot:title>
@@ -48,34 +41,26 @@
</uv-radio-group> </uv-radio-group>
</template> </template>
</uv-cell> --> </uv-cell> -->
<block v-for="(item,index) in radiolist" :key="index"> <template v-if="form.sid === 37">
<uv-cell iconStyle="checkbox-mark" :cellStyle="{ padding: '10px 5px' }" :border="false" <uv-cell @click="changeIsChildren(2)" iconStyle="checkbox-mark" :title="`成人票 ¥${item.price}`"
v-if="childrenPrice > 0"> :cellStyle="{ padding: '10px 5px' }">
<template v-slot:title> <template v-slot:right-icon>
<view class="flex"> <uv-icon v-if="parseInt(isChildren) === 2" size="30rpx" name="checkbox-mark"></uv-icon>
<span style="margin-right: 40rpx;">{{ item.name }}</span>
<block v-if="item.name === '成人票'">
<span>¥{{ item.price }}</span>
<!-- <span style="padding-left:16rpx;"> x {{ carNum }}张</span> -->
</block>
<block v-if="item.name === '儿童票'">
<span>¥{{ item.price }}</span>
<!-- <span style="padding-left:16rpx;"> x {{ carNum2 }}张</span> -->
</block>
</view>
</template>
<template v-slot:value>
<view v-if="item.name === '成人票'">
<uv-number-box :min="0" :max="1000" v-model="carNum" :disabled="orderId > 0"
@change="onAdultNum"></uv-number-box>
</view>
<view v-if="item.name === '儿童票'">
<uv-number-box :min="0" :max="1000" v-model="carNum2" :disabled="orderId > 0"
@change="onAdultNum2"></uv-number-box>
</view>
</template> </template>
</uv-cell> </uv-cell>
</block> <uv-cell @click="changeIsChildren(1)" iconStyle="checkbox-mark" :title="`儿童票 ¥${item.childrenPrice}`"
:cellStyle="{ padding: '10px 5px' }" :border="false">
<template v-slot:right-icon>
<uv-icon v-if="parseInt(isChildren) === 1" size="30rpx" name="checkbox-mark"></uv-icon>
</template>
</uv-cell>
<uv-cell iconStyle="checkbox-mark" title="人数"
:cellStyle="{ padding: '10px 5px' }" :border="false">
<template v-slot:value>
<uv-number-box v-model="peopleNum" @change="reCalSwimAmount"/>
</template>
</uv-cell>
</template>
</block> </block>
</block> </block>
</uv-cell-group> </uv-cell-group>
@@ -103,7 +88,38 @@
</view> </view>
</view> </view>
</uni-card> </uni-card>
<uni-card :title="`选择会员卡`" :border="false" :is-shadow="false" v-if="form.payType === 2">
<template v-if="vipCard.length > 0">
<uv-cell v-for="(v, vIndex) in vipCard" :key="vIndex"
:title="`${v.name}`"
:label="v.desc"
:cellStyle="{ padding: '20rpx 10rpx', borderRadius: '8rpx', backgroundColor: form.vid === v.id ? '#f6fff1' : '' }"
:border="false"
@click="selectVipCard(v)"
>
<template v-slot:right-icon>
<uv-icon v-if="form.vid === v.id" size="30rpx" name="checkbox-mark"></uv-icon>
</template>
</uv-cell>
</template>
<uv-empty v-else text="暂无可用会员卡"/>
</uni-card>
<uni-card :title="`选择IC卡`" :border="false" :is-shadow="false" v-if="form.payType === 5">
<template v-if="userCard.length > 0">
<uv-cell v-for="(v, vIndex) in userCard" :key="vIndex"
:title="`${v.name}`"
:label="v.desc"
:cellStyle="{ padding: '20rpx 10rpx', borderRadius: '8rpx', backgroundColor: form.code === v.code ? '#f6fff1' : '' }"
:border="false"
@click="selectUserCard(v)"
>
<template v-slot:right-icon>
<uv-icon v-if="form.code === v.code" size="30rpx" name="checkbox-mark"></uv-icon>
</template>
</uv-cell>
</template>
<uv-empty v-else text="暂无可用IC卡"/>
</uni-card>
<view class="xieyi web-cell web-text-secondary web-cell-align-top"> <view class="xieyi web-cell web-text-secondary web-cell-align-top">
<view class="web-cell web-cell-content web-cell-align-top"> <view class="web-cell web-cell-content web-cell-align-top">
<uni-icons type="circle" size="20" color="#a4a5a7" v-if="!disabled" @click="onDisabled"></uni-icons> <uni-icons type="circle" size="20" color="#a4a5a7" v-if="!disabled" @click="onDisabled"></uni-icons>
@@ -161,23 +177,26 @@
<script> <script>
import * as Api from '@/api/shop/order'; import * as Api from '@/api/shop/order';
import * as UserApi from '@/api/booking/users'; import * as UserApi from '@/api/booking/users';
import * as UserCardApi from '@/api/booking/userCard';
import * as PaymentApi from '@/api/system/payment'; import * as PaymentApi from '@/api/system/payment';
import {checkPayPassword} from '@/api/passport/login'; import {checkPayPassword} from '@/api/passport/login';
import {storeToRefs} from 'pinia';
import {cal} from '@/utils/decimal';
import {getWeek, getKey} from '@/utils/common'; import {getWeek, getKey} from '@/utils/common';
import {useCarStore} from '@/store/modules/car';
import {useUserStore} from '@/store/modules/user'; import {useUserStore} from '@/store/modules/user';
import dayjs from "dayjs"; import dayjs from "dayjs";
import {addThinkOrder} from "@/api/think/thinkOrder"; import {addThinkOrder} from "@/api/think/thinkOrder";
import {listUserThinkCard} from "@/api/think/thinkCard"; import {listUserThinkCard} from "@/api/think/thinkCard";
import {listThinkUsersVip} from "@/api/think/thinkUsersVip";
import {number} from "@/uni_modules/uv-ui-tools/libs/function/test";
const userStore = useUserStore(); const userStore = useUserStore();
// const carStore = useCarStore(); // const carStore = useCarStore();
// const { merchantId, merchantCode, orderInfo, period, totalPrice, reducePrice, payPrice, childrenPrice, carNum, carNum2, merchant, type, dateTime } = storeToRefs(carStore); // const { merchantId, merchantCode, orderInfo, period, totalPrice, reducePrice, payPrice, childrenPrice, carNum, carNum2, merchant, type, dateTime } = storeToRefs(carStore);
export default { export default {
computed: {
dayjs() {
return dayjs
}
},
data() { data() {
return { return {
orderId: 0, orderId: 0,
@@ -212,9 +231,12 @@ export default {
cardId: 0, cardId: 0,
getWeek, getWeek,
isLogin: false, isLogin: false,
disabled: false, disabled: true,
cardList: [], cardList: [],
userCard: {}, userCard: [],
allUserCard: [],
vipCard: [],
allVipCard: [],
// isRefresh: true, // isRefresh: true,
// 支付密码是否正确 // 支付密码是否正确
isPayPasswordCorrect: false, isPayPasswordCorrect: false,
@@ -222,23 +244,10 @@ export default {
payPassword: '', payPassword: '',
// 折扣率 // 折扣率
discount: 1, discount: 1,
// 票类型
radiolist: [
{
name: '成人票',
price: 50,
totalPrice: 50,
disabled: false
},
{
name: '儿童票',
price: 35,
totalPrice: 35,
disabled: false
}
],
radiovalue: '成人票', radiovalue: '成人票',
userCardList: [] originPrice: 0,
isChildren: null,
peopleNum: 1,
}; };
}, },
async onLoad() { async onLoad() {
@@ -251,9 +260,12 @@ export default {
const eventChannel = this.getOpenerEventChannel(); const eventChannel = this.getOpenerEventChannel();
const _this = this const _this = this
this.userInfo = await userStore.fetchUserInfo(); this.userInfo = await userStore.fetchUserInfo();
eventChannel.on('data', function (data) { eventChannel.on('data', async (data) => {
_this.list = data _this.list = data
_this.payPrice = data.reduce((a, b) => a + b.price, 0) if (data[0].isHalf === 1) _this.payPrice = data.reduce((a, b) => a + b.halfPrice, 0)
else _this.payPrice = data.reduce((a, b) => a + b.price, 0)
_this.originPrice = JSON.parse(JSON.stringify(_this.payPrice))
const thinkOrderInfos = [] const thinkOrderInfos = []
data.forEach(item => { data.forEach(item => {
const [startTime, endTime] = item.timePeriod.split(' - ') const [startTime, endTime] = item.timePeriod.split(' - ')
@@ -276,6 +288,7 @@ export default {
name: _this.userInfo.realName, name: _this.userInfo.realName,
phone: _this.userInfo.phone, phone: _this.userInfo.phone,
sid: data[0].sid, sid: data[0].sid,
fid: data[0].fieldId,
cid: null, cid: null,
vid: null, vid: null,
code: null, code: null,
@@ -284,9 +297,14 @@ export default {
startTime: thinkOrderInfos.map(item => item.startTime).join() startTime: thinkOrderInfos.map(item => item.startTime).join()
} }
}) })
_this.isChildren = data[0].isChildren
// console.log(data)
// console.log(this.isChildren)
await this.getPayment()
await this.getUserCard()
await this.getUserVipCard()
console.log(this.form)
}) })
await this.getPayment()
await this.getUserCard()
}, },
async onShow() { async onShow() {
this.userInfo = await userStore.fetchUserInfo(); this.userInfo = await userStore.fetchUserInfo();
@@ -365,12 +383,19 @@ export default {
} }
// 请求数据 // 请求数据
app.userCard = []
Promise.all([app.getUserCard(), app.getPayment()]).then((res) => { Promise.all([app.getUserCard(), app.getPayment()]).then((res) => {
const userCard = res[0]; const userCard = res[0];
const payment = res[1]; const payment = res[1];
// 当前可用会员卡 // 当前可用会员卡
app.userCard = userCard; if (userCard.length > 0) {
app.userCard = userCard.filter(card => {
const sid = card.sid.split(',');
return sid.includes(res[0].sid)
});
if (app.userCard.length > 0) app.form.vid = app.userCard[0].id;
}
// 支付方式列表 // 支付方式列表
app.payment = payment.map((d) => { app.payment = payment.map((d) => {
if (d.type == 0) { if (d.type == 0) {
@@ -390,48 +415,131 @@ export default {
const res = await listUserThinkCard() const res = await listUserThinkCard()
if (res.length) { if (res.length) {
this.userCard = res this.userCard = res
// if (this.userCard) { if (this.userCard.length > 0) {
// // 整理表单字段 this.userCard = this.userCard.filter(card => {
// form.cardId = userCard.id; const sid = card.sid.split(',').map(Number);
// form.payType = 2; return sid.includes(parseInt(this.form.sid))
// app.payType = 2; });
// this.allUserCard = JSON.parse(JSON.stringify(this.userCard))
// // 1年卡 this.allUserCard = this.allUserCard.map(item => {
// if (userCard.type == 1) { item.desc += `${dayjs(item.expireTime * 1000).format('YYYY-MM-DD HH:mm:ss')}过期`
// } if (item.type === 2) item.desc += `,剩余${item.num}次`
// else if (item.type === 5) item.desc += `,剩余${item.remainingMoney}元`
// // 2次卡 return item
// if (userCard.type == 2) { })
// } const newList = []
// for (let i = 0; i < this.allUserCard.length; i++) {
// // 3月卡 const item = this.allUserCard[i]
// if (userCard.type == 3) { if (item.type === 2) {
// } if (item.num > 0) newList.push(item)
// } else if (item.type === 5) {
// // 4会员IC卡 if (item.remainingMoney > 0) newList.push(item)
// if (userCard.type == 2) { } else newList.push(item)
// } }
// // 5充值卡 this.allUserCard = JSON.parse(JSON.stringify(newList))
// if (userCard.type == 5) { this.makeUserCardList()
// // 折扣率 }
// app.discount = cal.cheng(userCard.discount, 0.1); }
// },
// // 订单金额 makeUserCardList() {
// const orderPrice = totalPrice || form.totalPrice; this.userCard = this.allUserCard.filter(item => dayjs(item.expireTime * 1000).isAfter(dayjs()))
// if (orderPrice) { if (this.isChildren === 2) {
// console.log('orderPrice: ', orderPrice); this.userCard = this.userCard.filter(item => item.cardType !== 2)
// // 折后金额 } else {
// const lastTotalPrice = cal.cheng(orderPrice, app.discount); this.userCard = this.userCard.filter(item => item.cardType === 2)
// console.log('折后金额: ', lastTotalPrice); }
// // 减少的金额
// app.reducePrice = cal.jian(orderPrice, lastTotalPrice); if (this.userCard.length) {
// console.log('减少的金额: ', app.reducePrice); this.userCard.sort((a, b) => a.type - b.type)
// // 实付额 this.form.payType = 5
// app.payPrice = orderPrice * app.discount; this.form.vid = null
// console.log('实付额: ', app.payPrice); let card = null
// } for (let i = 0; i < this.userCard.length; i++) {
// } const item = this.userCard[i]
// } if (item.type === 1) {
this.form.code = item.code
card = item
break
}
if (item.type === 3) {
this.form.code = item.code
card = item
break
}
if (item.type === 2) {
this.form.code = item.code
card = item
break
}
this.form.code = item.code
card = item
break
}
if (card) this.selectUserCard(card)
}
},
async getUserVipCard() {
const res = await listThinkUsersVip()
if (res.length) {
// this.vipCard = res
this.vipCard = res.filter(card => {
const sid = card.sid.split(',').map(Number);
return sid.includes(parseInt(this.form.sid))
});
this.allVipCard = JSON.parse(JSON.stringify(this.vipCard))
this.allVipCard = this.allVipCard.map(item => {
item.desc += `,${dayjs(item.expireTime * 1000).format('YYYY-MM-DD HH:mm:ss')}过期`
if (item.type === 2) item.desc += `,剩余${item.num}次`
else if (item.type === 5) item.desc += `,剩余${item.remainingMoney}元`
return item
})
const newList = []
for (let i = 0; i < this.allVipCard.length; i++) {
const item = this.allVipCard[i]
if (item.type === 2) {
if (item.num > 0) newList.push(item)
} else if (item.type === 5) {
if (item.remainingMoney > 0) newList.push(item)
} else newList.push(item)
}
this.allVipCard = JSON.parse(JSON.stringify(newList))
this.makeUserVipCardList()
}
},
makeUserVipCardList() {
this.vipCard = this.allVipCard.filter(item => dayjs(item.expireTime * 1000).isAfter(dayjs()))
if (this.isChildren === 2) {
this.vipCard = this.vipCard.filter(item => item.cardType !== 2)
} else {
this.vipCard = this.vipCard.filter(item => item.cardType === 2)
}
if (this.vipCard.length) {
this.vipCard.sort((a, b) => a.type - b.type)
this.form.payType = 2
this.form.code = null
let card = null
for (let i = 0; i < this.vipCard.length; i++) {
const item = this.vipCard[i]
if (item.type === 1) {
card = item
this.form.vid = item.id
break
}
if (item.type === 3) {
card = item
this.form.vid = item.id
break
}
if (item.type === 2) {
card = item
this.form.vid = item.id
break
}
card = item
this.form.vid = item.id
break
}
if (card) this.selectVipCard(card)
} }
}, },
// 读取支付方式列表 // 读取支付方式列表
@@ -448,21 +556,14 @@ export default {
}, },
// 切换支付方式 // 切换支付方式
async onPayType(index) { async onPayType(index) {
const app = this;
const {form, totalPrice, carNum, childrenPrice, radiovalue} = this;
// app.payType = index; // app.payType = index;
app.form.payType = index; this.form.payType = index;
app.form.cardId = 0; this.form.vid = null
this.form.code = null
console.log('childrenPrice: ', childrenPrice); this.reducePrice = 0
if (this.form.sid !== 37) this.payPrice = this.originPrice
// 重新总金额 if (this.form.payType === 2) this.makeUserVipCardList()
app.payPrice = 0; if (this.form.payType === 5) this.makeUserCardList()
app.reducePrice = 0;
await app.countTotalPrice()
if (index === 2) {
await app.reload();
}
}, },
openUrl(url) { openUrl(url) {
if (!this.isLogin) { if (!this.isLogin) {
@@ -506,38 +607,6 @@ export default {
this.disabledPayPayPassword = false; this.disabledPayPayPassword = false;
}); });
}, },
onAdultNum(e) {
const app = this;
const index = e.value;
app.carNum = index;
app.orderInfo[0].adultNum = index;
// 重新总金额
app.countTotalPrice()
},
onAdultNum2(e) {
const app = this;
const index = e.value;
app.carNum2 = index;
app.orderInfo[0].childrenNum = index;
// 重新总金额
app.countTotalPrice()
},
// 重新计算金额
countTotalPrice() {
// const app = this
// // 计算总金额
// let total;
// const prices = [];
// app.orderInfo.map(d => {
// prices.push(d.price * d.adultNum + d.childrenPrice * d.childrenNum);
// })
// // 使用reduce方法进行累加
// const sum = prices.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
// console.log(sum);
// app.totalPrice = sum
// app.payPrice = sum
},
save() { save() {
const app = this; const app = this;
const {form} = this; const {form} = this;
@@ -555,9 +624,16 @@ export default {
}); });
return false; return false;
} }
if (form.payType === 2 && !app.userCard) { if (form.payType === 2 && !app.form.vid) {
uni.showToast({ uni.showToast({
title: '没有找到可用的会员卡', title: '请选择会员卡',
icon: 'none'
});
return false;
}
if (form.payType === 5 && !app.form.code) {
uni.showToast({
title: '请选择IC卡',
icon: 'none' icon: 'none'
}); });
return false; return false;
@@ -570,8 +646,19 @@ export default {
uni.showLoading({ uni.showLoading({
title: '订单提交中.' title: '订单提交中.'
}); });
form.thinkOrderInfos = form.thinkOrderInfos.map(item => {
item.isChildren = app.isChildren
if (form.sid === 37) {
if (app.isChildren === 1) {
item.adultNum = 0
item.childrenNum = this.peopleNum
} else if (app.isChildren === 2) {
item.adultNum = this.peopleNum
item.childrenNum = 0
}
}
return item
})
addThinkOrder(form) addThinkOrder(form)
.then((data) => { .then((data) => {
const orderInfo = data; const orderInfo = data;
@@ -608,13 +695,8 @@ export default {
fail: function (err) { fail: function (err) {
console.log('支付失败', err); console.log('支付失败', err);
app.disabled = false; app.disabled = false;
uni.reLaunch({ uni.switchTab({
url: '/pages/order/order', url: '/pages/order'
success: function (e) {
var page = getCurrentPages()[0];
if (page == undefined || page == null) return;
page.onLoad();
}
}); });
// uni.switchTab({ // uni.switchTab({
// url: '/pages/order/order' // url: '/pages/order/order'
@@ -639,20 +721,13 @@ export default {
setTimeout(function () { setTimeout(function () {
app.disabled = false; app.disabled = false;
app.$refs.payPasswordForm.close(); app.$refs.payPasswordForm.close();
uni.reLaunch({ uni.switchTab({url: '/pages/order'})
url: '/pages/order/order',
success: function (e) {
var page = getCurrentPages()[0];
if (page == undefined || page == null) return;
page.onLoad();
}
});
}, 1500); }, 1500);
} }
} }
// 使用会员卡支付 // 使用会员卡支付
if (form.payType === 2) { if (form.payType === 2 || form.payType === 5) {
if (!orderInfo) { if (!orderInfo) {
return uni.showToast({ return uni.showToast({
title: '支付失败', title: '支付失败',
@@ -666,18 +741,10 @@ export default {
}); });
setTimeout(function () { setTimeout(function () {
app.disabled = false; app.disabled = false;
uni.reLaunch({ uni.switchTab({url: '/pages/order'})
url: '/pages/order/order',
success: function (e) {
var page = getCurrentPages()[0];
if (page == undefined || page == null) return;
page.onLoad();
}
});
}, 1500); }, 1500);
} }
} }
uni.hideLoading(); uni.hideLoading();
}) })
.catch((res) => { .catch((res) => {
@@ -687,6 +754,38 @@ export default {
}); });
uni.hideLoading(); uni.hideLoading();
}); });
},
selectVipCard(card) {
this.form.vid = card.id;
this.reCalAmount(card)
},
selectUserCard(card) {
this.form.code = card.code;
this.reCalAmount(card)
},
reCalAmount(card) {
// 余额折扣卡
if (card.type === 5) {
this.reducePrice = this.originPrice * (1 - (card.discount / 10))
this.reducePrice = parseFloat(this.reducePrice.toFixed(2))
this.payPrice = this.originPrice - this.reducePrice
this.payPrice = parseFloat(this.payPrice.toFixed(2))
} else {
this.reducePrice = this.originPrice
this.payPrice = 0
}
},
changeIsChildren(val) {
this.isChildren = val
this.reCalSwimAmount({value: this.peopleNum})
this.makeUserCardList()
this.makeUserVipCardList()
},
reCalSwimAmount({value}) {
this.peopleNum = value
if (this.isChildren === 2) this.payPrice = this.list.reduce((a, b) => a + b.price, 0)
else this.payPrice = this.list.reduce((a, b) => a + b.childrenPrice, 0)
this.payPrice = this.payPrice * this.peopleNum
} }
} }
}; };
+84 -27
View File
@@ -32,32 +32,32 @@
<uni-card title="场地介绍" :is-shadow="false" :border="false" :padding="0"> <uni-card title="场地介绍" :is-shadow="false" :border="false" :padding="0">
<view class="web-text-heading booking-content"> <view class="web-text-heading booking-content">
<view v-html="merchant.content"></view> <uv-parse :content="merchant.info"></uv-parse>
</view> </view>
</uni-card> </uni-card>
<view class="xieyi web-cell web-text-secondary web-cell-align-top"> <!-- <view class="xieyi web-cell web-text-secondary web-cell-align-top">-->
<view class="web-cell web-cell-content web-cell-align-top"> <!-- <view class="web-cell web-cell-content web-cell-align-top">-->
<uni-icons type="circle" size="20" color="#a4a5a7" v-if="!disabled" @click="onDisabled"></uni-icons> <!-- <uni-icons type="circle" size="20" color="#a4a5a7" v-if="!disabled" @click="onDisabled"></uni-icons>-->
<uni-icons type="checkbox" size="20" color="#11a954" v-else @click="onDisabled"></uni-icons> <!-- <uni-icons type="checkbox" size="20" color="#11a954" v-else @click="onDisabled"></uni-icons>-->
<view class="text" @click="onDisabled"> <!-- <view class="text" @click="onDisabled">-->
<text>我已阅读并同意</text> <!-- <text>我已阅读并同意</text>-->
<text class="link" <!-- <text class="link"-->
@click.stop="navTo('/package/article/detail?articleId=503')">《订票协议》 <!-- @click.stop="navTo('/package/article/detail?articleId=503')">《订票协议》-->
</text> <!-- </text>-->
</view> <!-- </view>-->
</view> <!-- </view>-->
</view> <!-- </view>-->
<view class="save-btn"> <view class="save-btn">
<uv-button <uv-button
:customStyle="{background: 'linear-gradient(to right, #ccff66, #008e04)',borderRadius: '30px',color: '#ffffff'}" :customStyle="{background: 'linear-gradient(to right, #ccff66, #008e04)',borderRadius: '30px',color: '#ffffff'}"
text="预定场地" @click="save"></uv-button> text="预定场地" @click="openProtocol"></uv-button>
</view> </view>
</view> </view>
<uv-gap height="50"></uv-gap> <uv-gap height="50"></uv-gap>
<view class="booking-tel" @click="openBookingTel">活动订场</view> <view class="booking-tel" @click="openBookingTel">场地咨询</view>
<!-- 活动订场弹窗 --> <!-- 活动订场弹窗 -->
<uni-popup ref="popup" type="center"> <uni-popup ref="popup" type="center">
<view class="popup-booking-tel"> <view class="popup-booking-tel">
@@ -82,6 +82,19 @@
</uni-popup> </uni-popup>
<!-- 登录组件 --> <!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/> <ws-login ref="login" :logo="logo" @done="reload"/>
<uv-popup ref="protocolPopup" mode="center" round="15" :closeOnClickOverlay="true" :safe-area-inset-bottom="false">
<view v-if="protocol">
<view class="p-30" style="width: 80vw; max-height: 80vh; overflow-y: scroll">
<uv-parse :content="protocol.content"></uv-parse>
</view>
<view class="p-30">
<uv-button type="primary" shape="circle" :disabled="countDown > 0" @click="save">{{
countDown > 0 ? `${countDown}秒后继续` : '已知晓并同意订票协议'
}}
</uv-button>
</view>
</view>
</uv-popup>
</template> </template>
<script> <script>
@@ -92,6 +105,8 @@ import {getThinkSite, getThinkSiteWithDistance} from "@/api/think/thinkSite";
import {getLocationAction} from "@/utils"; import {getLocationAction} from "@/utils";
import request from "@/utils/request"; import request from "@/utils/request";
import X2js from 'x2js'; import X2js from 'x2js';
import {getArticle, pageArticle} from "@/api/cms/article";
import coordtransform from "coordtransform";
const carStore = useCarStore(); const carStore = useCarStore();
@@ -107,6 +122,9 @@ export default {
disabled: true, disabled: true,
lat: null, lat: null,
lng: null, lng: null,
protocol: null,
countDown: 0,
timer: null,
} }
}, },
async onLoad(option) { async onLoad(option) {
@@ -115,6 +133,7 @@ export default {
const {longitude, latitude} = await getLocationAction() const {longitude, latitude} = await getLocationAction()
this.lat = latitude this.lat = latitude
this.lng = longitude this.lng = longitude
await this.getProtocol()
await this.reload(); await this.reload();
}, },
onShow() { onShow() {
@@ -124,6 +143,32 @@ export default {
} }
}, },
methods: { methods: {
async getProtocol() {
const res = await getArticle(503)
console.log(res)
if (res) {
this.protocol = res
}
},
openProtocol() {
if (this.timer) {
clearInterval(this.timer)
this.timer = null
}
this.countDown = 5
this.setTimer()
this.$refs.protocolPopup.open()
},
setTimer() {
this.timer = setInterval(() => {
this.countDown--
if (this.countDown <= 0) {
clearInterval(this.timer)
this.timer = null
this.countDown = 0
}
}, 1000)
},
async reload() { async reload() {
const app = this const app = this
@@ -175,9 +220,12 @@ export default {
}) })
}, },
mapTo(item) { mapTo(item) {
const latitude = item.lat;
const longitude = item.lng;
const [lng, lat] = coordtransform.wgs84togcj02(longitude, latitude)
uni.openLocation({ uni.openLocation({
latitude: parseFloat(item.lat), latitude: lat,
longitude: parseFloat(item.lng), longitude: lng,
success: function () { success: function () {
console.log('success'); console.log('success');
} }
@@ -202,9 +250,10 @@ export default {
console.log('返回可以用于uni.openLocation的经纬度: ', res); console.log('返回可以用于uni.openLocation的经纬度: ', res);
const latitude = this.merchant.lat; const latitude = this.merchant.lat;
const longitude = this.merchant.lng; const longitude = this.merchant.lng;
const [lng, lat] = coordtransform.wgs84togcj02(longitude, latitude)
uni.openLocation({ uni.openLocation({
latitude: latitude, latitude: lat,
longitude: longitude, longitude: lng,
success: function () { success: function () {
console.log('success'); console.log('success');
} }
@@ -213,18 +262,26 @@ export default {
}); });
}, },
save() { save() {
if (!this.disabled) { // if (!this.disabled) {
uni.showToast({ // uni.showToast({
title: '请先阅读并同意订票协议', // title: '请先阅读并同意订票协议',
icon: 'none' // icon: 'none'
}) // })
return false // return false
} // }
if (this.timer) clearTimeout(this.timer)
this.$refs.protocolPopup.close()
uni.navigateTo({ uni.navigateTo({
url: '/package/booking/checkout?id=' + this.id url: '/package/booking/checkout?id=' + this.id
}) })
} }
} },
onHide() {
if (this.timer) clearTimeout(this.timer)
},
onUnload() {
if (this.timer) clearTimeout(this.timer)
},
} }
</script> </script>
<style> <style>
+50 -93
View File
@@ -1,51 +1,40 @@
<template> <template>
<layout @done="onLayout"> <view>
<uv-empty :show="cart.totalNums === 0" mode="car" class="none" <uv-empty :show="cart.length === 0" mode="car" class="none"
icon="https://cdn.uviewui.com/uview/empty/car.png"></uv-empty> icon="https://cdn.uviewui.com/uview/empty/car.png"></uv-empty>
<uni-card :border="false" :padding="0" v-if="cart.length">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff', marginBottom: '20px'}" :border="false">
<block v-for="(item,index) in cart.shops" :key="index"> <uv-cell v-for="(cart, index) in cart" :cellStyle="{padding: '12px 6px'}" :border="false" :key="index">
<uni-card :border="false" :padding="0"> <template v-slot:icon>
<template v-slot:title> <uv-avatar v-if="cart.selected" src="https://oss.wsdns.cn/20240723/cc887e4a1cd749ebb5a1cfa2484c01f2.png"
<view class="title-bar flex items-center"> size="16" @click="onSelected(cart)"></uv-avatar>
<uv-avatar :src="item.shopLogo" size="24"></uv-avatar> <uv-avatar v-else src="https://oss.wsdns.cn/20240723/2f9ae761ebb343fcbcaccd7441c88e20.png" size="16"
<view class="title ml-1">{{ item.shopName }}</view> @click="onSelected(cart)"></uv-avatar>
</view> </template>
</template> <template v-slot:title>
<!-- <view class="preferential web-text-secondary">满2件总价9折,还差 1 件</view>--> <view class="goods-title flex items-center w-full">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff', marginBottom: '20px'}" :border="false"> <uv-image
<uv-cell v-for="(cart,index2) in item.carts" :cellStyle="{padding: '12px 6px'}" :border="false"> :src="cart.image"
<template v-slot:icon> width="120rpx" height="120rpx" radius="5"/>
<uv-avatar v-if="cart.selected" src="https://oss.wsdns.cn/20240723/cc887e4a1cd749ebb5a1cfa2484c01f2.png" <view class="goods-info flex flex-col justify-between w-75p">
size="16" @click="onSelected(cart)"></uv-avatar> <view class="goods-name">
<uv-avatar v-else src="https://oss.wsdns.cn/20240723/2f9ae761ebb343fcbcaccd7441c88e20.png" size="16" <uv-text :lines="1" bold :text="cart.goodsName"></uv-text>
@click="onSelected(cart)"></uv-avatar> <uv-text v-if="cart.spec" class="py-2" type="info" :text="cart.spec" suffixIcon="arrow-down"
</template> :iconStyle="{marginLeft: '8px', fontSize: '10px'}" @click="openCarInfo"></uv-text>
<template v-slot:title> </view>
<view class="goods-title flex items-center w-full"> <view class="goods-price flex justify-between mt-15">
<uv-image <view class="price text-red-500">¥{{ cart.price }}</view>
:src="cart.image" <view class="tool-btn">
width="80" height="80" radius="5"/> <uv-number-box :min="0" :max="1000" v-model="cart.cartNum"
<view class="goods-info flex w-full flex-col justify-between"> @change="onAdultNum(cart,index)"></uv-number-box>
<view class="goods-name">
<uv-text :lines="1" bold :text="cart.goodsName"></uv-text>
<uv-text v-if="cart.spec" class="py-2" type="info" :text="cart.spec" suffixIcon="arrow-down"
:iconStyle="{marginLeft: '8px', fontSize: '10px'}" @click="openCarInfo"></uv-text>
</view>
<view class="goods-price flex justify-between">
<view class="price text-red-500">¥{{ cart.price }}</view>
<view class="tool-btn">
<uv-number-box :min="0" :max="1000" v-model="cart.cartNum"
@change="onAdultNum(cart,index)"></uv-number-box>
</view>
</view> </view>
</view> </view>
</view> </view>
</template> </view>
</uv-cell> </template>
</uv-cell-group> </uv-cell>
</uni-card> </uv-cell-group>
</block> </uni-card>
<uv-gap height="100"></uv-gap> <uv-gap height="100"></uv-gap>
@@ -53,13 +42,13 @@
:style="'bottom: ' + bottom + 'px;'"> :style="'bottom: ' + bottom + 'px;'">
<view class="flex flex-row items-center ml-15" @click="onSelectAll"> <view class="flex flex-row items-center ml-15" @click="onSelectAll">
<uv-avatar src="https://oss.wsdns.cn/20240723/2f9ae761ebb343fcbcaccd7441c88e20.png" <uv-avatar src="https://oss.wsdns.cn/20240723/2f9ae761ebb343fcbcaccd7441c88e20.png"
v-if="cart.totalNums !== cart.selectNums" v-if="cart.length !== selectNums"
size="16"></uv-avatar> size="16"></uv-avatar>
<uv-avatar src="https://oss.wsdns.cn/20240723/cc887e4a1cd749ebb5a1cfa2484c01f2.png" v-else <uv-avatar src="https://oss.wsdns.cn/20240723/cc887e4a1cd749ebb5a1cfa2484c01f2.png" v-else
size="16"></uv-avatar> size="16"></uv-avatar>
<text class="ml-10 text-22">全选</text> <text class="ml-10 text-22">全选</text>
<view class="text-22 flex flex-col text-red-500 ml-15 items-center" <view class="text-22 flex flex-col text-red-500 ml-15 items-center"
v-if="cart.totalNums === cart.selectNums" @click="onRemove">清空购物车 v-if="cart.length !== selectNums" @click="onRemove">清空购物车
</view> </view>
</view> </view>
<view class="price-bar flex flex-row items-center"> <view class="price-bar flex flex-row items-center">
@@ -68,12 +57,12 @@
<text class="web-text-heading text-22">合计:</text> <text class="web-text-heading text-22">合计:</text>
<text class="text-22 web-text-danger">¥</text> <text class="text-22 web-text-danger">¥</text>
<uv-count-to :startVal="0" decimals="2" duration="100" color="#ff0000" bold <uv-count-to :startVal="0" decimals="2" duration="100" color="#ff0000" bold
:endVal="cart.totalPrice"></uv-count-to> :endVal="totalPrice"></uv-count-to>
</view> </view>
<!-- <text class="text-red-500 text-22 text-right">已优惠¥0.00</text>--> <!-- <text class="text-red-500 text-22 text-right">已优惠¥0.00</text>-->
</view> </view>
<view class="go-buy mr-15"> <view class="go-buy mr-15">
<uv-button :text="`去结算(${cart?.selectNums ? cart.selectNums : 0})`" <uv-button :text="`去结算`"
:customStyle="{background: 'linear-gradient(to right, #f5a4a4, #ff0000)',borderRadius: '30px',color: '#ffffff', padding: '0 30px'}" :customStyle="{background: 'linear-gradient(to right, #f5a4a4, #ff0000)',borderRadius: '30px',color: '#ffffff', padding: '0 30px'}"
@click="save"></uv-button> @click="save"></uv-button>
</view> </view>
@@ -95,7 +84,7 @@
</uv-cell-group> </uv-cell-group>
</uni-card> </uni-card>
</uni-popup> </uni-popup>
</layout> </view>
</template> </template>
<script> <script>
@@ -146,7 +135,6 @@ export default {
isRefresh: false, isRefresh: false,
isLogin: false, isLogin: false,
userId: 0, userId: 0,
config: {},
isNew, isNew,
canReset: false, canReset: false,
loadMore: 'more', loadMore: 'more',
@@ -170,11 +158,11 @@ export default {
styleType: 'text', styleType: 'text',
getWeek, getWeek,
// 骨架屏 // 骨架屏
hideTools: true hideTools: true,
selectNums: 0,
totalPrice: 0,
} }
}, },
onLoad() {
},
onShow() { onShow() {
this.reload(); this.reload();
}, },
@@ -207,10 +195,6 @@ export default {
app.bottom = 0; app.bottom = 0;
// #endif // #endif
// 获取小程序信息包
const info = await mpStore.fetchMpInfo();
// 配置信息
app.config = info.config
// 登录状态 // 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) { if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
app.isLogin = true; app.isLogin = true;
@@ -222,18 +206,21 @@ export default {
app.loadMore = 'loading' app.loadMore = 'loading'
// 加载购物车数据 // 加载购物车数据
this.selectNums = 0
CartApi.listCart(where).then(data => { CartApi.listCart(where).then(data => {
if(data){ if (data) {
app.cart = data app.cart = data.map(item => {
if (item.selected) {
this.selectNums += 1
this.totalPrice += parseFloat((item.price * item.cartNum).toFixed(2))
}
return item
})
} }
}).finally(() => { }).finally(() => {
app.loadMore = 'more' app.loadMore = 'more'
uni.hideLoading() uni.hideLoading()
}) })
},
onLayout({mpMenus}) {
this.mpMenus = mpMenus;
}, },
openUrl(url) { openUrl(url) {
uni.navigateTo({ uni.navigateTo({
@@ -277,27 +264,12 @@ export default {
}, },
// 弹出登录提示框 // 弹出登录提示框
async openLogin() { async openLogin() {
// 当前租户信息
const info = await mpStore.fetchMpInfo();
// 配置信息
this.config = info.config
this.userId = uni.getStorageSync('user_id'); this.userId = uni.getStorageSync('user_id');
if (!this.userId) { if (!this.userId) {
this.$refs.login.open('bottom') this.$refs.login.open('bottom')
return false; return false;
} }
}, },
// 申请开票
onInvoice(id) {
uni.navigateTo({
url: '/package/user/invoice?id=' + id
})
},
showInvoice(id) {
uni.navigateTo({
url: `/package/user/invoice-show?id=${id}`
})
},
openCarInfo() { openCarInfo() {
this.$refs.popup.open('bottom') this.$refs.popup.open('bottom')
}, },
@@ -338,23 +310,15 @@ export default {
}); });
}, },
onRemove() { onRemove() {
const {shops} = this.cart CartApi.removeBatchCart(this.cart.map(d => d.id)).then(res => {
CartApi.removeBatchCart(shops[0]?.carts?.map(d => d.id)).then(res => {
uni.showToast({ uni.showToast({
title: '删除成功', title: '删除成功',
icon: 'success', icon: 'success',
}) })
this.shops = [] this.shops = []
// 更新购物车角标
uni.removeTabBarBadge({
index: 2
})
}); });
}, },
save() { save() {
// if (this.shops.length === 0) {
// return false
// }
uni.redirectTo({url: `/package/goods/checkout?selected=true&isNew=false`}) uni.redirectTo({url: `/package/goods/checkout?selected=true&isNew=false`})
} }
} }
@@ -362,13 +326,6 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.admin-tools {
width: 700rpx;
margin: 20rpx auto;
padding: 0 16rpx;
font-size: 24rpx;
}
.title-bar { .title-bar {
padding: 20rpx 10rpx; padding: 20rpx 10rpx;
} }
+188 -269
View File
@@ -1,100 +1,64 @@
<template> <template>
<view class="container"> <view class="container">
<uni-card :border="false" :is-shadow="false"> <uni-card :border="false" :padding="10">
<view class="delivery flex justify-between items-center bg-white m-a p-10"> <uv-cell-group :customStyle="{backgroundColor: '#ffffff', marginBottom: '20px'}" :border="false">
<uv-button :customStyle="{ borderRadius: '30px', backgroundColor: `${deliveryType === 0 ? '#ff0000' : '#c9c9c9'}`, color: '#ffffff', padding: '0rpx 80rpx' }" :text="'快递配送'" @click="onDeliveryType(0)"></uv-button> <uv-cell v-for="(cart, index) in carts" :cellStyle="{padding: '12px 0'}" :border="false" :index="index">
<uv-button :customStyle="{ borderRadius: '30px', backgroundColor: `${deliveryType === 0 ? '#c9c9c9' : '#ff0000'}`, color: '#ffffff', padding: '0rpx 80rpx' }" :text="'上门自提'" @click="onDeliveryType(1)"></uv-button> <template v-slot:title>
</view> <view class="goods-title flex items-center w-full">
</uni-card> <uv-image
:src="cart.image"
<uni-card :border="false" :is-shadow="false" v-if="address.name"> width="80" height="80" radius="5"/>
<uv-cell <view class="goods-info flex flex-col justify-between w-75p">
v-if="deliveryType === 0" <view class="goods-name">
:title="`${address.name} &nbsp; ${address.phone}`" <uv-text :lines="1" bold :text="cart.goodsName"></uv-text>
:label="`${address.address}`" <uv-text v-if="cart.spec" class="py-2 text-20" type="info" :text="cart.spec" suffixIcon="arrow-down"
icon="map" :iconStyle="{marginLeft: '8px', fontSize: '10px'}"></uv-text>
:cellStyle="{ padding: '5px 0' }" </view>
:border="false" <view class="goods-price flex justify-between">
@click="openAddressList" <view class="price text-red-500">¥{{ cart.price }}/{{ cart.goods.maxIntegral }}积分</view>
> <view class="tool-btn web-text-secondary">
<template v-slot:right-icon> x {{ cart.cartNum }}
<uv-icon name="arrow-right"></uv-icon>
</template>
</uv-cell>
<uv-cell
v-if="deliveryType === 1"
:title="`${cart.shops[0].shopName}`"
:label="`${cart.shops[0].address}`"
icon="map"
:cellStyle="{ padding: '5px 0' }"
:border="false"
>
<template v-slot:right-icon>
<uv-icon name="arrow-right"></uv-icon>
</template>
</uv-cell>
</uni-card>
<block v-for="(item,index) in cart.shops">
<uni-card :border="false" :padding="10">
<template v-slot:title>
<view class="mt-20 flex items-center">
<uv-avatar :src="item.shopLogo" size="22"></uv-avatar>
<view class="title ml-2">{{ item.shopName }}</view>
</view>
</template>
<!-- <view class="preferential web-text-secondary">满2件总价9折,还差 1 件</view>-->
<uv-cell-group :customStyle="{backgroundColor: '#ffffff', marginBottom: '20px'}" :border="false">
<uv-cell v-for="(cart,index2) in item.carts" :cellStyle="{padding: '12px 0'}" :border="false">
<template v-slot:title>
<view class="goods-title flex items-center w-full">
<uv-image
:src="cart.image"
width="80" height="80" radius="5"/>
<view class="goods-info flex w-full flex-col justify-between">
<view class="goods-name">
<uv-text :lines="1" bold :text="cart.goodsName"></uv-text>
<uv-text class="py-2 text-20" type="info" :text="cart.spec || '无规格'" suffixIcon="arrow-down"
:iconStyle="{marginLeft: '8px', fontSize: '10px'}"></uv-text>
</view>
<view class="goods-price flex justify-between">
<view class="price text-red-500">¥{{ cart.price }}</view>
<view class="tool-btn web-text-secondary">
x {{ cart.cartNum }}
</view>
</view> </view>
</view> </view>
</view> </view>
</template> </view>
</uv-cell> </template>
</uv-cell-group> </uv-cell>
</uni-card> </uv-cell-group>
</block> </uni-card>
<uni-card title="选择支付方式" :border="false" :is-shadow="false"> <uni-card title="选择支付方式" :border="false" :is-shadow="false">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false"> <uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<block v-for="(item, index) in payment" :key="index"> <uv-cell
<uv-cell title="微信支付"
:title="`${item.name}`" icon="https://oss.wsdns.cn/20240511/8d7af0f0374040cb9b9255eff5fb812d.png?x-oss-process=image/resize,m_fixed,w_100,h_100/quality,Q_90"
:icon="`${item.image}`" :cellStyle="{ padding: '20rpx 10rpx', borderRadius: '8rpx', backgroundColor: 1 === payType ? '#f6fff1' : '' }"
:cellStyle="{ padding: '20rpx 10rpx', borderRadius: '8rpx', backgroundColor: item.type === payType ? '#f6fff1' : '' }" :border="false"
:border="false" @click="onPayType(1)"
@click="onPayType(item.type)" >
> 微信支付
{{ item.type }} <template v-slot:right-icon>
<template v-slot:right-icon> <uv-icon name="checkbox-mark" v-if="1 === payType"></uv-icon>
<uv-icon name="checkbox-mark" v-if="item.type === payType"></uv-icon> </template>
</template> </uv-cell>
</uv-cell> <uv-cell v-if="canPointPay"
</block> :title="`积分支付(剩:${ thinkUserInfo.integral }积分)`"
icon="https://oss.wsdns.cn/20240511/fae57a94fa0042b9bceb721421304db1.png?x-oss-process=image/resize,m_fixed,w_100,h_100/quality,Q_90"
:cellStyle="{ padding: '20rpx 10rpx', borderRadius: '8rpx', backgroundColor: 2 === payType ? '#f6fff1' : '' }"
:border="false"
@click="onPayType(2)"
>
<template v-slot:right-icon>
<uv-icon name="checkbox-mark" v-if="2 === payType"></uv-icon>
</template>
</uv-cell>
</uv-cell-group> </uv-cell-group>
<view slot="actions" class="card-actions"> <view slot="actions" class="card-actions">
<view class="card-actions-item" @click="actionsClick('分享')"> <view class="card-actions-item">
<!-- <span class="web-text-danger">已优惠¥0.00</span>--> <!-- <span class="web-text-danger">已优惠¥0.00</span>-->
<span style="vertical-align:super">¥</span> <span style="vertical-align:super">¥</span>
<uv-count-to :startVal="0" decimals="2" duration="100" color="#ff0000" bold <uv-count-to :startVal="0" decimals="2" duration="100" color="#ff0000" bold
prefix="$" :endVal="cart.totalPrice || 0.00"></uv-count-to> prefix="$" :endVal="totalPrice"></uv-count-to>
</view> </view>
</view> </view>
</uni-card> </uni-card>
@@ -102,12 +66,14 @@
<view class="xieyi web-cell web-text-secondary web-cell-align-top"> <view class="xieyi web-cell web-text-secondary web-cell-align-top">
<view class="web-cell web-cell-content web-cell-align-top"> <view class="web-cell web-cell-content web-cell-align-top">
<uv-avatar src="https://oss.wsdns.cn/20240723/2f9ae761ebb343fcbcaccd7441c88e20.png" size="20" v-if="!disabled" @click="onDisabled"></uv-avatar> <uv-avatar src="https://oss.wsdns.cn/20240723/2f9ae761ebb343fcbcaccd7441c88e20.png" size="20" v-if="!disabled"
<uv-avatar src="https://oss.wsdns.cn/20240723/cc887e4a1cd749ebb5a1cfa2484c01f2.png" size="20" v-else @click="onDisabled"></uv-avatar> @click="onDisabled"></uv-avatar>
<uv-avatar src="https://oss.wsdns.cn/20240723/cc887e4a1cd749ebb5a1cfa2484c01f2.png" size="20" v-else
@click="onDisabled"></uv-avatar>
<view class="text" @click="onDisabled"> <view class="text" @click="onDisabled">
<text>同意以下服务条款</text> <text>同意以下服务条款</text>
<text class="link" @click.stop="navTo('/package/article/detail?articleId=501')">《牛八哥预定条款》</text> <!-- <text class="link" @click.stop="navTo('/package/article/detail?articleId=501')">《牛八哥预定条款》</text>-->
<text class="link" @click.stop="navTo('/package/article/detail?articleId=502')">《用户服务协议和隐私政策》 <text class="link" @click.stop="navTo('/package/article/detail?articleId=502')">《用户服务协议和隐私政策》
</text> </text>
</view> </view>
@@ -119,14 +85,15 @@
<view class="checkout-car"> <view class="checkout-car">
<view class="car-total"> <view class="car-total">
<text style="color: #ebcf00">合计¥</text> <text style="color: #ebcf00">合计¥</text>
<uv-count-to :startVal="0" decimals="2" duration="100" color="#ebcf00" bold :endVal="cart.totalPrice"></uv-count-to> <uv-count-to :startVal="0" decimals="2" duration="100" color="#ebcf00" bold
:endVal="totalPrice"></uv-count-to>
</view> </view>
<uv-button <uv-button
class="save-btn" class="save-btn"
:disabled="!disabled || cart.totalPrice === 0" :disabled="!disabled"
:customStyle="{ background: 'linear-gradient(to right, #f5a4a4, #ff0000)', borderRadius: '0 30px 30px 0', color: '#ffffff', border: 'none', padding: '22px 30px' }" :customStyle="{ background: 'linear-gradient(to right, #f5a4a4, #ff0000)', borderRadius: '0 30px 30px 0', color: '#ffffff', border: 'none', padding: '22px 30px' }"
text="提交订单" text="提交订单"
@click="save" @click="save"
></uv-button> ></uv-button>
</view> </view>
</view> </view>
@@ -173,16 +140,16 @@
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false"> <uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<block v-for="(item, index) in shopList" :key="index"> <block v-for="(item, index) in shopList" :key="index">
<uv-cell :cellStyle="{ padding: '10px 0' }" @click="onShopAddress(item)"> <uv-cell :cellStyle="{ padding: '10px 0' }" @click="onShopAddress(item)">
<!-- <template v-slot:icon>--> <!-- <template v-slot:icon>-->
<!-- <uv-avatar text="门店" fontSize="12" size="32" randomBgColor></uv-avatar>--> <!-- <uv-avatar text="门店" fontSize="12" size="32" randomBgColor></uv-avatar>-->
<!-- </template>--> <!-- </template>-->
<template v-slot:title> <template v-slot:title>
<view class="flex flex-col"> <view class="flex flex-col">
<view class="title-bar"> <view class="title-bar">
<text class="web-text-heading" style="font-weight: 700">{{ item.merchantName }}</text> <text class="web-text-heading" style="font-weight: 700">{{ item.merchantName }}</text>
</view> </view>
<view class="title-bar web-text-secondary"> <view class="title-bar web-text-secondary">
{{ item.address || '良庆镇五象大道401号南宁航洋信和广场1号楼4楼' }} {{ item.address }}
</view> </view>
</view> </view>
</template> </template>
@@ -205,13 +172,6 @@
<uv-code-input mode="box" dot :space="0" :maxlength="6" hairline v-model="payPassword" <uv-code-input mode="box" dot :space="0" :maxlength="6" hairline v-model="payPassword"
@finish="onPayPassword"></uv-code-input> @finish="onPayPassword"></uv-code-input>
</uni-forms-item> </uni-forms-item>
<!-- <uv-button
class="to-pay-btn"
:customStyle="{ background: 'linear-gradient(to right, #f5a4a4, #ff0000)', borderRadius: '30px', color: '#ffffff' }"
text="确定支付"
:disabled="disabledPayPayPassword"
@click="onPayPassword"
></uv-button> -->
</uni-forms> </uni-forms>
<text @click="navTo(`/package/user/pay-password`)" class="web-text-primary">忘记支付密码?</text> <text @click="navTo(`/package/user/pay-password`)" class="web-text-primary">忘记支付密码?</text>
</view> </view>
@@ -254,6 +214,8 @@ import UvCell from "@/uni_modules/uv-cell/components/uv-cell/uv-cell.vue";
import UvImage from "@/uni_modules/uv-image/components/uv-image/uv-image.vue"; import UvImage from "@/uni_modules/uv-image/components/uv-image/uv-image.vue";
import UniCard from "@/uni_modules/uni-card/components/uni-card/uni-card.vue"; import UniCard from "@/uni_modules/uni-card/components/uni-card/uni-card.vue";
import UvGap from "@/uni_modules/uv-gap/components/uv-gap/uv-gap.vue"; import UvGap from "@/uni_modules/uv-gap/components/uv-gap/uv-gap.vue";
import {addThinkGoodsOrder} from "@/api/think/thinkGoodsOrder";
import {getThinkUsers, thinkUserInfo} from "@/api/think/thinkUsers";
const mpStore = useMpStore(); const mpStore = useMpStore();
const userStore = useUserStore(); const userStore = useUserStore();
@@ -280,11 +242,12 @@ export default {
isNew: undefined, isNew: undefined,
selected: undefined, selected: undefined,
}, },
cart: {}, carts: {},
week: 0, week: 0,
goodsList, goodsList,
// 订单总金额 // 订单总金额
totalPrice, totalPrice: 0,
totalPoint: 0,
reducePrice: 0, reducePrice: 0,
merchantId, merchantId,
merchantName, merchantName,
@@ -297,11 +260,14 @@ export default {
// 支付密码是否正确 // 支付密码是否正确
isPayPasswordCorrect: false, isPayPasswordCorrect: false,
disabledPayPayPassword: false, disabledPayPayPassword: false,
payPassword: '' payPassword: '',
canPointPay: false,
thinkUserInfo: {},
}; };
}, },
onLoad(where) { onLoad(where) {
this.where = where; this.where = where;
this.getThinkUserInfo()
this.reload(); this.reload();
}, },
onShow() { onShow() {
@@ -312,24 +278,30 @@ export default {
this.openLogin(); this.openLogin();
}, },
methods: { methods: {
async getThinkUserInfo() {
this.thinkUserInfo = await thinkUserInfo()
console.log(this.thinkUserInfo)
},
async reload() { async reload() {
const app = this; const app = this;
const {where} = this; const {where} = this;
// 当前小程序信息
const info = await mpStore.fetchMpInfo();
// 配置信息
app.config = info.config
// 当前登录用户信息 // 当前登录用户信息
const userInfo = await userStore.fetchUserInfo(); const userInfo = await userStore.fetchUserInfo();
app.userInfo = userInfo; app.userInfo = userInfo;
// 加载购物车数据 // 加载购物车数据
CartApi.listCart(where).then(data => { CartApi.listCart(where).then(data => {
if(data){ if (data) {
app.cart = data this.totalPoint = 0
console.log(app.cart.shops); app.carts = data.map(item => {
if (item.goods.isIntegral !== 2) {
this.canPointPay = true
this.totalPoint += parseInt(item.goods.maxIntegral) * item.cartNum
}
return item
})
this.totalPrice = app.carts.reduce((a, b) => a + b.price * b.cartNum, 0)
} }
}) })
@@ -340,24 +312,6 @@ export default {
const arr = res.list.filter((d) => d.isDefault === true); const arr = res.list.filter((d) => d.isDefault === true);
app.address = arr[0]; app.address = arr[0];
}); });
MerchantApi.pageMerchant({type: 0}).then(res => {
app.shopList = res.list;
app.shopAddress = res.list[0];
})
// 读取支付方式列表
PaymentApi.select({status: true}).then((list) => {
app.payment = list
.filter((d) => d.type < 2)
.map((d) => {
if (d.code === 'balancePay') {
d.name = `${d.name} (¥${userInfo.balance})`;
}
return d;
});
});
}, },
onDisabled() { onDisabled() {
this.disabled = !this.disabled; this.disabled = !this.disabled;
@@ -381,19 +335,23 @@ export default {
this.address = item; this.address = item;
this.$refs.userAddressForm.close(); this.$refs.userAddressForm.close();
}, },
onShopAddress(item){ onShopAddress(item) {
this.shopAddress = item; this.shopAddress = item;
this.$refs.shopAddressForm.close(); this.$refs.shopAddressForm.close();
}, },
// 切换支付方式 // 切换支付方式
onPayType(index) { onPayType(index) {
if (index === 2 && this.totalPoint > this.thinkUserInfo.integral) return uni.showToast({
title: '积分不足',
icon: 'none'
})
this.payType = index; this.payType = index;
}, },
openAddressList() { openAddressList() {
if(this.deliveryType === 0){ if (this.deliveryType === 0) {
this.$refs.userAddressForm.open('center'); this.$refs.userAddressForm.open('center');
} }
if(this.deliveryType === 1){ if (this.deliveryType === 1) {
this.$refs.shopAddressForm.open('center'); this.$refs.shopAddressForm.open('center');
} }
}, },
@@ -404,7 +362,7 @@ export default {
return false; return false;
} }
}, },
onDeliveryType(index){ onDeliveryType(index) {
this.deliveryType = index this.deliveryType = index
}, },
// 验证支付密码 // 验证支付密码
@@ -419,18 +377,18 @@ export default {
this.disabledPayPayPassword = true; this.disabledPayPayPassword = true;
const {payPassword} = this; const {payPassword} = this;
checkPayPassword({payPassword}) checkPayPassword({payPassword})
.then((res) => { .then((res) => {
this.disabledPayPayPassword = false; this.disabledPayPayPassword = false;
this.isPayPasswordCorrect = true; this.isPayPasswordCorrect = true;
this.save(); this.save();
}) })
.catch((err) => { .catch((err) => {
uni.showToast({ uni.showToast({
title: err.message, title: err.message,
icon: 'none' icon: 'none'
});
this.disabledPayPayPassword = false;
}); });
this.disabledPayPayPassword = false;
});
}, },
openCarInfo(cart) { openCarInfo(cart) {
if (cart.spec) { if (cart.spec) {
@@ -439,8 +397,6 @@ export default {
}, },
save() { save() {
const app = this; const app = this;
const {totalPrice,shops} = this.cart;
console.log(totalPrice)
if (!this.disabled) { if (!this.disabled) {
uni.showToast({ uni.showToast({
@@ -449,139 +405,101 @@ export default {
}); });
return false; return false;
} }
if (totalPrice === 0) {
uni.showToast({
title: '订单信息不存在',
icon: 'none'
});
return false;
}
if (app.payType === 0 && !this.isPayPasswordCorrect) {
this.$refs.payPasswordForm.open('center');
return false;
}
uni.showLoading({ uni.showLoading({
title: '订单提交中.' title: '订单提交中.'
}); });
console.log({ const infoList = []
type: 0, // 0商城订单 this.carts.forEach(item => {
merchantId: shops[0]?.shopId, infoList.push({
merchantName: shops[0]?.shopName, goodsId: item.goodsId,
totalPrice: totalPrice, title: item.goodsName,
payPrice: totalPrice, image: item.image,
goodsList: shops[0].carts, goodsPrice: item.goods.minPrice,
comments: shops[0]?.shopName, linePrice: item.goods.linePrice,
// 微信支付 integral: item.goods.maxIntegral,
payType: app.payType, goodsAttr: ''
// 下单日期 })
dateTime: app.dateTime
}) })
Api.addOrder({ addThinkGoodsOrder({
type: 0, // 0商城订单 name: '',
merchantId: shops[0]?.shopId, phone: '',
merchantName: shops[0]?.shopName, address: '',
totalPrice: totalPrice, totalPrice: this.totalPrice,
payPrice: totalPrice, num: 1,
goodsList: shops[0].carts, payPrice: this.totalPrice,
comments: shops[0]?.shopName, orderStatus: 1,
// 微信支付 infoList,
payType: app.payType, payType: app.payType,
// 下单日期
dateTime: app.dateTime
}) })
.then((data) => { .then((data) => {
const orderInfo = data; const orderInfo = data;
// 调起微信支付
// 调起微信支付 if (app.payType === 1) {
if (app.payType == 1) { // #ifdef MP-WEIXIN
// #ifdef MP-WEIXIN uni.requestPayment({
uni.requestPayment({ provider: orderInfo.provider, // 服务提供商
provider: orderInfo.provider, // 服务提供商 timeStamp: orderInfo.timeStamp, // 时间戳
timeStamp: orderInfo.timeStamp, // 时间戳 nonceStr: orderInfo.nonceStr, // 随机字符串
nonceStr: orderInfo.nonceStr, // 随机字符串 package: orderInfo.package,
package: orderInfo.package, signType: orderInfo.signType, // 签名算法
signType: orderInfo.signType, // 签名算法 paySign: orderInfo.paySign, // 签名
paySign: orderInfo.paySign, // 签名 success: function (res) {
success: function (res) { // 业务逻辑。。。
// 业务逻辑。。。
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(function () {
app.disabled = false;
uni.navigateTo({
url: '/package/goods/order'
});
}, 500);
},
fail: function (err) {
console.log('支付失败', err);
app.disabled = false;
uni.navigateTo({
url: '/package/goods/order'
});
}
});
// #endif
}
// 使用余额支付
if (app.payType == 0) {
if(orderInfo){
uni.showToast({ uni.showToast({
title: '支付成功', title: '支付成功',
icon: 'success' icon: 'success'
}); });
setTimeout(function () { setTimeout(function () {
app.disabled = false; app.disabled = false;
app.$refs.payPasswordForm.close(); uni.navigateTo({
uni.reLaunch({ url: '/package/goods/order'
url: '/package/goods/order',
success: function (e) {
var page = getCurrentPages()[0];
if (page == undefined || page == null) return;
page.onLoad();
}
}); });
}, 2000); }, 1500);
},
fail: function (err) {
console.log('支付失败', err);
app.disabled = false;
uni.navigateTo({
url: '/package/goods/order'
});
} }
// if (!orderInfo) {
// return uni.showToast({
// title: '支付失败',
// icon: 'error'
// });
// }
// if (orderInfo) {
// uni.showToast({
// title: '支付成功',
// icon: 'success'
// });
// setTimeout(function () {
// app.disabled = false;
// app.$refs.payPasswordForm.close();
// uni.reLaunch({
// url: '/package/goods/order',
// success: function (e) {
// var page = getCurrentPages()[0];
// if (page == undefined || page == null) return;
// page.onLoad();
// }
// });
// }, 2000);
// }
}
uni.hideLoading();
})
.catch((res) => {
uni.showToast({
title: res.message || '请检查您的网络.',
icon: 'none'
}); });
uni.hideLoading(); // #endif
return
}
// 使用余额支付
if (app.payType === 2) {
if (orderInfo) {
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(function () {
app.disabled = false;
app.$refs.payPasswordForm.close();
uni.reLaunch({
url: '/package/goods/order',
success: function (e) {
var page = getCurrentPages()[0];
if (page == undefined || page == null) return;
page.onLoad();
}
});
}, 2000);
}
}
uni.hideLoading();
})
.catch((res) => {
uni.showToast({
title: res.message || '请检查您的网络.',
icon: 'none'
}); });
uni.hideLoading();
});
} }
} }
}; };
@@ -732,6 +650,7 @@ page {
margin-left: 10rpx; margin-left: 10rpx;
} }
} }
.delivery{
.delivery {
} }
</style> </style>
+95 -153
View File
@@ -1,7 +1,7 @@
<template> <template>
<view class=""> <view class="">
<view class="goods-info"> <view class="goods-info">
<uv-swiper :list="photo" indicator indicatorMode="line" circular height="750rpx" radius="0"></uv-swiper> <uv-swiper :list="[form.image]" indicator indicatorMode="line" circular height="750rpx" radius="0"></uv-swiper>
</view> </view>
<uni-card :border="false" :is-shadow="false" :padding="0"> <uni-card :border="false" :is-shadow="false" :padding="0">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false"> <uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false">
@@ -9,17 +9,17 @@
<template v-slot:title> <template v-slot:title>
<view class="pirce-bar" style="display: flex;"> <view class="pirce-bar" style="display: flex;">
<view class="web-text-danger">¥</view> <view class="web-text-danger">¥</view>
<view class="web-text-danger" style="font-size: 40rpx;">{{ form.price }}</view> <view class="web-text-danger" style="font-size: 40rpx;">{{ form.minPrice }}</view>
</view> </view>
</template> </template>
<template v-slot:right-icon> <!-- <template v-slot:right-icon>-->
<text class="web-text-secondary" style="text-decoration: line-through">划线价¥{{ form.price * 2 }}</text> <!-- <text class="web-text-secondary" style="text-decoration: line-through">划线价¥{{ form.price * 2 }}</text>-->
</template> <!-- </template>-->
</uv-cell> </uv-cell>
<uv-cell :cellStyle="{padding: '0px 5px 15px 5px'}"> <uv-cell :cellStyle="{padding: '0px 5px 15px 5px'}">
<template v-slot:title> <template v-slot:title>
<view class="flex"> <view class="flex">
<view class="web-text-heading font-bold" style="font-size: 26rpx; ">{{ form.goodsName }}</view> <view class="web-text-heading font-bold" style="font-size: 26rpx; ">{{ form.title }}</view>
</view> </view>
</template> </template>
</uv-cell> </uv-cell>
@@ -32,49 +32,49 @@
</uv-cell-group> </uv-cell-group>
</uni-card> </uni-card>
<uni-card :border="false" :is-shadow="false" :padding="0"> <!-- <uni-card :border="false" :is-shadow="false" :padding="0">-->
<uv-cell :cellStyle="{padding: '10px 5px'}" :center="true" @click="openSpecForm"> <!-- <uv-cell :cellStyle="{padding: '10px 5px'}" :center="true" @click="openSpecForm">-->
<template v-slot:title> <!-- <template v-slot:title>-->
<view class="flex" v-if="!skuText"> <!-- <view class="flex" v-if="!skuText">-->
<view class="web-text-secondary w-15p">可选</view> <!-- <view class="web-text-secondary w-15p">可选</view>-->
<view class="uv-page__tag-item" v-for="(item, index) in form.goodsSpecValue" :key="index"> <!-- <view class="uv-page__tag-item" v-for="(item, index) in form.goodsSpecValue" :key="index">-->
<uv-tags :text="`${item.value}`" :plain="!item.checked" type="info" :name="index" class="mr-10" <!-- <uv-tags :text="`${item.value}`" :plain="!item.checked" type="info" :name="index" class="mr-10"-->
@click="radioClick"> <!-- @click="radioClick">-->
</uv-tags> <!-- </uv-tags>-->
</view> <!-- </view>-->
</view> <!-- </view>-->
<view class="flex" v-else> <!-- <view class="flex" v-else>-->
<view class="web-text-secondary w-15p">已选</view> <!-- <view class="web-text-secondary w-15p">已选</view>-->
<uv-text class="web-text-heading" type="warning" plain :text="skuText" /> <!-- <uv-text class="web-text-heading" type="warning" plain :text="skuText"/>-->
</view> <!-- </view>-->
</template> <!-- </template>-->
<template v-slot:value> <!-- <template v-slot:value>-->
<uv-icon name="arrow-right" color="#cccccc"></uv-icon> <!-- <uv-icon name="arrow-right" color="#cccccc"></uv-icon>-->
</template> <!-- </template>-->
</uv-cell> <!-- </uv-cell>-->
<uv-cell :cellStyle="{padding: '10px 5px'}"> <!-- <uv-cell :cellStyle="{padding: '10px 5px'}">-->
<template v-slot:title> <!-- <template v-slot:title>-->
<view class="flex"> <!-- <view class="flex">-->
<view class="web-text-secondary w-15p">配送</view> <!-- <view class="web-text-secondary w-15p">配送</view>-->
<view class="web-text-heading">啦啦</view> <!-- <view class="web-text-heading">啦啦</view>-->
</view> <!-- </view>-->
</template> <!-- </template>-->
<template v-slot:value> <!-- <template v-slot:value>-->
<uv-icon name="arrow-right" color="#cccccc"></uv-icon> <!-- <uv-icon name="arrow-right" color="#cccccc"></uv-icon>-->
</template> <!-- </template>-->
</uv-cell> <!-- </uv-cell>-->
<uv-cell :border="false" :cellStyle="{padding: '10px 5px'}"> <!-- <uv-cell :border="false" :cellStyle="{padding: '10px 5px'}">-->
<template v-slot:title> <!-- <template v-slot:title>-->
<view class="flex"> <!-- <view class="flex">-->
<view class="web-text-secondary w-15p">保障</view> <!-- <view class="web-text-secondary w-15p">保障</view>-->
<view class="web-text-heading value">坏了包赔 假一赔十 七天无理由</view> <!-- <view class="web-text-heading value">坏了包赔 假一赔十 七天无理由</view>-->
</view> <!-- </view>-->
</template> <!-- </template>-->
<template v-slot:value> <!-- <template v-slot:value>-->
<uv-icon name="arrow-right" color="#cccccc"></uv-icon> <!-- <uv-icon name="arrow-right" color="#cccccc"></uv-icon>-->
</template> <!-- </template>-->
</uv-cell> <!-- </uv-cell>-->
</uni-card> <!-- </uni-card>-->
<uni-card title="商品详情" :is-shadow="false" :border="false" :padding="0"> <uni-card title="商品详情" :is-shadow="false" :border="false" :padding="0">
<view class="web-text-heading booking-content"> <view class="web-text-heading booking-content">
@@ -202,6 +202,7 @@ import UvAvatar from "@/uni_modules/uv-avatar/components/uv-avatar/uv-avatar.vue
import UvGap from "@/uni_modules/uv-gap/components/uv-gap/uv-gap.vue"; import UvGap from "@/uni_modules/uv-gap/components/uv-gap/uv-gap.vue";
import UvButton from "@/uni_modules/uv-button/components/uv-button/uv-button.vue"; import UvButton from "@/uni_modules/uv-button/components/uv-button/uv-button.vue";
import UvText from "@/uni_modules/uv-text/components/uv-text/uv-text.vue"; import UvText from "@/uni_modules/uv-text/components/uv-text/uv-text.vue";
import {getThinkGoods} from "@/api/think/thinkGoods";
const cartStore = useCartStore(); const cartStore = useCartStore();
const { const {
@@ -243,14 +244,17 @@ export default {
type, type,
isNew, isNew,
dateTime, dateTime,
options: [{ options: [
icon: 'server-fill', {
text: '客服' icon: 'server-fill',
}, { text: '客服'
icon: 'bag', },
text: '购物车', {
info: 0 icon: 'bag',
}], text: '购物车',
info: 0
}
],
buttonGroup: [ buttonGroup: [
{ {
text: '加入购物车', text: '加入购物车',
@@ -291,37 +295,17 @@ export default {
} }
} }
}); });
this.form = await this.getGoods()
// this.form.content = this.formatRichText(this.form.content)
if (this.isLogin) {
this.cart = await this.listCart()
this.options[1].info = this.cart.reduce((sum, item) => sum + item.cartNum, 0)
}
// 请求数据
Promise.all([app.getGoods(), app.listCart()]).then(data => {
const form = data[0]
form.content = this.formatRichText(form.content)
app.form = form;
cartStore.merchantId = form.merchantId
cartStore.merchantName = form.merchantName
cartStore.merchantCode = form.merchantCode
// 修改标题
uni.setNavigationBarTitle({
title: form.goodsName
})
// 加载场馆相册
if (form.files) {
app.photo = JSON.parse(form.files)
}
// 购物车信息
app.cart = data[1]
console.log(app.cart.totalNums)
// 更新购物车角标
if (app.cart?.totalNums) {
app.options[1].info = app.cart.totalNums
}
})
}, },
getGoods() { getGoods() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
GoodsApi.getGoods(this.id).then(result => { getThinkGoods(this.id).then(result => {
resolve(result) resolve(result)
}).catch(reject) }).catch(reject)
}) })
@@ -353,55 +337,6 @@ export default {
app.skuText = app.sku.join('、') app.skuText = app.sku.join('、')
} }
}, },
// openBookingTel() {
// // 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
// this.$refs.popup.open('center')
// },
// closeBookingTel() {
// this.$refs.popup.close()
// },
callPhone(phone) {
uni.makePhoneCall({
phoneNumber: phone
});
},
onMap() {
uni.getLocation({
type: 'gcj02', //返回可以用于uni.openLocation的经纬度
success: function (res) {
console.log('返回可以用于uni.openLocation的经纬度: ', res);
const latitude = this.merchant.latitude;
const longitude = this.merchant.longitude;
uni.openLocation({
latitude: latitude,
longitude: longitude,
success: function () {
console.log('success');
}
});
}
});
},
formatRichText(html) {
let newContent = html.replace(/<img[^>]*>/gi, function (match, capture) {
match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
return match;
});
newContent = newContent.replace(/style="[^"]+"/gi, function (match, capture) {
match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi,
'max-width:100%;');
return match;
});
newContent = newContent.replace(/<br[^>]*\/>/gi, '');
newContent = newContent.replace(/\<img/gi,
'<img style="max-width:100%;height:auto;display:inline-block;margin:10rpx auto;"');
return newContent;
},
openSpecForm(){
this.$refs.specForm.open('center');
},
onClick({index, content}) { onClick({index, content}) {
console.log(index, content) console.log(index, content)
// 客服按钮 // 客服按钮
@@ -418,13 +353,17 @@ export default {
} }
// 前往购物车 // 前往购物车
if (index === 1) { if (index === 1) {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
uni.navigateTo({url: `/package/cart/index`}) uni.navigateTo({url: `/package/cart/index`})
} }
}, },
save({index, content}) { save({index, content}) {
const app = this const app = this
const {form} = this const {form} = this
if (!app.isLogin && !cartStore.isLogin) { if (!this.isLogin) {
this.$refs.login.open('bottom'); this.$refs.login.open('bottom');
return false; return false;
} }
@@ -435,32 +374,34 @@ export default {
}) })
return false return false
} }
console.log(index)
// 加入购物车 // 加入购物车
if (index === 0) { if (index === 0) {
form.cartNum = 1; form.cartNum = 1;
form.isNew = false; form.isNew = false;
form.price = form.minPrice;
cartStore.isNew = false; cartStore.isNew = false;
// 单规格 // 单规格
if (form.specs === 0) { // if (form.specs === 0) {
CartApi.addCart(form).then(data => { CartApi.addCart(form).then(data => {
app.reload() app.reload()
uni.showToast({ uni.showToast({
title: '添加成功', title: '添加成功',
icon: 'success' icon: 'success'
}); });
}).catch(res => { }).catch(res => {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
icon: 'none' icon: 'none'
}); });
}) })
return false return false
} // }
// 多规格 // 多规格
if (form.specs === 1) { // if (form.specs === 1) {
this.$refs.specForm.open('center'); // this.$refs.specForm.open('center');
return false; // return false;
} // }
return false; return false;
} }
// 立即购买 // 立即购买
@@ -474,6 +415,7 @@ export default {
this.$refs.specForm.open('center'); this.$refs.specForm.open('center');
return false; return false;
} }
form.price = form.minPrice;
CartApi.addCart(form).then(cartId => { CartApi.addCart(form).then(cartId => {
// 跳转页面 // 跳转页面
uni.navigateTo({ uni.navigateTo({
+314 -328
View File
@@ -1,413 +1,399 @@
<template> <template>
<view class="order" v-if="form.orderId"> <view class="order" v-if="form.id">
<uni-card :border="false" :is-shadow="false" :padding="0"> <uni-card :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top"> <view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content"> <view class="web-cell-content">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false"> <uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<!-- <uv-cell :title="`${form.merchantName}`" :label="` `" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" />--> <!-- <uv-cell :title="`${form.merchantName}`" :label="` `" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" />-->
<block v-for="(item, index) in form.goodsList" :key="index"> <block v-for="(item, index) in form.infoList" :key="index">
<uv-cell <uv-cell
:cellStyle="{ padding: '0', paddingBottom: '5px' }" :cellStyle="{ padding: '0', paddingBottom: '5px' }"
:border="false" :border="false"
> >
<template v-slot:icon> <template v-slot:icon>
<uv-image :src="item.image" width="100" height="100" /> <uv-image :src="item.image" width="100" height="100"/>
</template> </template>
<template v-slot:title> <template v-slot:title>
<view class="goods-info flex flex-col"> <view class="goods-info flex flex-col">
<view class="flex"> <view class="flex">
<uv-text lines="2" bold :text="item.goodsName"></uv-text> <uv-text lines="2" bold :text="item.title"></uv-text>
<text>¥{{ item.price }}</text> <text>¥{{ item.goodsPrice }}</text>
</view>
<view class="web-text-secondary">
{{ item.comments }}
</view>
<view class="tools flex justify-between web-text-secondary items-center">
<text></text>
<text>x {{ item.totalNum }}</text>
</view> </view>
</view> </view>
</template> </template>
</uv-cell> </uv-cell>
</block>
<uv-cell :label="`成人票 ¥50`" :value="`x ${item.adultNum}`" v-if="item.isChildren" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" /> </uv-cell-group>
<uv-cell :label="`儿童票 ¥35`" :value="`x ${item.childrenNum}`" v-if="item.isChildren" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" /> </view>
</block> </view>
</uv-cell-group> <view slot="actions" class="card-actions">
</view> <view class="web-text-heading">合计:¥{{ form.totalPrice }}</view>
</view> <view class="web-text-danger">实付:¥{{ form.payPrice }}</view>
<view slot="actions" class="card-actions"> </view>
<view class="web-text-heading">合计:¥{{ form.totalPrice }}</view> </uni-card>
<view class="web-text-danger">实付:¥{{ form.payPrice }}</view> <block v-if="form.orderNo">
</view> <uni-card :border="false" :is-shadow="false" :padding="0">
</uni-card> <view class="web-cell web-cell-align-top">
<block v-if="form.orderNo"> <uv-cell-group :customStyle="{ backgroundColor: '#ffffff', padding: '8px 0' }" :border="false">
<uni-card :border="false" :is-shadow="false" :padding="0"> <uv-cell :title="`订单号`" :value="`${form.orderNum}`" :cellStyle="{ padding: '8px' }"/>
<view class="web-cell web-cell-align-top"> <uv-cell :title="`订单状态`" :cellStyle="{ padding: '8px' }">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff', padding: '8px 0' }" :border="false"> <template v-slot:value>
<uv-cell :title="`姓名`" :value="`${form.realName}`" :cellStyle="{ padding: '8px' }" />
<uv-cell :title="`手机号码`" :value="`${form.phone}`" :cellStyle="{ padding: '8px' }" />
<uv-cell :title="`订单号`" :value="`${form.orderId}`" :cellStyle="{ padding: '8px' }" />
<uv-cell :title="`订单编号`" :cellStyle="{ padding: '8px' }">
<template v-slot:value>
<uv-parse :content="form.orderNo" :selectable="true"></uv-parse>
</template>
</uv-cell>
<uv-cell :title="`订单状态`" :cellStyle="{ padding: '8px' }">
<template v-slot:value>
<view v-if="form.orderStatus === 2"> <view v-if="form.orderStatus === 2">
<span class="web-text-secondary">已取消</span> <span class="web-text-secondary">已取消</span>
</view> </view>
<view v-else-if="form.payStatus === 0"> <view v-else-if="form.payStatus === 2">
<!-- <uv-count-down :time="form.timestamp" format="mm:ss"></uv-count-down> --> <!-- <uv-count-down :time="form.timestamp" format="mm:ss"></uv-count-down> -->
<span style="color: #ff0000">未支付</span> <span style="color: #ff0000">未支付</span>
</view> </view>
<view v-else>{{ orderStatus[form.orderStatus] }}</view> <view v-else>{{ orderStatus[form.orderStatus] }}</view>
</template> </template>
</uv-cell> </uv-cell>
<uv-cell :title="`下单时间`" :value="`${form.createTime}`" :cellStyle="{ padding: '8px' }" /> <uv-cell :title="`下单时间`" :value="`${form.createTime}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`支付方式`" :value="`${payType[form.payType]}`" :cellStyle="{ padding: '8px' }" /> <uv-cell :title="`支付方式`" :value="`${payType[form.payType]}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`优惠说明`" :value="`${form.couponDesc ? form.couponDesc : '无'}`" :cellStyle="{ padding: '8px' }" :border="false" /> <uv-cell :title="`优惠说明`" :value="`${form.couponDesc ? form.couponDesc : '无'}`"
</uv-cell-group> :cellStyle="{ padding: '8px' }" :border="false"/>
</view> </uv-cell-group>
</uni-card> </view>
</block> </uni-card>
<uv-gap height="20"></uv-gap> </block>
<view class="checkout-car" v-if="form.payStatus === 0 && form.orderStatus !== 2"> <uv-gap height="20"></uv-gap>
<view class="car-total"> <view class="checkout-car" v-if="form.payStatus === 0 && form.orderStatus !== 2">
<text style="color: #ebcf00">¥</text> <view class="car-total">
<uv-count-to decimals="2" duration="30" color="#ebcf00" bold :endVal="form.payPrice"></uv-count-to> <text style="color: #ebcf00">¥</text>
</view> <uv-count-to decimals="2" duration="30" color="#ebcf00" bold :endVal="form.payPrice"></uv-count-to>
<uv-button </view>
class="save-btn" <uv-button
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '0 30px 30px 0', color: '#ffffff', border: 'none', padding: '22px 30px' }" class="save-btn"
text="去支付" :customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '0 30px 30px 0', color: '#ffffff', border: 'none', padding: '22px 30px' }"
@click="navTo(`/package/booking/confirm?id=${form.orderId}`)" text="去支付"
></uv-button> @click="navTo(`/package/booking/confirm?id=${form.orderId}`)"
</view> ></uv-button>
<!-- 登录组件 --> </view>
<ws-login ref="login" @done="reload" /> <!-- 登录组件 -->
</view> <ws-login ref="login" @done="reload"/>
</view>
</template> </template>
<script> <script>
import * as OrderApi from '@/api/shop/order'; import * as OrderApi from '@/api/shop/order';
import { pageWechatDeposit } from '@/api/shop/wechatDeposit'; import {pageWechatDeposit} from '@/api/shop/wechatDeposit';
import UvAvatar from "@/uni_modules/uv-avatar/components/uv-avatar/uv-avatar.vue"; import UvAvatar from "@/uni_modules/uv-avatar/components/uv-avatar/uv-avatar.vue";
import UvImage from "@/uni_modules/uv-image/components/uv-image/uv-image.vue"; import UvImage from "@/uni_modules/uv-image/components/uv-image/uv-image.vue";
import {getThinkGoodsOrder} from "@/api/think/thinkGoodsOrder";
export default { export default {
components: {UvImage, UvAvatar}, components: {UvImage, UvAvatar},
data() { data() {
return { return {
isLogin: false, isLogin: false,
orderId: 0, orderId: 0,
userId: 0, userId: 0,
form: {}, form: {},
where: { where: {
page: 1 page: 1
}, },
canReset: false, canReset: false,
loadMore: 'more', loadMore: 'more',
logo: '', logo: '',
items: ['全部订单', '未支付', '已支付', '已完成', '押金'], items: ['全部订单', '未支付', '已支付', '已完成', '押金'],
orderStatus: ['已支付', '已完成', '已取消', '取消中', '退款申请中', '退款被拒绝', '退款成功', '客户端申请退款'], orderStatus: ['已支付', '已完成', '已取消', '取消中', '退款申请中', '退款被拒绝', '退款成功', '客户端申请退款'],
payType: [ payType: [
'余额支付', '余额支付',
'微信支付', '微信支付',
'会员卡支付', '会员卡支付',
'支付宝', '支付宝',
'现金', '现金',
'POS机', 'POS机',
'VIP月卡', 'VIP月卡',
'VIP年卡', 'VIP年卡',
'VIP次卡', 'VIP次卡',
'IC月卡', 'IC月卡',
'IC年卡', 'IC年卡',
'IC次卡', 'IC次卡',
'免费', '免费',
'VIP充值卡', 'VIP充值卡',
'IC充值卡', 'IC充值卡',
'积分支付', '积分支付',
'VIP季卡', 'VIP季卡',
'IC季卡' 'IC季卡'
], ],
orderList: [], orderList: [],
styles: [ styles: [
{ {
value: 'button', value: 'button',
text: '按钮', text: '按钮',
checked: true checked: true
}, },
{ {
value: 'text', value: 'text',
text: '文字' text: '文字'
} }
], ],
h5_url: '', h5_url: '',
colors: ['#333333', '#4cd964', '#dd524d'], colors: ['#333333', '#4cd964', '#dd524d'],
current: 0, current: 0,
colorIndex: 0, colorIndex: 0,
activeColor: '#108001', activeColor: '#108001',
styleType: 'text' styleType: 'text'
}; };
}, },
onLoad(option) { onLoad(option) {
this.orderId = option.id; this.orderId = option.id;
// 判断是否登录 // 判断是否登录
this.openLogin(); this.openLogin();
// 加载数据 // 加载数据
this.reload(); this.reload();
}, },
onShow() { onShow() {
// 判断是否登录 // 判断是否登录
this.openLogin(); this.openLogin();
}, },
// 触底函数 // 触底函数
onReachBottom() { onReachBottom() {
const app = this; const app = this;
const { where } = this; const {where} = this;
if (app.canReset) { if (app.canReset) {
app.where.page = ++where.page; app.where.page = ++where.page;
app.reload(); app.reload();
} }
}, },
methods: { methods: {
reload() { reload() {
const app = this; const app = this;
const { where, userId, orderId } = this; const {where, userId, orderId} = this;
if (userId == 0) { if (userId == 0) {
app.openLogin(); app.openLogin();
return; return;
} }
where.userId = userId; uni.showLoading({
uni.showLoading({ title: '数据读取中.'
title: '数据读取中.' });
}); getThinkGoodsOrder(orderId).then((data) => {
OrderApi.getOrder(orderId).then((data) => { app.form = data;
console.log('data: ', data); // 页面标题
app.form = data; if (data.orderStatus == 1) {
uni.setNavigationBarTitle({
title: '订单详情(已完成)'
});
}
// 页面标题 uni.hideLoading();
if (data.orderStatus == 1) { });
uni.setNavigationBarTitle({
title: '订单详情(已完成)'
});
}
uni.hideLoading(); // H5版网址
}); const h5_url = uni.getStorageSync('h5_url');
const tid = uni.getStorageSync('TenantId');
// H5版网址 if (h5_url) {
const h5_url = uni.getStorageSync('h5_url'); app.h5_url = h5_url;
const tid = uni.getStorageSync('TenantId'); } else {
if (h5_url) { app.h5_url = `http://${tid}.h5.wsdns.cn`;
app.h5_url = h5_url; }
} else { },
app.h5_url = `http://${tid}.h5.wsdns.cn`; navTo(url) {
} uni.navigateTo({
}, url
navTo(url) { });
uni.navigateTo({ },
url onClickItem(e) {
}); const app = this;
}, const {where, userId} = this;
onClickItem(e) { const index = e.currentIndex;
const app = this; if (this.current !== e.currentIndex) {
const { where, userId } = this; this.current = e.currentIndex;
const index = e.currentIndex; }
if (this.current !== e.currentIndex) { if (userId == 0) {
this.current = e.currentIndex; app.openLogin();
} return;
if (userId == 0) { }
app.openLogin(); // 全部
return; if (index == 0) {
} where.payStatus = undefined;
// 全部 where.orderStatus = undefined;
if (index == 0) { }
where.payStatus = undefined; // 未支付
where.orderStatus = undefined; if (index == 1) {
} where.payStatus = 2;
// 未支付 }
if (index == 1) { // 已支付
where.payStatus = 2; if (index == 2) {
} where.payStatus = 1;
// 已支付 }
if (index == 2) { // 已完成
where.payStatus = 1; if (index == 3) {
} where.orderStatus = 1;
// 已完成 }
if (index == 3) { // 押金
where.orderStatus = 1; if (index == 4) {
} pageWechatDeposit({
// 押金 uid: uni.getStorageSync('user_id')
if (index == 4) { }).then((res) => {
pageWechatDeposit({ console.log('res: ', res);
uid: uni.getStorageSync('user_id') app.orderList = res.list;
}).then((res) => { });
console.log('res: ', res); return false;
app.orderList = res.list; }
}); this.reload();
return false; },
} // 弹出登录提示框
this.reload(); async openLogin() {
}, this.userId = uni.getStorageSync('user_id');
// 弹出登录提示框 if (!this.userId) {
async openLogin() { this.$refs.login.open('bottom');
this.userId = uni.getStorageSync('user_id'); return false;
if (!this.userId) { }
this.$refs.login.open('bottom'); }
return false; }
}
}
}
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.content { .content {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
/* #endif */ /* #endif */
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: 150px; height: 150px;
text-align: center; text-align: center;
} }
.content-text { .content-text {
font-size: 14px; font-size: 14px;
color: #666; color: #666;
} }
.color-tag { .color-tag {
width: 25px; width: 25px;
height: 25px; height: 25px;
} }
.uni-list { .uni-list {
flex: 1; flex: 1;
} }
.order { .order {
.order-title { .order-title {
padding: 20rpx 0; padding: 20rpx 0;
border-bottom: 1px #eee solid; border-bottom: 1px #eee solid;
.merchant-avatar { .merchant-avatar {
margin-right: 12rpx; margin-right: 12rpx;
} }
.merchant-name { .merchant-name {
// padding-left: 12rpx; // padding-left: 12rpx;
} }
.btn-status { .btn-status {
font-size: 30rpx; font-size: 30rpx;
display: flex; display: flex;
} }
} }
.order-body { .order-body {
padding: 16px 0; padding: 16px 0;
.goods-info{
.goods-info {
margin-left: 8rpx; margin-left: 8rpx;
.goods-name{
.goods-name {
font-weight: 500; font-weight: 500;
} }
.goods-desc{
.goods-desc {
color: #808080; color: #808080;
} }
} }
.goods-image{
.goods-image {
width: 160rpx; width: 160rpx;
height: 160rpx; height: 160rpx;
border-radius: 8rpx; border-radius: 8rpx;
} }
} }
} }
.ele-flex { .ele-flex {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.card-actions { .card-actions {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
padding: 0 10px; padding: 0 10px;
align-items: center; align-items: center;
height: 45px; height: 45px;
border-top: 1px #eee solid; border-top: 1px #eee solid;
.web-text-heading { .web-text-heading {
font-size: 30rpx; font-size: 30rpx;
font-weight: 500; font-weight: 500;
} }
.web-text-danger { .web-text-danger {
font-size: 30rpx; font-size: 30rpx;
font-weight: 500; font-weight: 500;
} }
} }
.card-actions-item { .card-actions-item {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
} }
.card-actions-item-text { .card-actions-item-text {
font-size: 12px; font-size: 12px;
color: #666; color: #666;
margin-left: 5px; margin-left: 5px;
} }
.btn-status { .btn-status {
font-size: 30rpx; font-size: 30rpx;
display: flex; display: flex;
} }
.close { .close {
top: 60rpx !important; top: 60rpx !important;
} }
.qrcode { .qrcode {
margin-top: 30rpx; margin-top: 30rpx;
text-align: center; text-align: center;
align-items: center; align-items: center;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
} }
.checkout-car { .checkout-car {
width: 700rpx; width: 700rpx;
left: 25rpx; left: 25rpx;
position: fixed; position: fixed;
bottom: 30rpx; bottom: 30rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
background-color: #000000; background-color: #000000;
border-radius: 100px; border-radius: 100px;
align-items: center; align-items: center;
.car-selected { .car-selected {
color: #ccc; color: #ccc;
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0 20rpx; padding: 0 20rpx;
} }
.car-total { .car-total {
display: flex; display: flex;
color: #ebcf00; color: #ebcf00;
align-items: center; align-items: center;
padding-left: 40rpx; padding-left: 40rpx;
.save-btn { .save-btn {
} }
} }
} }
</style> </style>
+73 -83
View File
@@ -1,7 +1,8 @@
<template> <template>
<view> <view>
<view class="segmented"> <view class="segmented">
<uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor" inActiveColor="#ff0000" @clickItem="onClickItem" /> <uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor"
inActiveColor="#ff0000" @clickItem="onClickItem"/>
</view> </view>
<view class="order"> <view class="order">
<block v-if="orderList.length > 0"> <block v-if="orderList.length > 0">
@@ -9,45 +10,39 @@
<uni-card :border="false" :is-shadow="false" :padding="0"> <uni-card :border="false" :is-shadow="false" :padding="0">
<template v-slot:title> <template v-slot:title>
<div class="order-title web-cell"> <div class="order-title web-cell">
<view class="web-cell web-cell-content"> <block v-if="item.payStatus === 2">
<view class="merchant-avatar"> <text class="btn-status web-text-danger">未支付</text>
<uv-avatar :src="item.merchantAvatar" size="24"></uv-avatar>
</view>
<text class="merchant-name">{{ item.merchantName }}</text>
</view>
<block v-if="item.orderStatus == 2">
<text class="btn-status web-text-secondary">已取消</text>
</block>
<block v-else-if="item.orderStatus == 1">
<text class="btn-status web-text-success">已完成</text>
</block> </block>
<block v-else> <block v-else>
<text v-if="item.payStatus == 1" class="btn-status web-text-success">已支付</text> <view v-if="item.orderStatus === 1" class="btn-status web-text-success">
<view v-if="item.payStatus == 0" class="btn-status web-text-danger"> <text class="no-pay" style="margin-left: 10rpx">已支付</text>
<!-- <uv-count-down :time="item.timestamp" format="mm:ss"></uv-count-down>-->
<text class="no-pay" style="margin-left: 10rpx">未支付</text>
</view> </view>
<text v-if="item.payStatus === 2" class="btn-status web-text-success">待发货</text>
<text v-if="item.payStatus === 3" class="btn-status web-text-success">待收货</text>
<text v-if="item.payStatus === 4" class="btn-status web-text-success">已完成</text>
<text v-if="item.payStatus === 5" class="btn-status">退款中</text>
<text v-if="item.payStatus === 6" class="btn-status">退款拒绝</text>
<text v-if="item.payStatus === 7" class="btn-status">退款成功</text>
<text v-if="item.payStatus === 8" class="btn-status">已取消</text>
</block> </block>
</div> </div>
</template> </template>
<view class="order-body web-cell web-cell-align-top"> <view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content"> <view class="web-cell-content">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false"> <uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<block v-for="(sub, subIndex) in item.goodsList" :key="subIndex"> <block v-for="(sub, subIndex) in item.infoList" :key="subIndex">
<uv-cell <uv-cell
:title="`${sub.goodsName}`" :title="`${sub.title}`"
:label="`${sub.comments}`" :cellStyle="{ padding: '0', paddingBottom: '5px' }"
:cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false"
:border="false" @click="openUrl(`/package/goods/order-detail?id=${item.id}`)"
@click="openUrl(`/package/goods/order-detail?id=${item.orderId}`)"
> >
<template v-slot:icon> <template v-slot:icon>
<uv-avatar :src="sub.image" fontSize="12" size="50" shape="square"></uv-avatar> <uv-avatar :src="sub.image" fontSize="12" size="50" shape="square"></uv-avatar>
</template> </template>
<template v-slot:value> <template v-slot:value>
<view class="goods-price-bar"> <view class="goods-price-bar">
<view class="goods-price web-text-heading">¥{{sub.price}}</view> <view class="goods-price web-text-heading">¥{{ sub.goodsPrice }}</view>
<view class="total-num web-text-secondary" style="font-size: 13px;letter-spacing: 1px;">共{{ item.totalNum }}件</view>
</view> </view>
</template> </template>
</uv-cell> </uv-cell>
@@ -61,12 +56,15 @@
</view> </view>
<view slot="actions" class="card-actions"> <view slot="actions" class="card-actions">
<view class="card-actions-item" v-if="item.payStatus == 0 && item.orderStatus == 0"> <view class="card-actions-item" v-if="item.payStatus == 0 && item.orderStatus == 0">
<button class="mini-btn" size="mini" @click="closeOrder(item)" style="margin-right: 20rpx">取消订单</button> <button class="mini-btn" size="mini" @click="closeOrder(item)" style="margin-right: 20rpx">取消订单
<button class="mini-btn" size="mini" style="background-color: #ff0000; color: #FFFFFF" @click="toPay(item.orderId)">去支付</button> </button>
<button class="mini-btn" size="mini" style="background-color: #ff0000; color: #FFFFFF"
@click="toPay(item.orderId)">去支付
</button>
</view> </view>
<!-- <view class="card-actions-item" v-if="item.payStatus == 1 && item.isInvoice == 0" @click="onInvoice(item.orderId)">--> <!-- <view class="card-actions-item" v-if="item.payStatus == 1 && item.isInvoice == 0" @click="onInvoice(item.orderId)">-->
<!-- <button class="mini-btn" size="mini">申请开票</button>--> <!-- <button class="mini-btn" size="mini">申请开票</button>-->
<!-- </view>--> <!-- </view>-->
</view> </view>
</uni-card> </uni-card>
</block> </block>
@@ -91,15 +89,16 @@
</block> </block>
<uni-load-more v-if="orderList.length > 0" :status="loadMore"></uni-load-more> <uni-load-more v-if="orderList.length > 0" :status="loadMore"></uni-load-more>
<!-- 登录组件 --> <!-- 登录组件 -->
<ws-login ref="login" @done="reload" /> <ws-login ref="login" @done="reload"/>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import * as OrderApi from '@/api/shop/order'; import * as OrderApi from '@/api/shop/order';
import { pageWechatDeposit } from '@/api/shop/wechatDeposit'; import {pageWechatDeposit} from '@/api/shop/wechatDeposit';
import { getWeek, getKey } from '@/utils/common'; import {getWeek, getKey} from '@/utils/common';
import {pageThinkGoodsOrder} from "@/api/think/thinkGoodsOrder";
export default { export default {
components: {}, components: {},
@@ -142,11 +141,6 @@ export default {
onLoad(option) { onLoad(option) {
// 判断是否登录 // 判断是否登录
this.openLogin(); this.openLogin();
// 加载数据
// this.reload()
// if(option.isRefresh){
// this.isRefresh = true
// }
}, },
onShow(e) { onShow(e) {
// 判断是否登录 // 判断是否登录
@@ -156,7 +150,7 @@ export default {
// 触底函数 // 触底函数
onReachBottom() { onReachBottom() {
const app = this; const app = this;
const { where } = this; const {where} = this;
if (app.canReset) { if (app.canReset) {
app.where.page = ++where.page; app.where.page = ++where.page;
app.reload(); app.reload();
@@ -165,46 +159,41 @@ export default {
methods: { methods: {
reload() { reload() {
const app = this; const app = this;
const { where, userId } = this; const {where, userId} = this;
if (userId === 0) { if (userId === 0) {
app.openLogin(); app.openLogin();
return; return;
} }
where.userId = userId;
// uni.showLoading({
// title: '数据读取中.'
// })
app.loadMore = 'loading'; app.loadMore = 'loading';
OrderApi.pageOrder(where) pageThinkGoodsOrder(where)
.then((res) => { .then((res) => {
const list = res.list.map((d) => { const list = res.list.map((d) => {
return d; return d;
});
if (app.orderList.length < res.count) {
console.log('11111: ', 11111);
app.orderList = app.orderList.concat(list);
app.canReset = true;
app.loadMore = 'no-more';
} else {
app.canReset = false;
app.loadMore = 'no-more';
console.log('22222: ', 22222);
}
uni.hideLoading();
app.isRefresh = false;
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
uni.hideLoading();
app.isRefresh = false;
}); });
if (app.orderList.length < res.count) {
app.orderList = app.orderList.concat(list);
app.canReset = true;
app.loadMore = 'no-more';
} else {
app.canReset = false;
app.loadMore = 'no-more';
console.log('22222: ', 22222);
}
uni.hideLoading();
app.isRefresh = false;
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
uni.hideLoading();
app.isRefresh = false;
});
}, },
onClickItem(e) { onClickItem(e) {
const app = this; const app = this;
const { where, userId } = this; const {where, userId} = this;
const index = e.currentIndex; const index = e.currentIndex;
if (this.current !== e.currentIndex) { if (this.current !== e.currentIndex) {
this.current = e.currentIndex; this.current = e.currentIndex;
@@ -269,20 +258,20 @@ export default {
orderStatus: 2, orderStatus: 2,
orderId: item.orderId orderId: item.orderId
}) })
.then((msg) => { .then((msg) => {
uni.showToast({ uni.showToast({
title: msg, title: msg,
icon: 'none' icon: 'none'
});
item.orderStatus = 2;
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
uni.hideLoading();
}); });
item.orderStatus = 2;
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
uni.hideLoading();
});
} }
} }
}); });
@@ -401,7 +390,8 @@ export default {
font-size: 30rpx !important; font-size: 30rpx !important;
} }
} }
.goods-price-bar{
.goods-price-bar {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: flex-end; align-items: flex-end;
+88
View File
@@ -0,0 +1,88 @@
<template>
<uni-card title="预定信息" :border="false" :is-shadow="false" :padding="0">
<view class="flex flex-col justify-center items-center">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff', width: '100%' }" :border="false">
<uv-cell title="预定场地" :value="info.siteName"/>
<uv-cell title="支付状态" :value="info.payStatus === 1 ? '已支付' : '未支付'"/>
<uv-cell title="订单状态" :value="info.orderStatus === 2 ? '未使用' : '已使用'"/>
<uv-cell title="过期状态" value="已过期" v-if="expired"/>
<block v-for="(item, index) in info.thinkOrderInfos" :key="index">
<uv-cell
:title="`${item.fieldName}`"
:label="`${item.dateTime}`"
:value="`¥${item.price}`"
:border="item.isChildren === 1"
/>
</block>
</uv-cell-group>
<view class="py-20"
v-if="!expired && info.payStatus === 1 && info.orderStatus === 2 && (hasMerchantRole || hasMerchantClerkRole || hasSuperAdminRole)">
<uv-button :disabled="disabled" @click="doCheck" shape="circle" :custom-style="{width: '500rpx'}"
type="primary">核销
</uv-button>
</view>
</view>
</uni-card>
</template>
<script setup>
import {ref} from 'vue'
import {onLoad} from "@dcloudio/uni-app";
import {getThinkOrder, updateThinkOrder} from "@/api/think/thinkOrder";
import {useUserStore} from "@/store/modules/user";
import dayjs from "dayjs";
const info = ref({})
const expired = ref(false)
const getInfo = async (id) => {
info.value = await getThinkOrder(id)
if (dayjs().isAfter(dayjs(info.value.startTime * 1000))) expired.value = true
}
const userStore = useUserStore();
const hasMerchantRole = ref(false)
const hasMerchantClerkRole = ref(false)
const hasSuperAdminRole = ref(false)
const checkAuth = async () => {
if (!uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
uni.showToast({
title: '请先登录',
icon: 'none'
})
setTimeout(() => {
uni.switchTab({
url: '/pages/index'
})
}, 1500)
}
const userInfo = await userStore.fetchUserInfo();
hasMerchantRole.value = userInfo.roles.find((d) => d.roleCode === 'merchant');
hasMerchantClerkRole.value = userInfo.roles.find((d) => d.roleCode === 'merchantClerk');
hasSuperAdminRole.value = userInfo.roles.find((d) => d.roleCode === 'superAdmin');
}
checkAuth()
const disabled = ref(false)
const doCheck = async () => {
disabled.value = true
await updateThinkOrder({
id: info.value.id,
orderStatus: 1
})
disabled.value = false
uni.showToast({
title: '核销成功',
icon: 'none'
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
}
onLoad(({id}) => {
getInfo(id)
})
</script>
+36 -16
View File
@@ -1,8 +1,10 @@
<template> <template>
<view class="order" v-if="form.id"> <view class="order" v-if="form.id">
<view class="qrcode" v-if="form.payStatus === 1 && form.orderStatus === 2"> <view class="qrcode" v-if="form.payStatus === 1 && form.orderStatus === 2">
<uv-image :src="`${IMG_URL}${form.qrcode}`" width="200" height="200"/> <!-- <uv-image :src="`${IMG_URL}${form.qrcode}`" width="200" height="200"/>-->
<text class="web-text-secondary">核销码</text> <text class="text-25 mb-20 text-gray">{{ countDown }}秒后自动刷新</text>
<uv-qrcode size="300px" :value="form.qrcode" v-if="form.qrcode" @click="getOrder"/>
<text class="web-text-secondary">核销码(每120秒刷新,点击二维码手动刷新)</text>
</view> </view>
<uni-card title="预定信息" :border="false" :is-shadow="false" :padding="0"> <uni-card title="预定信息" :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top"> <view class="order-body web-cell web-cell-align-top">
@@ -140,7 +142,9 @@ export default {
current: 0, current: 0,
colorIndex: 0, colorIndex: 0,
activeColor: '#108001', activeColor: '#108001',
styleType: 'text' styleType: 'text',
countDown: 120,
interval: null
}; };
}, },
onLoad(option) { onLoad(option) {
@@ -176,19 +180,7 @@ export default {
uni.showLoading({ uni.showLoading({
title: '数据读取中.' title: '数据读取中.'
}); });
OrderApi.getThinkOrder(orderId).then((data) => { this.getOrder()
app.form = data;
// 页面标题
if (data.orderStatus === 1) {
uni.setNavigationBarTitle({
title: '订单详情(已完成)'
});
}
uni.hideLoading();
});
// H5版网址 // H5版网址
const h5_url = uni.getStorageSync('h5_url'); const h5_url = uni.getStorageSync('h5_url');
const tid = uni.getStorageSync('TenantId'); const tid = uni.getStorageSync('TenantId');
@@ -211,6 +203,34 @@ export default {
return false; return false;
} }
}, },
async getOrder() {
const app = this
if (this.interval) clearInterval(this.interval);
this.countDown = 120
OrderApi.getThinkOrder(this.orderId).then((data) => {
app.form = data;
// 页面标题
if (data.orderStatus === 1) {
uni.setNavigationBarTitle({
title: '订单详情(已完成)'
});
}
this.setCountDown()
uni.hideLoading();
});
},
setCountDown() {
this.interval = setInterval(() => {
if (this.form.payStatus === 1 && this.form.orderStatus === 2) {
if (this.countDown > 0) {
this.countDown--
} else {
clearInterval(this.interval)
this.getOrder()
}
}else clearInterval(this.interval)
}, 1000)
},
async openPay() { async openPay() {
const orderInfo = await thinkOrderRepay({id: this.orderId}) const orderInfo = await thinkOrderRepay({id: this.orderId})
const _this = this const _this = this
+132 -267
View File
@@ -1,284 +1,149 @@
<template> <template>
<view class="page"> <view class="page">
<!-- 其他功能 --> <!-- 其他功能 -->
<uni-card :border="false" :is-shadow="false" :padding="0"> <uni-card :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top"> <view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content"> <view class="web-cell-content">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false"> <uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false">
<block v-for="(item,index) in list" :key="index"> <block v-for="(item,index) in list" :key="index">
<uv-cell :title="item.merchantName" :label="item.shopType" isLink :url="`/package/booking/index?id=${item.merchantId}`" :cellStyle="{padding: '10px 0'}"> <uv-cell :title="item.name" isLink
<template v-slot:icon> :url="`/package/booking/index?id=${item.id}`" :cellStyle="{padding: '10px 0'}">
<uv-avatar :src="item.image" fontSize="12" size="50" randomBgColor></uv-avatar> <template v-slot:icon>
</template> <uv-avatar :src="item.thumb" fontSize="12" size="50" randomBgColor></uv-avatar>
</uv-cell> </template>
</block> </uv-cell>
</uv-cell-group> </block>
</view> </uv-cell-group>
</view> </view>
</uni-card> </view>
<!-- <view class="btn-bar"> </uni-card>
<uv-button class="save-user-profile" <!-- 登录组件 -->
:customStyle="{background: 'linear-gradient(to right, #70b915, #008e04)',borderRadius: '30px',color: '#ffffff'}" <ws-login ref="login" :logo="logo" @done="reload"/>
text="添加收货地址" @click="add"></uv-button> </view>
</view> -->
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
</view>
</template> </template>
<script> <script>
import * as Api from '@/api/shop/userAddress'; import * as Api from '@/api/shop/userAddress';
import * as MerchantApi from '@/api/shop/merchant'; import * as MerchantApi from '@/api/shop/merchant';
import regions from '@/api/regions-data.json'; import regions from '@/api/regions-data.json';
import { import {
getWxOpenId getWxOpenId
} from '@/api/passport/login'; } from '@/api/passport/login';
import { import {
openUrl openUrl
} from '@/utils/common'; } from '@/utils/common';
import { import {
useUserStore useUserStore
} from '@/store/modules/user'; } from '@/store/modules/user';
import { import {
useCarStore useCarStore
} from '@/store/modules/car'; } from '@/store/modules/car';
import {listThinkSite} from "@/api/think/thinkSite";
const userStore = useUserStore(); const userStore = useUserStore();
const carStore = useCarStore(); const carStore = useCarStore();
export default { export default {
data() { data() {
return { return {
sid: '', sid: '',
list: [], list: [],
statusBarHeight: 104, statusBarHeight: 104,
isLogin: false, isLogin: false,
form: { form: {
name: '', name: '',
phone: '' phone: ''
}, },
// 表单数据 // 表单数据
formData: {}, formData: {},
fields: {}, fields: {},
logo: '', logo: '',
server: [], server: [],
order: [], order: [],
regions, regions,
rules: { }
// 对name字段进行必填验证 },
name: { onLoad(o) {
rules: [{ this.sid = o.sid
required: true, this.reload()
errorMessage: '请输入收件人名称', },
}] methods: {
}, async reload(e) {
phone: { const app = this
rules: [{ // 当前登录用户信息
required: true, const userInfo = await userStore.fetchUserInfo();
format: 'number', if (Object.keys(userInfo).length > 0) {
errorMessage: '请输入正确的手机号码', app.isLogin = true
}] app.userInfo = userInfo
}, } else {
address: { app.isLogin = false
rules: [{ }
required: true, this.list = await listThinkSite({ids: this.sid})
errorMessage: '请输入详情地址', },
}] navTo(item) {
}, if (!this.isLogin) {
region: { this.$refs.login.open('bottom')
rules: [{ return false;
required: true, }
errorMessage: '请选择所在地区', openUrl(item);
}, { },
validateFunction: function(rule, value, data, callback) { // 弹出登录提示框
console.log('value: ', value); openLogin() {
if (value.length < 2) { if (!this.isLogin) {
callback('请至少勾选两个兴趣爱好') this.$refs.login.open('bottom')
} return false;
return true }
} },
}] }
} }
}
}
},
onLoad(o) {
this.sid = o.sid
this.reload()
},
methods: {
async reload(e) {
const app = this
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) {
app.isLogin = true
app.userInfo = userInfo
} else {
app.isLogin = false
}
// 获取收货地址列表
MerchantApi.pageMerchant({
merchantCodes: app.sid
}).then(res => {
app.list = res.list;
})
// 获取地区选择数据
// this.regions = this.regions.map(d => {
// console.log('d: ',d);
// d.text = d.label
// return d;
// })
// Api.getRegions().then(res => {
// console.log('res: ',res);
// })
},
navTo(item) {
if (!this.isLogin) {
this.$refs.login.open('bottom')
return false;
}
openUrl(item);
},
// 弹出登录提示框
openLogin() {
if (!this.isLogin) {
this.$refs.login.open('bottom')
return false;
}
},
onType(e){
this.formData.type = e.detail.value;
},
onIsDefault(){
this.formData.isDefault = !this.formData.isDefault;
},
// 选用该地址
onAddres(item){
carStore.setAddress(item)
uni.navigateBack()
},
add() {
this.formData = {}
this.$refs.addForm.open('center')
},
openEdit(item) {
this.formData = item
this.$refs.addForm.open('center')
},
remove(item) {
const app = this
uni.showModal({
title: '确定要删除吗?',
success(o) {
if (o.confirm) {
uni.showLoading({
title: '请求中.'
})
Api.removeUserAddress(item.id).then(res => {
uni.showToast({
title: '操作成功',
icon: 'none'
})
app.$refs.addForm.close()
app.reload()
})
app.reload()
}
}
});
},
// 触发提交表单
submit() {
this.$refs.form.validate().then(res => {
const saveOrUpdate = this.formData.id ? Api.updateUserAddress : Api.addUserAddress
saveOrUpdate(this.formData).then(message => {
uni.showToast({
title: '保存成功',
icon: 'success'
})
this.$refs.addForm.close()
this.reload()
}).catch((err) => {
console.log(err);
})
console.log('表单数据信息:', res);
}).catch(err => {
console.log('表单错误信息:', err);
})
},
save() {
Api.addUserAddress(this.form).then(msg => {
uni.showToast({
title: msg,
icon: 'none'
})
this.$refs.addForm.close()
this.reload()
}).catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
})
uni.hideLoading()
this.$refs.addForm.close()
this.reload()
})
}
}
}
</script> </script>
<style> <style>
page { page {
background-size: 100%; background-size: 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
background-color: #f0f2f5; background-color: #f0f2f5;
width: 750rpx; width: 750rpx;
overflow-x: hidden; overflow-x: hidden;
} }
</style> </style>
<style lang="scss"> <style lang="scss">
.avatar { .avatar {
padding: 20px; padding: 20px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
font-size: 14px; font-size: 14px;
} }
.save-user-profile { .save-user-profile {
width: 700rpx; width: 700rpx;
margin: 40rpx auto; margin: 40rpx auto;
} }
.add-address { .add-address {
width: 600rpx !important; width: 600rpx !important;
margin: 40rpx auto; margin: 40rpx auto;
} }
.btn-bar { .btn-bar {
width: 700rpx; width: 700rpx;
left: 25rpx; left: 25rpx;
position: fixed; position: fixed;
bottom: 30rpx; bottom: 30rpx;
margin: auto; margin: auto;
clear: both; clear: both;
} }
.title-bar { .title-bar {
display: flex; display: flex;
.web-text-heading { .web-text-heading {
margin-right: 20rpx; margin-right: 20rpx;
} }
.web-text-secondary { .web-text-secondary {
margin-right: 20rpx; margin-right: 20rpx;
} }
} }
</style> </style>
+60 -60
View File
@@ -1,76 +1,76 @@
<template> <template>
<view class="page"> <view class="page">
<!-- 其他功能 --> <!-- 其他功能 -->
<block v-for="(item, index) in list" :key="index"> <uni-card :border="false" :is-shadow="false" :padding="0">
<uni-card :border="false" :is-shadow="false" :padding="0"> <uv-cell-group>
<uv-cell :title="item.comments" :label="item.createTime" :value="`¥${item.price}`" :cellStyle="{ padding: '10px 0' }" :border="false"></uv-cell> <uv-cell :title="item.date" v-for="(item, index) in list" :key="index">
</uni-card> <template #value>
</block> <text v-if="item.order" class="text-green">已使用</text>
<!-- 登录组件 --> <text v-else class="text-gray">未使用</text>
<ws-login ref="login" :logo="logo" @done="reload" /> </template>
</view> </uv-cell>
</uv-cell-group>
</uni-card>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
</view>
</template> </template>
<script> <script>
import * as Api from '@/api/booking/userCardLog'; import {openUrl} from '@/utils/common';
import { openUrl } from '@/utils/common'; import {useUserStore} from '@/store/modules/user';
import { useUserStore } from '@/store/modules/user'; import {thinkUsersVipLog} from "@/api/think/thinkUsersVip";
const userStore = useUserStore(); const userStore = useUserStore();
export default { export default {
data() { data() {
return { return {
cardId: 0, cardId: 0,
list: [], list: [],
isLogin: false, isLogin: false,
logo: uni.getStorageSync('app_logo'), logo: uni.getStorageSync('app_logo'),
}; };
}, },
onLoad(o) { onLoad(o) {
this.cardId = o.id; this.cardId = o.id;
this.reload(); this.reload();
}, },
methods: { methods: {
async reload(e) { async reload(e) {
const app = this; const app = this;
const { cardId } = this; const {cardId} = this;
// 当前登录用户信息 // 当前登录用户信息
const userInfo = await userStore.fetchUserInfo(); const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) { if (Object.keys(userInfo).length > 0) {
app.isLogin = true; app.isLogin = true;
app.userInfo = userInfo; app.userInfo = userInfo;
} else { } else {
app.isLogin = false; app.isLogin = false; v
app.$refs.login.open('bottom'); app.$refs.login.open('bottom');
return false; return false;
} }
// 获取会员卡使用记录 // 获取会员卡使用记录
Api.pageUserCardLog({cardId}).then((res) => { this.list = await thinkUsersVipLog(this.cardId)
app.list = res.list.map(d => { },
d.createTime = uni.$uv.date(d.createTime,'yyyy-mm-dd hh:MM:ss') navTo(item) {
return d; if (!this.isLogin) {
}); this.$refs.login.open('bottom');
}); return false;
}, }
navTo(item) { openUrl(item);
if (!this.isLogin) { }
this.$refs.login.open('bottom'); }
return false;
}
openUrl(item);
}
}
}; };
</script> </script>
<style> <style>
page { page {
background-size: 100%; background-size: 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
background-color: #f0f2f5; background-color: #f0f2f5;
width: 750rpx; width: 750rpx;
overflow-x: hidden; overflow-x: hidden;
} }
</style> </style>
<style lang="scss"> <style lang="scss">
+359 -495
View File
@@ -1,548 +1,412 @@
<template> <template>
<view class="container"> <view class="container">
<!-- deBug信息 --> <!-- deBug信息 -->
<view class="web-debug web-text-success" style="display: none"> <view class="web-debug web-text-success">
场馆ID:{{ merchantId }} 场馆编号:{{ merchantCode }} 场馆名称:{{ merchantName }} 日期:{{ dateTime }} 星期:{{ week }} 订单总金额:{{ totalPrice }} 类型:{{ <view class="card-list">
type <view class="container"
}} :style="{ background: `url(https://oss.wsdns.cn/20240920/5e3327e1ad97472e942c824ab1776f52.jpg?x-oss-process=image/resize,m_fixed,w_750/quality,Q_90) no-repeat center center`, backgroundSize: '100%', opacity: '0.85' }">
商品信息:{{ goodsList }} <view class="content web-cell web-cell-align-top">
</view> <view class="card-info web-cell-content">
<view class="card-list"> <view class="title-bar">
<view class="container" :style="{ background: `url(${form.image}) no-repeat center center`, backgroundSize: '100%', opacity: '0.85' }"> <view class="web-text-heading" style="color: #ffffff; font-size: 17px; font-weight: 600">{{
<view class="content web-cell web-cell-align-top"> form.name
<view class="merchant-avatar"> }}
<uv-avatar :src="form.merchantAvatar" size="42" style="border: 3rpx solid #ffffff"></uv-avatar> </view>
</view> <view class="desc" style="font-size: 14px">{{ cardType[form.type] }}</view>
<view class="card-info web-cell-content"> <view class="mt-20" v-if="form.expireTime">
<view class="title-bar"> {{ dayjs(form.expireTime * 1000).format('YYYY-MM-DD HH:mm:ss') }} 过期
<view class="web-text-heading" style="color: #ffffff; font-size: 17px; font-weight: 600">{{ form.name }}</view> </view>
<view class="desc web-text-placeholder" style="font-size: 14px">{{ cardType[form.type] }}</view>
</view>
<view class="price" @click="openQrCode">
<view class="web-text-price">
<uv-avatar src="../../static/qrcode.png" size="30" shape="square"></uv-avatar>
</view>
</view>
</view>
</view>
<view class="card-num">{{ form.cardNum }}</view>
</view>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
</view>
<uni-card :border="false" :is-shadow="false" :padding="'12px 0'">
<view class="money-bar web-cell">
<view class="money-item web-cell-content">
<text>余额</text>
<text>{{ form.remainingMoney || 0.0 }}</text>
</view>
<view class="web-divider-vertical"></view>
<view class="money-item web-cell-content">
<text>剩余次数</text>
<text>{{ form.num || 0 }}</text>
</view>
<view class="web-divider-vertical"></view>
<view class="money-item web-cell-content">
<text>折扣</text>
<text>{{ form.discount || 0 }}</text>
</view>
</view>
</uni-card>
<view class="to-pay">
<uv-button :customStyle="{ width: '300rpx', borderRadius: '30px', color: '#3C8618' }" text="去使用" @click="navTo(`/package/user/card-detail-merchant?sid=${form.sid}`)"></uv-button>
</view>
<!-- <uni-card title="会员卡说明" :border="false" :is-shadow="false">
<view v-html="form.info"></view>
</uni-card> -->
<uni-card :border="false" :is-shadow="false" :padding="0">
<view class="server">
<uni-list :border="false">
<uni-list-item link @click="navTo(`/package/user/card-detail-about?id=${form.id}`)">
<template v-slot:body>
<view class="slot-box">
<text class="slot-text" :style="{ color: '#333333' }">会员卡详情</text>
</view>
</template>
</uni-list-item>
<uni-list-item link @click="navTo(`/package/user/card-detail-merchant?sid=${form.sid}`)">
<template v-slot:body>
<view class="slot-box">
<text class="slot-text" :style="{ color: '#333333' }">适用场馆</text>
</view>
</template>
</uni-list-item>
<uni-list-item link @click="navTo(`/package/user/card-detail-record?id=${form.id}`)">
<template v-slot:body>
<view class="slot-box">
<text class="slot-text" :style="{ color: '#333333' }">使用记录</text>
</view>
</template>
</uni-list-item>
<uni-list-item link @click="navTo(`/package/user/card-detail-invoice?id=${form.id}`)">
<template v-slot:body>
<view class="slot-box">
<text class="slot-text" :style="{ color: '#333333' }">申请开票</text>
</view> </view>
</template> <!-- <view class="price" @click="openQrCode">-->
</uni-list-item> <!-- <view class="web-text-price">-->
</uni-list> <!-- <uv-avatar src="../../static/qrcode.png" size="30" shape="square"></uv-avatar>-->
</view> <!-- </view>-->
</uni-card> <!-- </view>-->
</view>
</view>
<view class="card-num">{{ form.cardNum }}</view>
</view>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
</view>
</view> <uni-card :border="false" :is-shadow="false" :padding="'12px 0'">
<!-- 收货地址选择弹窗 --> <view class="money-bar web-cell">
<uni-popup ref="addForm" type="center" border-radius="10px 10px 0 0"> <view class="money-item web-cell-content">
<uni-card :border="false" :is-shadow="false" :padding="0"> <text>余额</text>
<view class="qrcode"> <text>{{ form.remainingMoney || 0.0 }}</text>
<uv-qrcode ref="qrcode" size="390rpx" </view>
:options="{data: form.cardNum,foregroundImageSrc: form.merchantAvatar, margin: 10,foregroundImagePadding: 4,foregroundImageHeight: 30,foregroundImageWidth: 30,foregroundImageBorderRadius: 4}" <view class="web-divider-vertical"></view>
:value="form.cardNum"></uv-qrcode> <view class="money-item web-cell-content">
<view class="card-num web-text-heading" style="font-size: 34rpx;">{{ form.cardNum }}</view> <text>剩余次数</text>
<text class="web-text-secondary">请在结账前出示会员卡</text> <text>{{ form.num || 0 }}</text>
</view> </view>
</uni-card> <view class="web-divider-vertical"></view>
</uni-popup> <view class="money-item web-cell-content">
<!-- 登录组件 --> <text>折扣</text>
<ws-login ref="login" :logo="logo" @done="reload" /> <text>{{ form.discount || 0 }}</text>
</view>
</view>
</uni-card>
<view class="to-pay">
<uv-button :customStyle="{ width: '300rpx', borderRadius: '30px', color: '#3C8618' }" text="去使用"
@click="navTo(`/package/user/card-detail-merchant?sid=${form.sid}`)"></uv-button>
</view>
<!-- <uni-card title="会员卡说明" :border="false" :is-shadow="false">
<view v-html="form.info"></view>
</uni-card> -->
<uni-card :border="false" :is-shadow="false" :padding="0">
<view class="server">
<uni-list :border="false">
<uni-list-item>
<template v-slot:body>
<view class="slot-box">
<view class="slot-text" :style="{ color: '#333333' }">会员卡详情</view>
<view class="text-25 mt-20">{{ form.info }}</view>
</view>
</template>
</uni-list-item>
<uni-list-item link @click="navTo(`/package/user/card-detail-merchant?sid=${form.sid}`)">
<template v-slot:header>
<view class="slot-box">
<text class="slot-text" :style="{ color: '#333333' }">适用场馆</text>
</view>
</template>
</uni-list-item>
<uni-list-item link @click="navTo(`/package/user/card-detail-record?id=${form.id}`)">
<template v-slot:header>
<view class="slot-box">
<text class="slot-text" :style="{ color: '#333333' }">使用记录</text>
</view>
</template>
</uni-list-item>
<!-- <uni-list-item link @click="navTo(`/package/user/invoice?id=${form.id}&orderNum=${form.wechatOrder}&itype=${form.itype}&price`)"-->
<!-- v-if="form.isInvoice === 2">-->
<!-- <template v-slot:body>-->
<!-- <view class="slot-box">-->
<!-- <text class="slot-text" :style="{ color: '#333333' }">申请开票</text>-->
<!-- </view>-->
<!-- </template>-->
<!-- </uni-list-item>-->
</uni-list>
</view>
</uni-card>
</view>
<!-- 收货地址选择弹窗 -->
<!-- <uni-popup ref="addForm" type="center" border-radius="10px 10px 0 0">-->
<!-- <uni-card :border="false" :is-shadow="false" :padding="0">-->
<!-- <view class="qrcode">-->
<!-- <uv-qrcode ref="qrcode" size="390rpx"-->
<!-- :options="{data: form.cardNum,foregroundImageSrc: form.merchantAvatar, margin: 10,foregroundImagePadding: 4,foregroundImageHeight: 30,foregroundImageWidth: 30,foregroundImageBorderRadius: 4}"-->
<!-- :value="form.cardNum"></uv-qrcode>-->
<!-- <view class="card-num web-text-heading" style="font-size: 34rpx;">{{ form.cardNum }}</view>-->
<!-- <text class="web-text-secondary">请在结账前出示会员卡</text>-->
<!-- </view>-->
<!-- </uni-card>-->
<!-- </uni-popup>-->
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="getInfo"/>
</view>
</template> </template>
<script> <script>
import * as Api from '@/api/booking/userCard'; import {getThinkUsersVip} from "@/api/think/thinkUsersVip";
import * as OrderApi from '@/api/shop/order'; import dayjs from "dayjs";
import * as MerchantApi from '@/api/shop/merchant';
import { storeToRefs } from 'pinia'; const cardType = ['', '年卡', '次卡', '月卡', '会员VIP卡', '充值卡'];
import { getWeek, getKey } from '@/utils/common';
import { useCarStore } from '@/store/modules/car';
import { useUserStore } from '@/store/modules/user';
const userStore = useUserStore();
const carStore = useCarStore();
const { goodsList, totalPrice, carNum, merchantId, merchantName, merchantCode, type, dateTime } = storeToRefs(carStore);
const cardType = ['年卡', '次卡', '月卡', 'IC卡', '充值卡'];
export default { export default {
data() { data() {
return { return {
id: 0, id: 0,
goodsId: 0, goodsId: 0,
userInfo: {}, form: {},
form: {}, address: {},
address: {}, addressList: [],
addressList: [], week: 0,
week: 0, cardType,
cardType, payType: 1,
goodsList, isLogin: false,
// 订单总金额 disabled: false
totalPrice, };
reducePrice: 0, },
merchantId, onLoad(option) {
merchantName, this.id = option.cardId;
merchantCode, this.getInfo();
getWeek, },
payType: 1, onShow() {
isLogin: false, // 登录状态
disabled: false if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
}; this.isLogin = true;
}, }
onLoad(option) { this.openLogin();
this.id = option.cardId; },
this.reload(); methods: {
}, dayjs,
onShow() { async getInfo() {
// 登录状态 this.form = await getThinkUsersVip(this.id)
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) { },
this.isLogin = true; onDisabled() {
} this.disabled = !this.disabled;
this.openLogin(); },
}, navTo(url) {
methods: { uni.navigateTo({
async reload() { url
const app = this; });
const { id } = this; },
openUrl(url) {
// 当前登录用户信息 if (!this.isLogin) {
const userInfo = await userStore.fetchUserInfo(); this.$refs.login.open('bottom');
app.userInfo = userInfo; return false;
} else {
Api.getUserCard(id).then((data) => { uni.navigateTo({
app.form = data; url
}); });
}
},
}, openQrCode() {
onDisabled() { this.$refs.addForm.open('center');
this.disabled = !this.disabled; },
}, // 弹出登录提示框
navTo(url) { openLogin() {
uni.navigateTo({ if (!this.isLogin) {
url this.$refs.login.open('bottom');
}); return false;
}, }
openUrl(url) { },
if (!this.isLogin) { }
this.$refs.login.open('bottom');
return false;
} else {
uni.navigateTo({
url
});
}
},
onAddress(item) {
this.address = item;
this.$refs.addForm.close();
},
// 切换支付方式
onPayType(index) {
console.log('e: ', index);
this.payType = index;
},
openQrCode() {
this.$refs.addForm.open('center');
},
// 弹出登录提示框
openLogin() {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
},
save() {
if (!this.disabled) {
uni.showToast({
title: '请先阅读并同意服务协议',
icon: 'none'
});
return false;
}
uni.showLoading({
title: '订单提交中.'
});
const app = this;
const { form, payType } = this;
OrderApi.addOrder({
type: 2, // 0商城订单 1预定订单 2会员卡订单
cardId: form.cardId,
merchantId: form.merchantId,
merchantName: form.merchantName,
totalPrice: form.price,
payPrice: form.price,
comments: form.cardName,
payType
})
.then((data) => {
const orderInfo = data;
// 调起微信支付
if (payType == 1) {
// #ifdef MP-WEIXIN
uni.requestPayment({
provider: orderInfo.provider, // 服务提供商
timeStamp: orderInfo.timeStamp, // 时间戳
nonceStr: orderInfo.nonceStr, // 随机字符串
package: orderInfo.package,
signType: orderInfo.signType, // 签名算法
paySign: orderInfo.paySign, // 签名
success: function (res) {
// 业务逻辑。。。
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(function () {
app.disabled = false;
uni.navigateTo({
url: '/package/user/card'
});
}, 500);
},
fail: function (err) {
console.log('支付失败', err);
app.disabled = false;
}
});
// #endif
}
// 使用余额支付
if (payType == 0) {
if (orderInfo) {
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(function () {
app.disabled = false;
uni.navigateTo({
url: '/package/user/card'
});
}, 500);
return;
}
if (!orderInfo) {
return uni.showToast({
title: '支付失败',
icon: 'error'
});
}
}
uni.hideLoading();
})
.catch((res) => {
uni.showToast({
title: res.message || '请检查您的网络.',
icon: 'none'
});
uni.hideLoading();
});
}
}
}; };
</script> </script>
<style> <style>
page { page {
background-size: 100%; background-size: 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
background-color: #f0f2f5; background-color: #f0f2f5;
width: 750rpx; width: 750rpx;
overflow-x: hidden; overflow-x: hidden;
} }
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
.checkout-car {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
display: flex;
justify-content: space-between;
background-color: #000000;
border-radius: 100px;
align-items: center;
.car-selected {
color: #ccc;
display: flex;
align-items: center;
padding: 0 20rpx;
}
.car-total {
display: flex;
color: #ebcf00;
align-items: center;
padding-left: 40rpx;
.save-btn {
}
}
}
.card-list { .card-list {
.container { .container {
width: 700rpx; width: 700rpx;
position: relative; position: relative;
margin: 25rpx auto; margin: 25rpx auto;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
border-radius: 20rpx; border-radius: 20rpx;
position: relative; position: relative;
box-shadow: 0 0px 6px 0 rgba(0, 0, 0, 0.2); box-shadow: 0 0px 6px 0 rgba(0, 0, 0, 0.2);
// background: linear-gradient(to right, #70b915, #008e04); // background: linear-gradient(to right, #70b915, #008e04);
color: #ffffff; color: #ffffff;
.card-num {
position: absolute;
z-index: 1;
bottom: 30rpx;
left: 30rpx;
}
}
.container::before { .card-num {
content: ''; position: absolute;
display: block; z-index: 1;
position: absolute; bottom: 30rpx;
border-radius: 20rpx; left: 30rpx;
top: 0; }
left: 0; }
right: 0;
bottom: 0;
background: #000000;
// background: url('https://oss.wsdns.cn/20240528/cf37a247603f489ba23d7d2a53b8da39.jpeg') no-repeat center bottom;
background-size: 100%;
opacity: 0.25; /* 设置透明度 */
}
.content { .container::before {
position: relative; content: '';
z-index: 1; display: block;
width: 700rpx; position: absolute;
height: 370rpx; border-radius: 20rpx;
display: flex; top: 0;
justify-content: space-between; left: 0;
.merchant-avatar { right: 0;
margin-top: 30rpx; bottom: 0;
margin-left: 30rpx; background: #000000;
} // background: url('https://oss.wsdns.cn/20240528/cf37a247603f489ba23d7d2a53b8da39.jpeg') no-repeat center bottom;
.card-info { background-size: 100%;
height: 120rpx; opacity: 0.25; /* 设置透明度 */
margin-top: 10rpx; }
margin-left: 10rpx;
display: flex;
justify-content: space-between;
align-items: center;
.title-bar {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
}
.web-text-price {
padding-right: 40rpx;
font-size: 36rpx;
color: #fecc66;
}
}
.card-bg {
}
}
.card-item {
width: 700rpx;
margin: 20rpx auto;
border-radius: 20rpx;
position: relative;
// box-shadow: 0 0px 6px 1px rgba($color: #a5a5a5, $alpha: 0.2);
}
// .card-item::before {
// content: ''; /* 伪元素需要内容,即使它是空的 */
// position: absolute;
// top: 0;
// right: 0;
// bottom: 0;
// left: 0;
// background: url('https://oss.wsdns.cn/20240528/d5680e18210544a49dfa79f250f1997d.jpeg');
// background-size: cover; /* 或其他你需要的背景大小 */
// opacity: 0.5; /* 设置透明度 */
// z-index: -1; /* 确保伪元素在内容之下 */
// }
.order-title {
padding: 20rpx 0;
.merchant-avatar { .content {
margin-right: 12rpx; position: relative;
} z-index: 1;
width: 700rpx;
height: 370rpx;
display: flex;
justify-content: space-between;
.card-name { .merchant-avatar {
font-weight: 600; margin-top: 30rpx;
} margin-left: 30rpx;
}
.btn-status { .card-info {
font-size: 30rpx; height: 120rpx;
display: flex; margin-top: 30rpx;
} margin-left: 10rpx;
} display: flex;
justify-content: space-between;
align-items: center;
.order-body { .title-bar {
padding: 16px 0; display: flex;
} flex-direction: column;
justify-content: space-between;
align-items: flex-start;
}
.web-text-price {
padding-right: 40rpx;
font-size: 36rpx;
color: #fecc66;
}
}
.card-bg {
}
}
.card-item {
width: 700rpx;
margin: 20rpx auto;
border-radius: 20rpx;
position: relative;
// box-shadow: 0 0px 6px 1px rgba($color: #a5a5a5, $alpha: 0.2);
}
// .card-item::before {
// content: ''; /* 伪元素需要内容,即使它是空的 */
// position: absolute;
// top: 0;
// right: 0;
// bottom: 0;
// left: 0;
// background: url('https://oss.wsdns.cn/20240528/d5680e18210544a49dfa79f250f1997d.jpeg');
// background-size: cover; /* 或其他你需要的背景大小 */
// opacity: 0.5; /* 设置透明度 */
// z-index: -1; /* 确保伪元素在内容之下 */
// }
.order-title {
padding: 20rpx 0;
.merchant-avatar {
margin-right: 12rpx;
}
.card-name {
font-weight: 600;
}
.btn-status {
font-size: 30rpx;
display: flex;
}
}
.order-body {
padding: 16px 0;
}
} }
.card-actions { .card-actions {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: flex-end; justify-content: flex-end;
height: 45px; height: 45px;
border-top: 1px #eee solid; border-top: 1px #eee solid;
} }
.card-actions-item { .card-actions-item {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
.web-text-heading { .web-text-heading {
font-size: 38rpx; font-size: 38rpx;
margin-left: 28rpx; margin-left: 28rpx;
} }
} }
.card-actions-item-text { .card-actions-item-text {
font-size: 12px; font-size: 12px;
color: #666; color: #666;
margin-left: 5px; margin-left: 5px;
} }
.address-body { .address-body {
width: 660rpx; width: 660rpx;
margin: auto; margin: auto;
} }
.to-pay { .to-pay {
width: 600rpx !important; width: 600rpx !important;
margin: 40rpx auto; margin: 40rpx auto;
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.btn-bar { .btn-bar {
width: 700rpx; width: 700rpx;
left: 25rpx; left: 25rpx;
position: fixed; position: fixed;
bottom: 30rpx; bottom: 30rpx;
margin: auto; margin: auto;
clear: both; clear: both;
} }
.title-bar { .title-bar {
display: flex; display: flex;
.web-text-heading { .web-text-heading {
margin-right: 20rpx; margin-right: 20rpx;
} }
.web-text-secondary { .web-text-secondary {
margin-right: 20rpx; margin-right: 20rpx;
} }
} }
.xieyi { .xieyi {
margin-bottom: 80rpx; margin-bottom: 80rpx;
padding: 0 30rpx; padding: 0 30rpx;
.text { .text {
margin-left: 5rpx; margin-left: 5rpx;
.link { .link {
color: #0f80ff; color: #0f80ff;
} }
} }
} }
.money-bar { .money-bar {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
align-items: center; align-items: center;
.money-item {
text-align: center; .money-item {
display: flex; text-align: center;
flex-direction: column; display: flex;
} flex-direction: column;
.web-divider-vertical { }
height: 60rpx;
width: 1rpx; .web-divider-vertical {
background-color: #e6e6e6; height: 60rpx;
} width: 1rpx;
background-color: #e6e6e6;
}
} }
.qrcode{
width: 600rpx; .qrcode {
height: 600rpx; width: 600rpx;
margin: 30rpx auto; height: 600rpx;
line-height: 2rem; margin: 30rpx auto;
background-color: #ffffff; line-height: 2rem;
text-align: center; background-color: #ffffff;
display: flex; text-align: center;
justify-content: center; display: flex;
flex-direction: column; justify-content: center;
align-items: center; flex-direction: column;
align-items: center;
} }
</style> </style>
+1 -1
View File
@@ -29,7 +29,7 @@
<view class="desc web-text-heading" style="color: #ffffff; font-size: 14px">{{ item.month }}个月</view> <view class="desc web-text-heading" style="color: #ffffff; font-size: 14px">{{ item.month }}个月</view>
</block> --> </block> -->
<view v-if="item.type === 2" class="desc web-text-heading" style="color: #ffffff; font-size: 14px">剩余{{ <view v-if="item.type === 2" class="desc web-text-heading" style="color: #ffffff; font-size: 14px">剩余{{
item.number item.num
}}次 }}次
</view> </view>
<view v-if="item.type === 5" class="desc web-text-heading" style="color: #ffffff; font-size: 14px">余额¥{{ <view v-if="item.type === 5" class="desc web-text-heading" style="color: #ffffff; font-size: 14px">余额¥{{
+159
View File
@@ -0,0 +1,159 @@
<template>
<view class="bg-gray-light min-height card-body">
<uni-grid :column="3" borderColor="transparent" :highlight="true" @change="change">
<uni-grid-item v-for="(item, index) in merchant" :index="index" :key="index">
<view class="merchant-card" style="display: flex; flex-direction: column">
<image :src="item.thumb" mode="widthFix" class="merchant-image"/>
<text class="merchant-name">{{ item.name }}</text>
</view>
</uni-grid-item>
</uni-grid>
<uv-popup ref="popup" mode="center" round="15" :closeOnClickOverlay="false">
<view class="p-50">
<view class="text-center my-20">请选择押金项目</view>
<view v-for="(item, index) in depositList" :key="index"
@click="setDeposit(item)"
class="border rounded mb-20 flex justify-between items-center p-30 text-25">
<text>{{ item.title }}</text>
<text class="text-red font-bold">¥{{ item.amount }}</text>
</view>
<view class="mt-20 flex justify-center items-center">
<uv-button @click="hidePopup" type="primary" shape="circle" :custom-style="{width: '400rpx'}">
关闭
</uv-button>
</view>
</view>
</uv-popup>
</view>
</template>
<script setup>
import {ref} from 'vue'
import {listThinkSite} from "@/api/think/thinkSite";
import {listThinkDepositItem} from "@/api/think/thinkDepositItem";
import {addThinkDeposit} from "@/api/think/thinkDeposit";
const merchant = ref([])
const getMerchantList = async () => {
merchant.value = await listThinkSite()
}
getMerchantList()
const popup = ref()
const siteId = ref()
const siteName = ref()
const depositList = ref([])
const getDepositList = async () => {
depositList.value = await listThinkDepositItem({siteId: siteId.value})
if (depositList.value.length === 0) {
return uni.showToast({
title: '暂无押金项目',
icon: 'none'
})
}
popup.value.open()
}
const hidePopup = () => {
popup.value.close()
}
const change = ({detail: {index}}) => {
siteId.value = merchant.value[index].id
siteName.value = merchant.value[index].name
getDepositList()
}
const setDeposit = async ({amount, title}) => {
uni.showModal({
title: '请输入备注(如20号)',
content: '',
editable: true,
success: async res => {
if (res.confirm) {
if (!res.content) {
return uni.showToast({
title: '备注不能为空',
icon: 'none'
})
}
if (res.content.length > 10) {
return uni.showToast({
title: '备注最多只能输入10个字',
icon: 'none'
})
}
hidePopup()
const orderInfo = await addThinkDeposit({
type: 1,
moneyType: 1,
siteName: siteName.value,
money: amount,
info: `${title}(${res.content})`,
})
// console.log(orderInfo)
uni.requestPayment({
provider: orderInfo.provider, // 服务提供商
timeStamp: orderInfo.timeStamp, // 时间戳
nonceStr: orderInfo.nonceStr, // 随机字符串
package: orderInfo.package,
signType: orderInfo.signType, // 签名算法
paySign: orderInfo.paySign, // 签名
success: function (res) {
uni.showToast({
title: '支付成功',
icon: 'success'
});
setTimeout(function () {
uni.switchTab({
url: '/pages/order'
});
}, 500);
},
fail: function (err) {
console.log('支付失败', err);
uni.switchTab({
url: '/pages/order'
});
}
})
}
}
})
}
</script>
<style lang="scss" scoped>
.card-body {
width: 740rpx;
margin: auto;
.merchant-card {
margin: 12rpx auto;
background: #ffffff;
border-color: slategrey;
border-radius: 16rpx;
.merchant-image {
width: 200rpx;
border-radius: 16rpx 16rpx 0 0;
height: 140rpx !important;
}
.merchant-name {
padding: 10rpx;
font-weight: 500;
font-size: 26rpx;
text-align: center;
}
.merchant-desc {
width: 400rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
</style>
+70
View File
@@ -0,0 +1,70 @@
<template>
<view class="min-height bg-gray-light">
<view class="card m-20 shadow flex justify-start items-center" style="margin-bottom: 30rpx; padding: 30rpx"
@click="toSite">
<uv-icon name="map-fill" color="#53AB32" size="80rpx"></uv-icon>
<view class="flex flex-col justify-start items-start">
<text class="text-35 font-bold">场馆线路导航</text>
<text class="text-22 text-gray mt-20">查看广西体育中心内各个场馆的导航线路</text>
</view>
</view>
<view class="card m-20 shadow" style="margin-bottom: 30rpx; padding: 30rpx"
@click="showBus = !showBus">
<view class="flex justify-start items-center">
<uv-icon name="map-fill" color="#EA3525" size="80rpx"></uv-icon>
<view class="flex flex-col justify-start items-start">
<text class="text-35 font-bold">公交交通线路导航</text>
<text class="text-22 text-gray mt-20">查看前往广西体育中心的公共交通线路</text>
</view>
</view>
<view class="mt-20" v-if="showBus">
<uv-image :src="busImg" width="100%" @click="preview"></uv-image>
</view>
</view>
<view class="card m-20 shadow flex justify-start items-center" style="margin-bottom: 30rpx; padding: 30rpx"
@click="toMap(108.38954, 22.7629, '广西体育中心')">
<uv-icon name="map-fill" color="#2053F3" size="80rpx"></uv-icon>
<view class="flex flex-col justify-start items-start">
<text class="text-35 font-bold">驾车线路导航</text>
<text class="text-22 text-gray mt-20">一键导航至广西体育中心</text>
</view>
</view>
</view>
</template>
<script setup>
import {ref} from 'vue'
import coordtransform from "coordtransform";
import {listDictData} from "@/api/system/dict-data";
const toMap = (longitude, latitude, name) => {
const [lng, lat] = coordtransform.wgs84togcj02(longitude, latitude)
uni.openLocation({
type: 'gcj02',
latitude: lat,
longitude: lng,
scale: 13,
name,
})
}
const toSite = () => {
uni.navigateTo({
url: '/package/user/siteGuide'
})
}
const showBus = ref(false)
const busImg = ref('')
const getBusImg = async () => {
const res = await listDictData({dictId: 924})
busImg.value = res[0].dictDataCode
}
getBusImg()
const preview = () => {
uni.previewImage({
urls: [busImg.value]
})
}
</script>
+58 -52
View File
@@ -8,13 +8,19 @@
<uni-card title="卡片信息" :border="false" :is-shadow="false" :padding="'10px 6px'"> <uni-card title="卡片信息" :border="false" :is-shadow="false" :padding="'10px 6px'">
<uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="80"> <uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="80">
<uni-forms-item label="卡号" name="cardNum" required> <uni-forms-item label="卡号" name="cardNum" required>
<uv-input placeholder="请输入您的IC卡号" v-model="formData.cardNum" maxlength="20"></uv-input> <view class="flex justify-start items-center">
<uv-input placeholder="请输入您的IC卡号" v-model="formData.cardNum" maxlength="20"></uv-input>
<view class="ml-20">
<uv-icon name="https://oss.wsdns.cn/20241203/11efb736da8b4567b15eed06a62dd760.png" @click="scan"
size="60rpx"/>
</view>
</view>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="姓名" name="username" required> <uni-forms-item label="姓名" name="username" required>
<uv-input placeholder="请输入您的姓名" v-model="formData.username" maxlength="6"></uv-input> <uv-input placeholder="请输入您的姓名" v-model="formData.username"></uv-input>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="手机号码" name="phone" required> <uni-forms-item label="手机号码" name="phone" required>
<uv-input placeholder="请输入您的手机号码" v-model="formData.phone" maxlength="11"></uv-input> <uv-input placeholder="请输入您的手机号码" v-model="formData.phone" maxlength="11" disabled></uv-input>
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
</uni-card> </uni-card>
@@ -27,31 +33,31 @@
<view class="btn-bar"> <view class="btn-bar">
<uv-button <uv-button
class="save-user-profile" class="save-user-profile"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }" :customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }"
text="立即激活" text="立即激活"
@click="submit" @click="submit"
></uv-button> ></uv-button>
</view> </view>
<!-- 登录组件 --> <!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/> <ws-login ref="login" :logo="logo" @done="reload"/>
<!-- EmergencyEdit弹窗 --> <!-- EmergencyEdit弹窗 -->
<uni-popup ref="addForm" type="center" border-radius="10px 10px 0 0"> <uni-popup ref="addForm" type="center" border-radius="10px 10px 0 0">
<uni-card title="添加联系人" :border="false" :is-shadow="false" :padding="0"> <uni-card title="添加紧急联系人" :border="false" :is-shadow="false" :padding="0">
<uv-form labelPosition="left" :model="form" :rules="rules" ref="form"> <uv-form labelPosition="left" :model="form" :rules="rules" ref="form">
<uv-form-item label="姓名" prop="userInfo.name" borderBottom> <uv-form-item label="姓名" prop="userInfo.name" borderBottom>
<uv-input placeholder="请输入姓名" v-model="form.name" maxlength="11" <uv-input placeholder="请输入姓名" v-model="form.name" maxlength="11"
:customStyle="{ margin: '10px 0' }"></uv-input> :customStyle="{ margin: '10px 0' }"></uv-input>
</uv-form-item> </uv-form-item>
<uv-form-item label="性别" prop="userInfo.sex" borderBottom @click="showSexSelect"> <uv-form-item label="手机号码" borderBottom>
<uv-input placeholder="请输入手机号码" v-model="form.phone" maxlength="11" <uv-input placeholder="请输入手机号码" v-model="form.phone" maxlength="11"
:customStyle="{ margin: '10px 0' }"></uv-input> :customStyle="{ margin: '10px 0' }"></uv-input>
</uv-form-item> </uv-form-item>
<uv-button <uv-button
class="add-emergency" class="add-emergency"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }" :customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }"
text="保存" text="保存"
@click="save" @click="save"
></uv-button> ></uv-button>
</uv-form> </uv-form>
</uni-card> </uni-card>
@@ -68,7 +74,9 @@ import {openUrl} from '@/utils/common';
import {useTenantStore} from '@/store/modules/tenant'; import {useTenantStore} from '@/store/modules/tenant';
import {pad} from 'crypto-js'; import {pad} from 'crypto-js';
import {bindCard} from "@/api/think/thinkCard"; import {bindCard, updateThinkCard} from "@/api/think/thinkCard";
import {thinkUserInfo} from "@/api/think/thinkUsers";
import {getThinkOrderByCode} from "@/api/think/thinkOrder";
const tenantStore = useTenantStore(); const tenantStore = useTenantStore();
@@ -81,14 +89,14 @@ export default {
statusBarHeight: 104, statusBarHeight: 104,
isLogin: false, isLogin: false,
form: { form: {
name: '', cardNum: '',
phone: '' username: '',
phone: '',
}, },
// 表单数据 // 表单数据
formData: {}, formData: {},
fields: {}, fields: {},
logo: '', logo: '',
bookingUser: {},
server: [], server: [],
order: [] order: []
}; };
@@ -97,26 +105,22 @@ export default {
this.reload(); this.reload();
}, },
methods: { methods: {
async getThinkUser() {
const res = await thinkUserInfo();
this.formData.username = res.username;
this.formData.phone = res.phone;
},
async reload(e) { async reload(e) {
const app = this; const app = this;
Api.pageThinkCard({}).then(res => {
console.log(res)
})
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo(); const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) { if (Object.keys(userInfo).length > 0) {
app.isLogin = true; app.isLogin = true;
app.userInfo = userInfo; app.userInfo = userInfo;
await this.getThinkUser()
} else { } else {
app.isLogin = false; app.isLogin = false;
} }
// 获取联系人列表
// Api.pageEmergency({
// userId: userInfo.userId
// }).then((res) => {
// app.list = res.list;
// });
}, },
navTo(item) { navTo(item) {
if (!this.isLogin) { if (!this.isLogin) {
@@ -135,41 +139,43 @@ export default {
add() { add() {
this.$refs.addForm.open('center'); this.$refs.addForm.open('center');
}, },
onDel(item) {
const app = this;
uni.showModal({
title: '确定要删除吗?',
success(o) {
if (o.confirm) {
uni.showLoading({
title: '请求中.'
});
// Api.removeEmergency(item.emergencyId).then((res) => {
// uni.showToast({
// title: '操作成功',
// icon: 'none'
// });
// });
app.reload();
}
}
});
},
// 触发提交表单 // 触发提交表单
submit() { submit() {
this.$refs.form.validate().then(res => { this.$refs.form.validate().then(async () => {
Api.bindCard(this.formData).then(res => { const res = await bindCard(this.formData).catch(err => {
console.log(res)
}).catch(err => {
uni.showToast({ uni.showToast({
title: err.message, title: err.message,
icon: 'none' icon: 'none'
}) })
}); })
if (res) {
uni.showToast({
title: '绑定成功',
icon: 'none'
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
}
}).catch(err => { }).catch(err => {
console.log('表单错误信息:', err); console.log('表单错误信息:', err);
}) })
}, },
scan() {
uni.scanCode({
onlyFromCamera: true,
success: async ({result}) => {
this.formData.cardNum = result
},
fail: (err) => {
uni.showToast({
title: '扫码失败',
icon: 'none'
})
}
});
}
} }
}; };
</script> </script>
+256 -236
View File
@@ -1,268 +1,288 @@
<template> <template>
<view class="page"> <view class="page">
<uni-card :border="false" :is-shadow="false" :padding="20"> <uni-card :border="false" :is-shadow="false" :padding="20">
<uni-forms ref="form" :modelValue="formData" :rules="rules" label-position="top"> <uni-forms ref="form" :modelValue="formData" :rules="rules" label-position="top" label-width="200rpx">
<uni-forms-item label="抬头类型" name="isCompany"> <uni-forms-item label="抬头类型" name="isCompany">
<uni-data-checkbox v-model="formData.isCompany" :localdata="type" /> <uni-data-checkbox v-model="formData.isCompany" :localdata="type"/>
</uni-forms-item> </uni-forms-item>
<block v-if="formData.isCompany == 0"> <block v-if="formData.isCompany == 0">
<uni-forms-item label="名称" name="name" required> <uni-forms-item label="名称" name="name" required>
<uv-input class="input" v-model="formData.name" type="text" placeholder="真实姓名(必填)" /> <uv-input class="input" v-model="formData.name" type="text" placeholder="真实姓名(必填)"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="手机号码" name="phone" required> <uni-forms-item label="税号/身份证号" name="invoiceCode" required>
<uv-input class="input" v-model="formData.phone" type="text" placeholder="手机号码" /> <uv-input class="input" v-model="formData.invoiceCode" type="text" placeholder="税号/身份证号(必填)"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="电子邮箱" name="email" required> <uni-forms-item label="手机号码">
<uv-input class="input" v-model="formData.email" type="text" placeholder="电子邮箱" /> <uv-input class="input" v-model="formData.phone" type="text" placeholder="手机号码"/>
</uni-forms-item> </uni-forms-item>
</block> <uni-forms-item label="电子邮箱">
<block v-if="formData.isCompany == 1"> <uv-input class="input" v-model="formData.email" type="text" placeholder="电子邮箱"/>
<uni-forms-item label="名称" name="name" required> </uni-forms-item>
<uv-input class="input" v-model="formData.name" type="text" placeholder="单位名称(必填)" /> </block>
</uni-forms-item> <block v-if="formData.isCompany == 1">
<uni-forms-item label="税号" name="invoiceCode" required> <uni-forms-item label="名称" name="name" required>
<uv-input class="input" v-model="formData.invoiceCode" type="text" placeholder="纳税人识别号(必填)" /> <uv-input class="input" v-model="formData.name" type="text" placeholder="单位名称(必填)"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="手机号码" name="phone" required> <uni-forms-item label="税号" name="invoiceCode" required>
<uv-input class="input" v-model="formData.phone" type="text" placeholder="手机号码" /> <uv-input class="input" v-model="formData.invoiceCode" type="text" placeholder="纳税人识别号(必填)"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="电子邮箱" name="email" required> <uni-forms-item label="手机号码" name="phone" required>
<uv-input class="input" v-model="formData.email" type="text" placeholder="电子邮箱" /> <uv-input class="input" v-model="formData.phone" type="text" placeholder="手机号码"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="开户行" name="bankName" required> <uni-forms-item label="电子邮箱" name="email" required>
<uv-input class="input" v-model="formData.bankName" type="text" placeholder="开户银行名称" /> <uv-input class="input" v-model="formData.email" type="text" placeholder="电子邮箱"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="银行账号" name="bankAccount" required> <uni-forms-item label="开户行">
<uv-input class="input" v-model="formData.bankAccount" type="text" placeholder="开户银行账号" /> <uv-input class="input" v-model="formData.bankName" type="text" placeholder="开户银行名称"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="单位地址" name="address" required> <uni-forms-item label="银行账号">
<uv-input class="input" v-model="formData.address" type="text" placeholder="单位地址" /> <uv-input class="input" v-model="formData.bankAccount" type="text" placeholder="开户银行账号"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="单位电话" name="tel" required> <uni-forms-item label="单位地址">
<uv-input class="input" v-model="formData.tel" type="text" placeholder="单位电话" /> <uv-input class="input" v-model="formData.address" type="text" placeholder="单位地址"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="备注" name="comments"> <uni-forms-item label="单位电话">
<uv-textarea v-model="formData.comments" placeholder="请输入备注信息" auto-height></uv-textarea> <uv-input class="input" v-model="formData.tel" type="text" placeholder="单位电话"/>
</uni-forms-item> </uni-forms-item>
</block> <uni-forms-item label="备注">
<uv-button <uv-textarea v-model="formData.comments" placeholder="请输入备注信息" auto-height></uv-textarea>
class="add-emergency" </uni-forms-item>
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }" </block>
text="保存" <uv-button
@click="submit" class="add-emergency"
></uv-button> :customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }"
</uni-forms> text="保存"
</uni-card> @click="submit"
</view> ></uv-button>
</uni-forms>
</uni-card>
</view>
</template> </template>
<script> <script>
import { useUserStore } from '@/store/modules/user'; import {useUserStore} from '@/store/modules/user';
import * as Api from '@/api/booking/userInvoice'; import * as Api from '@/api/booking/userInvoice';
import { openUrl } from '@/utils/common'; import {openUrl} from '@/utils/common';
import { useTenantStore } from '@/store/modules/tenant'; import {useTenantStore} from '@/store/modules/tenant';
const tenantStore = useTenantStore(); const tenantStore = useTenantStore();
const userStore = useUserStore(); const userStore = useUserStore();
export default { export default {
data() { data() {
return { return {
list: [], list: [],
statusBarHeight: 104, statusBarHeight: 104,
isLogin: false, isLogin: false,
fields: {}, fields: {},
logo: '', logo: '',
bookingUser: {}, bookingUser: {},
server: [], server: [],
order: [], order: [],
// 表单数据 // 表单数据
formData: { formData: {
type: 0, type: 0,
invoiceType: 0 invoiceType: 0
}, },
// 发票类型 // 发票类型
type: [ type: [
{ {
text: '个人', text: '个人',
value: 0 value: 0
}, },
{ {
text: '单位', text: '单位',
value: 1 value: 1
} }
], ],
// 开票类型 // 开票类型
invoiceType: [ invoiceType: [
{ {
text: '普票', text: '普票',
value: 0 value: 0
}, },
{ {
text: '专票', text: '专票',
value: 1 value: 1
} }
], ],
rules: { rules: {
// 对name字段进行必填验证 // 对name字段进行必填验证
name: { name: {
rules: [ rules: [
{ {
required: true, required: true,
errorMessage: '请输入开票名称' errorMessage: '请输入开票名称'
} }
] ]
}, },
// 对email字段进行必填验证 // 对email字段进行必填验证
email: { email: {
rules: [ rules: [
{ {
format: 'email', required: true,
errorMessage: '请输入正确的邮箱地址' format: 'email',
} errorMessage: '请输入邮箱地址'
] }
} ]
} },
}; phone: {
}, rules: [
onLoad() { {
this.reload(); required: true,
}, errorMessage: '请输入手机号'
methods: { }
async reload() { ]
const app = this; },
// 当前登录用户信息 invoiceCode: {
const userInfo = await userStore.fetchUserInfo(); rules: [
if (Object.keys(userInfo).length > 0) { {
app.isLogin = true; required: true,
app.userInfo = userInfo; errorMessage: '请输入税号'
} else { }
app.isLogin = false; ]
} }
}
};
},
onLoad() {
this.reload();
},
methods: {
async reload() {
const app = this;
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) {
app.isLogin = true;
app.userInfo = userInfo;
} else {
app.isLogin = false;
}
// 读取最后一次 // 读取最后一次
Api.pageUserInvoice({ Api.pageUserInvoice({
userId: userInfo.userId, userId: userInfo.userId,
limit: 1 limit: 1
}).then((res) => { }).then((res) => {
if (res.count > 0 && !app.formData.id) { if (res.count > 0 && !app.formData.id) {
app.formData = res.list[0]; app.formData = res.list[0];
} }
}); });
}, },
navTo(item) { navTo(item) {
if (!this.isLogin) { if (!this.isLogin) {
this.$refs.login.open('bottom'); this.$refs.login.open('bottom');
return false; return false;
} }
openUrl(item); openUrl(item);
}, },
// 弹出登录提示框 // 弹出登录提示框
openLogin() { openLogin() {
if (!this.isLogin) { if (!this.isLogin) {
this.$refs.login.open('bottom'); this.$refs.login.open('bottom');
return false; return false;
} }
}, },
add() { add() {
this.$refs.addForm.open('center'); this.$refs.addForm.open('center');
}, },
onDel(item) { onDel(item) {
const app = this; const app = this;
uni.showModal({ uni.showModal({
title: '确定要删除吗?', title: '确定要删除吗?',
success(o) { success(o) {
if (o.confirm) { if (o.confirm) {
uni.showLoading({ uni.showLoading({
title: '请求中.' title: '请求中.'
}); });
Api.removeUserInvoice(item.id).then((res) => { Api.removeUserInvoice(item.id).then((res) => {
uni.showToast({ uni.showToast({
title: '操作成功', title: '操作成功',
icon: 'none' icon: 'none'
}); });
}); });
app.reload(); app.reload();
} }
} }
}); });
}, },
/** /**
* 复写 binddata 方法,如果只是为了校验,无复杂自定义操作,可忽略此方法 * 复写 binddata 方法,如果只是为了校验,无复杂自定义操作,可忽略此方法
* @param {String} name 字段名称 * @param {String} name 字段名称
* @param {String} value 表单域的值 * @param {String} value 表单域的值
*/ */
// binddata(name,value){ // binddata(name,value){
// // 通过 input 事件设置表单指定 name 的值 // // 通过 input 事件设置表单指定 name 的值
// this.$refs.form.setValue(name, value) // this.$refs.form.setValue(name, value)
// }, // },
// 触发提交表单 // 触发提交表单
submit() { submit() {
this.$refs.form this.$refs.form
.validate() .validate()
.then((res) => { .then((res) => {
const saveOrUpdate = this.formData.id ? Api.updateUserInvoice : Api.addUserInvoice; const saveOrUpdate = this.formData.id ? Api.updateUserInvoice : Api.addUserInvoice;
saveOrUpdate(this.formData) saveOrUpdate(this.formData)
.then((message) => { .then((message) => {
uni.showToast({ uni.showToast({
title: '保存成功', title: '保存成功',
icon: 'success' icon: 'success'
}); });
setTimeout(() => { setTimeout(() => {
uni.navigateBack({ uni.navigateBack({
delta: 2 delta: 2
}) })
},1000) }, 1000)
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);
}); });
console.log('表单数据信息:', res); console.log('表单数据信息:', res);
}) })
.catch((err) => { .catch((err) => {
console.log('表单错误信息:', err); console.log('表单错误信息:', err);
}); });
} }
} }
}; };
</script> </script>
<style> <style>
page { page {
background-size: 100%; background-size: 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
background-color: #f0f2f5; background-color: #f0f2f5;
width: 750rpx; width: 750rpx;
overflow-x: hidden; overflow-x: hidden;
} }
</style> </style>
<style lang="scss"> <style lang="scss">
.avatar { .avatar {
padding: 20px; padding: 20px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
font-size: 14px; font-size: 14px;
} }
.save-user-profile { .save-user-profile {
width: 700rpx; width: 700rpx;
margin: 40rpx auto; margin: 40rpx auto;
} }
.add-emergency { .add-emergency {
width: 500rpx !important; width: 500rpx !important;
margin: 40rpx auto; margin: 40rpx auto;
} }
.btn-bar { .btn-bar {
width: 700rpx; width: 700rpx;
left: 25rpx; left: 25rpx;
position: fixed; position: fixed;
bottom: 30rpx; bottom: 30rpx;
margin: auto; margin: auto;
clear: both; clear: both;
} }
</style> </style>
+104 -108
View File
@@ -1,14 +1,18 @@
<template> <template>
<view class="container"> <view class="container">
<image class="responsive-image" :src="imgUrls" mode="widthFix" @click="onDown(pdfUrl)"></image> <view v-for="(item, index) in list" :key="index">
<uv-button @click="onDown(pdfUrl)">复制发票链接</uv-button> <image class="responsive-image" :src="item.imgUrls" mode="widthFix"
</view> @click="onDown(item.pdfUrl)"></image>
<uv-button @click="onDown(item.pdfUrl)">复制发票链接</uv-button>
</view>
</view>
</template> </template>
<script> <script>
// import { useUserStore } from '@/store/modules/user'; // import { useUserStore } from '@/store/modules/user';
import * as Api from '@/api/think/thinkInvoice'; import * as Api from '@/api/think/thinkInvoice';
import { copyText, openUrl } from '@/utils/common'; import {copyText, openUrl} from '@/utils/common';
import {showInvoice} from "@/api/booking/userInvoice";
// import { useTenantStore } from '@/store/modules/tenant'; // import { useTenantStore } from '@/store/modules/tenant';
// const tenantStore = useTenantStore(); // const tenantStore = useTenantStore();
@@ -16,117 +20,109 @@ import { copyText, openUrl } from '@/utils/common';
// const userStore = useUserStore(); // const userStore = useUserStore();
export default { export default {
data() { data() {
return { return {
isLogin: false, isLogin: false,
logo: '', logo: '',
imgUrls: '', list: [],
pdfUrl: '' pdfUrl: ''
}; };
}, },
onLoad(e) { onLoad(e) {
this.reload(e.id); this.reload(e.id);
}, },
methods: { methods: {
async reload(oid) { async reload(oid) {
const app = this; const app = this;
// 当前登录用户信息 // 当前登录用户信息
// const userInfo = await userStore.fetchUserInfo(); // const userInfo = await userStore.fetchUserInfo();
// if (Object.keys(userInfo).length > 0) { // if (Object.keys(userInfo).length > 0) {
// app.isLogin = true; // app.isLogin = true;
// app.userInfo = userInfo; // app.userInfo = userInfo;
// } else { // } else {
// app.isLogin = false; // app.isLogin = false;
// } // }
// 读取最后一次 // 读取最后一次showInvoice
await Api.pageThinkInvoice({oid}).then((res) => { await Api.pageThinkInvoice({oid}).then(async (res) => {
if (res) { if (res && res.list && res.list.length > 0) {
const json = JSON.parse(res); const invoiceRes = await showInvoice(res.list[0].id)
if (json.code) { this.list = JSON.parse(invoiceRes)
const result = json.result; }
console.log('json: ', json); });
console.log('json: ', json.code); },
console.log('result: ', result); navTo(item) {
if (result.length > 0) { if (!this.isLogin) {
app.imgUrls = result[0].imgUrls; this.$refs.login.open('bottom');
app.pdfUrl = result[0].pdfUrl; return false;
} }
} openUrl(item);
} },
}); // 弹出登录提示框
}, openLogin() {
navTo(item) { if (!this.isLogin) {
if (!this.isLogin) { this.$refs.login.open('bottom');
this.$refs.login.open('bottom'); return false;
return false; }
} },
openUrl(item); onDown(data) {
}, const app = this;
// 弹出登录提示框 // 复制发票
openLogin() { uni.setClipboardData({
if (!this.isLogin) { data,
this.$refs.login.open('bottom'); success: function () {
return false; console.log('success');
} },
}, complete: function (res) {
onDown(text) { }
const app = this; });
// 复制发票 uni.getClipboardData({
uni.setClipboardData({ success: function (res) {
data: app.pdfUrl, },
success: function () { complete: function (res) {
console.log('success'); }
}, });
complete: function (res) {}
});
uni.getClipboardData({
success: function (res) {
},
complete: function (res) {
}
});
}, },
saveFile(tempFilePath) { saveFile(tempFilePath) {
//保存到本地 //保存到本地
//文件保存到本地 //文件保存到本地
uni.saveFile({ uni.saveFile({
tempFilePath: tempFilePath, //临时路径 tempFilePath: tempFilePath, //临时路径
success: function (res) { success: function (res) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
mask: true, mask: true,
title: '文件已保存:' + res.savedFilePath, //保存路径 title: '文件已保存:' + res.savedFilePath, //保存路径
duration: 3000 duration: 3000
}); });
setTimeout(() => { setTimeout(() => {
//打开文档查看 //打开文档查看
uni.openDocument({ uni.openDocument({
filePath: res.savedFilePath, filePath: res.savedFilePath,
success: function (res) { success: function (res) {
// console.log('打开文档成功'); // console.log('打开文档成功');
} }
}); });
}, 3000); }, 3000);
} }
}); });
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.container { .container {
width: 100%; /* 确保容器宽度为100% */ width: 100%; /* 确保容器宽度为100% */
} }
.responsive-image { .responsive-image {
width: 750rpx; /* 图片宽度自适应容器宽度 */ width: 750rpx; /* 图片宽度自适应容器宽度 */
height: auto; /* 图片高度自适应宽度保持比例 */ height: auto; /* 图片高度自适应宽度保持比例 */
display: block; /* 避免图片下方出现空白 */ display: block; /* 避免图片下方出现空白 */
max-width: 100%; /* 最大宽度不超过父容器宽度 */ max-width: 100%; /* 最大宽度不超过父容器宽度 */
/* 可以设置最大高度限制,防止图片过高 */ /* 可以设置最大高度限制,防止图片过高 */
// max-height: 300px; /* 根据需要设置最大高度 */ // max-height: 300px; /* 根据需要设置最大高度 */
margin-bottom: 10px; margin-bottom: 10px;
} }
</style> </style>
+15 -13
View File
@@ -6,6 +6,7 @@
:cellStyle="{ padding: '5px 0' }" :cellStyle="{ padding: '5px 0' }"
:border="false" :border="false"
@click="switchTabTo(`/pages/order`)" @click="switchTabTo(`/pages/order`)"
icon="https://oss.wsdns.cn/20241206/eb94f79b4d9049999554e11bc355480e.png"
> >
<template v-slot:right-icon> <template v-slot:right-icon>
<uv-icon name="arrow-right"></uv-icon> <uv-icon name="arrow-right"></uv-icon>
@@ -17,25 +18,26 @@
:title="`租赁发票`" :title="`租赁发票`"
:cellStyle="{ padding: '5px 0' }" :cellStyle="{ padding: '5px 0' }"
:border="false" :border="false"
@click="navTo(`/package/user/card`)" @click="navTo(`/package/user/invoiceRent`)"
> icon="https://oss.wsdns.cn/20241206/51119131ac50427ca72272634f24e2a1.png"
<template v-slot:right-icon>
<uv-icon name="arrow-right"></uv-icon>
</template>
</uv-cell>
</uni-card>
<uni-card :border="false" :is-shadow="false">
<uv-cell
:title="`商城发票`"
:cellStyle="{ padding: '5px 0' }"
:border="false"
@click="navTo(`/package/goods/order`)"
> >
<template v-slot:right-icon> <template v-slot:right-icon>
<uv-icon name="arrow-right"></uv-icon> <uv-icon name="arrow-right"></uv-icon>
</template> </template>
</uv-cell> </uv-cell>
</uni-card> </uni-card>
<!-- <uni-card :border="false" :is-shadow="false">-->
<!-- <uv-cell-->
<!-- :title="`商城发票`"-->
<!-- :cellStyle="{ padding: '5px 0' }"-->
<!-- :border="false"-->
<!-- @click="navTo(`/package/goods/order`)"-->
<!-- >-->
<!-- <template v-slot:right-icon>-->
<!-- <uv-icon name="arrow-right"></uv-icon>-->
<!-- </template>-->
<!-- </uv-cell>-->
<!-- </uni-card>-->
</view> </view>
</template> </template>
+289 -262
View File
@@ -1,293 +1,320 @@
<template> <template>
<view class="page"> <view class="page">
<uni-card :border="false" :is-shadow="false"> <uni-card :border="false" :is-shadow="false">
<uv-cell <uv-cell
:title="`${formData.name ? formData.name : '请填写开票信息'}`" :title="`${formData.name ? formData.name : '请填写开票信息'}`"
:label="`${formData.isCompany == 1 ? '单位' : '个人'}`" :label="`${userInvoice && userInvoice.isCompany === 1 ? '单位' : '个人'}`"
:cellStyle="{ padding: '5px 0' }" :cellStyle="{ padding: '5px 0' }"
:border="false" :border="false"
@click="editInvoice" @click="editInvoice"
> >
<template v-slot:right-icon> <template v-slot:right-icon>
<uv-icon name="arrow-right"></uv-icon> <uv-icon name="arrow-right"></uv-icon>
</template> </template>
</uv-cell> </uv-cell>
</uni-card> </uni-card>
<uni-card v-if="formData.name" :border="false" :is-shadow="false" :padding="20"> <uni-card v-if="formData.name" :border="false" :is-shadow="false" :padding="20">
<uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="100" label-position="left"> <uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="100" label-position="left">
<uni-forms-item label="发票类型" name="type"> <uni-forms-item label="发票类型" name="type">
<uni-data-checkbox v-model="formData.type" :localdata="type" /> <uni-data-checkbox v-model="formData.type" :localdata="type"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="开票类型" name="invoiceType"> <uni-forms-item label="开票类型" name="invoicetype">
<uni-data-checkbox v-model="formData.invoiceType" :localdata="invoiceType" /> <uni-data-checkbox v-model="formData.invoicetype" :localdata="invoiceType"/>
</uni-forms-item> </uni-forms-item>
<block v-if="formData.isCompany == 0"> <block v-if="userInvoice && userInvoice.isCompany === 0">
<uni-forms-item label="名称" name="name" required> <uni-forms-item label="名称" name="name" required>
<uv-input class="input" disabled v-model="formData.name" type="text" /> <uv-input class="input" disabled v-model="formData.name" type="text"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="手机号码" name="phone" required> <uni-forms-item label="税号/身份证号" name="incoiveCode" required>
<uv-input class="input" disabled v-model="formData.phone" type="text" placeholder="手机号码" /> <uv-input class="input" v-model="formData.incoiveCode" type="text" placeholder="税号/身份证号(必填)"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="电子邮箱" name="email" required> <uni-forms-item label="手机号码" name="phone">
<uv-input class="input" disabled v-model="formData.email" type="text" placeholder="电子邮箱" /> <uv-input class="input" disabled v-model="formData.phone" type="text" placeholder="手机号码"/>
</uni-forms-item> </uni-forms-item>
</block> <uni-forms-item label="电子邮箱" name="email">
<block v-if="formData.isCompany == 1"> <uv-input class="input" disabled v-model="formData.email" type="text" placeholder="电子邮箱"/>
<uni-forms-item label="名称" name="name" required> </uni-forms-item>
<uv-input class="input" v-model="formData.name" type="text" placeholder="单位名称(必填)" /> </block>
</uni-forms-item> <block v-if="userInvoice && userInvoice.isCompany === 1">
<uni-forms-item label="税号" name="invoiceCode" required> <uni-forms-item label="名称" name="name" required>
<uv-input class="input" v-model="formData.invoiceCode" type="text" placeholder="纳税人识别号(必填)" /> <uv-input class="input" v-model="formData.name" type="text" placeholder="单位名称(必填)"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="手机号码" name="phone" required> <uni-forms-item label="税号" name="incoiveCode" required>
<uv-input class="input" v-model="formData.phone" type="text" placeholder="手机号码" /> <uv-input class="input" v-model="formData.incoiveCode" type="text" placeholder="纳税人识别号(必填)"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="电子邮箱" name="email" required> <uni-forms-item label="手机号码" name="phone" required>
<uv-input class="input" v-model="formData.email" type="text" placeholder="电子邮箱" /> <uv-input class="input" v-model="formData.phone" type="text" placeholder="手机号码"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="开户行" name="bankName" required> <uni-forms-item label="电子邮箱" name="email" required>
<uv-input class="input" v-model="formData.bankName" type="text" placeholder="开户银行名称" /> <uv-input class="input" v-model="formData.email" type="text" placeholder="电子邮箱"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="银行账号" name="bankAccount" required> <uni-forms-item label="开户行" name="bankName">
<uv-input class="input" v-model="formData.bankAccount" type="text" placeholder="开户银行账号" /> <uv-input class="input" v-model="formData.bank" type="text" placeholder="开户银行名称"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="单位地址" name="address" required> <uni-forms-item label="银行账号" name="bankAccount">
<uv-input class="input" v-model="formData.address" type="text" placeholder="单位地址" /> <uv-input class="input" v-model="formData.account" type="text" placeholder="开户银行账号"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="单位电话" name="tel" required> <uni-forms-item label="单位地址" name="address">
<uv-input class="input" v-model="formData.tel" type="text" placeholder="单位电话" /> <uv-input class="input" v-model="formData.address" type="text" placeholder="单位地址"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="备注" name="comments"> <uni-forms-item label="单位电话" name="tel">
<uv-textarea v-model="formData.comments" placeholder="请输入备注信息" auto-height></uv-textarea> <uv-input class="input" v-model="formData.tel" type="text" placeholder="单位电话"/>
</uni-forms-item> </uni-forms-item>
</block> <uni-forms-item label="备注" name="comments">
<uv-button <uv-textarea v-model="formData.comments" placeholder="请输入备注信息" auto-height></uv-textarea>
class="add-emergency" </uni-forms-item>
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }" </block>
text="确认开票" <uv-button
@click="submit" class="add-emergency"
></uv-button> :customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }"
</uni-forms> text="确认开票"
</uni-card> @click="submit"
</view> ></uv-button>
</uni-forms>
</uni-card>
</view>
</template> </template>
<script> <script>
import { useUserStore } from '@/store/modules/user'; import {useUserStore} from '@/store/modules/user';
import * as Api from '@/api/booking/userInvoice'; import {openUrl} from '@/utils/common';
import { openUrl } from '@/utils/common';
import { useTenantStore } from '@/store/modules/tenant'; import {useTenantStore} from '@/store/modules/tenant';
import {addThinkInvoice, pageThinkInvoice, removeThinkInvoice} from "@/api/think/thinkInvoice";
import {doInvoice, pageUserInvoice} from "@/api/booking/userInvoice";
const tenantStore = useTenantStore(); const tenantStore = useTenantStore();
const userStore = useUserStore(); const userStore = useUserStore();
export default { export default {
data() { data() {
return { return {
orderId: 0, orderId: 0,
list: [], list: [],
statusBarHeight: 104, statusBarHeight: 104,
isLogin: false, isLogin: false,
fields: {}, fields: {},
logo: '', logo: '',
bookingUser: {}, bookingUser: {},
server: [], server: [],
order: [], order: [],
// 表单数据 // 表单数据
formData: { formData: {
type: 0, incoiveNum: null,
invoiceType: 0 incoiveCode: null,
}, orderNum: null,
// 发票类型 oid: null,
type: [ uid: null,
{ price: null,
text: '电子', name: null,
value: 0 tel: null,
}, address: null,
{ bank: null,
text: '纸质', account: null,
value: 1 code: null,
} phone: null,
], email: null,
// 开票类型 type: 2,
invoiceType: [ itype: null,
{ invoicetype: 1,
text: '普票', },
value: 0 // 发票类型
}, type: [
{ {
text: '专票', text: '电子',
value: 1 value: 2
} },
], // {
rules: { // text: '纸质',
// 对name字段进行必填验证 // value: 1
name: { // }
rules: [ ],
{ // 开票类型
required: true, invoiceType: [
errorMessage: '请输入开票名称' {
} text: '普票',
] value: 1
}, },
// 对email字段进行必填验证 {
email: { text: '专票',
rules: [ value: 2
{ }
format: 'email', ],
errorMessage: '请输入正确的邮箱地址' rules: {
} // 对name字段进行必填验证
] name: {
} rules: [
} {
}; required: true,
}, errorMessage: '请输入开票名称'
onLoad(e){ }
this.orderId = e.id ]
}, },
onShow() { // 对email字段进行必填验证
this.reload(); email: {
}, rules: [
methods: { {
async reload(e) { format: 'email',
const app = this; errorMessage: '请输入正确的邮箱地址'
// 当前登录用户信息 }
const userInfo = await userStore.fetchUserInfo(); ]
if (Object.keys(userInfo).length > 0) { }
app.isLogin = true; },
app.userInfo = userInfo; userInvoice: null,
} else { };
app.isLogin = false; },
} onLoad(e) {
this.formData.oid = e.id
this.formData.orderNum = e.orderNum
this.formData.itype = e.itype
this.formData.price = e.price
},
onShow() {
this.reload();
},
methods: {
async reload(e) {
const app = this;
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
app.isLogin = Object.keys(userInfo).length > 0;
// 读取最后一次 // 读取最后一次
Api.pageUserInvoice({ pageUserInvoice({
userId: userInfo.userId, limit: 1
limit: 1 }).then((res) => {
}).then((res) => { if (res.count > 0 && !app.formData.id) {
if (res.count > 0 && !app.formData.id) { if (res.list && res.list.length > 0) {
app.formData = res.list[0]; this.userInvoice = res.list[0];
app.formData.orderId = app.orderId for (let key in app.formData) {
} if (res.list[0][key]) {
}); app.formData[key] = res.list[0][key];
}, }
navTo(item) { }
if (!this.isLogin) { if (this.userInvoice.invoiceCode) this.formData.incoiveCode = this.userInvoice.invoiceCode
this.$refs.login.open('bottom'); if (this.userInvoice.bankName) this.formData.bank = this.userInvoice.bankName
return false; if (this.userInvoice.bankAccount) this.formData.account = this.userInvoice.bankAccount
} }
openUrl(item); // app.formData.orderId = app.orderId
}, }
// 弹出登录提示框 });
openLogin() { },
if (!this.isLogin) { navTo(item) {
this.$refs.login.open('bottom'); if (!this.isLogin) {
return false; this.$refs.login.open('bottom');
} return false;
}, }
editInvoice(){ openUrl(item);
uni.navigateTo({ },
url: `/package/user/invoice-edit?id=${this.formData.id}` // 弹出登录提示框
}) openLogin() {
}, if (!this.isLogin) {
add() { this.$refs.login.open('bottom');
this.$refs.addForm.open('center'); return false;
}, }
onDel(item) { },
const app = this; editInvoice() {
uni.showModal({ uni.navigateTo({
title: '确定要删除吗?', url: `/package/user/invoice-edit?id=${this.formData.id}`
success(o) { })
if (o.confirm) { },
uni.showLoading({ add() {
title: '请求中.' this.$refs.addForm.open('center');
}); },
Api.removeUserInvoice(item.id).then((res) => { onDel(item) {
uni.showToast({ const app = this;
title: '操作成功', uni.showModal({
icon: 'none' title: '确定要删除吗?',
}); success(o) {
}); if (o.confirm) {
app.reload(); uni.showLoading({
} title: '请求中.'
} });
}); removeThinkInvoice(item.id).then((res) => {
}, uni.showToast({
/** title: '操作成功',
* 复写 binddata 方法,如果只是为了校验,无复杂自定义操作,可忽略此方法 icon: 'none'
* @param {String} name 字段名称 });
* @param {String} value 表单域的值 });
*/ app.reload();
// binddata(name,value){ }
// // 通过 input 事件设置表单指定 name 的值 }
// this.$refs.form.setValue(name, value) });
// }, },
// 触发提交表单 /**
submit() { * 复写 binddata 方法,如果只是为了校验,无复杂自定义操作,可忽略此方法
const { formData } = this * @param {String} name 字段名称
this.$refs.form * @param {String} value 表单域的值
.validate() */
.then((res) => { // binddata(name,value){
Api.doInvoice(formData) // // 通过 input 事件设置表单指定 name 的值
.then((message) => { // this.$refs.form.setValue(name, value)
console.log('message: ',message); // },
uni.showToast({ // 触发提交表单
title: '开票成功', submit() {
icon: 'success' const {formData} = this
}); this.$refs.form
setTimeout(() => { .validate()
uni.navigateBack() .then(async () => {
},1000) uni.showLoading({title: '保存中'})
}) const res = await addThinkInvoice(formData)
.catch((err) => { uni.hideLoading()
console.log(err); if (res && res.data) {
}); uni.showLoading({title: '申请开票中'})
console.log('表单数据信息:', res); await doInvoice(res.data)
}) uni.hideLoading()
.catch((err) => { uni.showToast({
console.log('表单错误信息:', err); title: '开票成功',
}); icon: 'success'
} });
} setTimeout(() => {
uni.navigateBack()
}, 1000)
}
})
.catch((err) => {
console.log('表单错误信息:', err);
});
}
}
}; };
</script> </script>
<style> <style>
page { page {
background-size: 100%; background-size: 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
background-color: #f0f2f5; background-color: #f0f2f5;
width: 750rpx; width: 750rpx;
overflow-x: hidden; overflow-x: hidden;
} }
</style> </style>
<style lang="scss"> <style lang="scss">
.avatar { .avatar {
padding: 20px; padding: 20px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
font-size: 14px; font-size: 14px;
} }
.save-user-profile { .save-user-profile {
width: 700rpx; width: 700rpx;
margin: 40rpx auto; margin: 40rpx auto;
} }
.add-emergency { .add-emergency {
width: 500rpx !important; width: 500rpx !important;
margin: 40rpx auto; margin: 40rpx auto;
} }
.btn-bar { .btn-bar {
width: 700rpx; width: 700rpx;
left: 25rpx; left: 25rpx;
position: fixed; position: fixed;
bottom: 30rpx; bottom: 30rpx;
margin: auto; margin: auto;
clear: both; clear: both;
} }
</style> </style>
+404
View File
@@ -0,0 +1,404 @@
<template>
<view class="page">
<uni-card :border="false" :is-shadow="false">
<uv-cell
:title="`${formData.name ? formData.name : '请填写开票信息'}`"
:label="`${userInvoice && userInvoice.isCompany === 1 ? '单位' : '个人'}`"
:cellStyle="{ padding: '5px 0' }"
:border="false"
@click="editInvoice"
>
<template v-slot:right-icon>
<uv-icon name="arrow-right"></uv-icon>
</template>
</uv-cell>
</uni-card>
<uni-card v-if="formData.name" :border="false" :is-shadow="false" :padding="20">
<uni-forms ref="form" :modelValue="formData" :rules="rules" :label-width="100" label-position="left">
<uni-forms-item label="发票类型" name="type">
<uni-data-checkbox v-model="formData.type" :localdata="type"/>
</uni-forms-item>
<uni-forms-item label="开票类型" name="invoicetype">
<uni-data-checkbox v-model="formData.invoicetype" :localdata="invoiceType"/>
</uni-forms-item>
<uni-forms-item label="租赁开始时间" name="rentStartDate" required>
<uni-datetime-picker @change="confirmStart" :value="formData.rentStartDate" type="date" :end="maxDate"/>
</uni-forms-item>
<uni-forms-item label="租赁结束时间" name="rentEndDate" required>
<uni-datetime-picker @change="confirmEnd" :value="formData.rentEndDate" type="date" :end="maxDate"/>
</uni-forms-item>
<uni-forms-item label="租赁面积" name="size" required>
<uv-input class="input" v-model="formData.size" type="number" placeholder="请输入租赁面积">
<template #suffix>㎡</template>
</uv-input>
</uni-forms-item>
<uni-forms-item label="发票金额" name="price" required>
<uv-input class="input" v-model="formData.price" type="number" placeholder="请输入发票金额">
<template #suffix>元</template>
</uv-input>
</uni-forms-item>
<uni-forms-item label="备注">
<uv-input class="input" v-model="formData.remark" type="text" placeholder="请输入备注"/>
</uni-forms-item>
<block v-if="userInvoice && userInvoice.isCompany === 0">
<uni-forms-item label="名称" name="name" required>
<uv-input class="input" disabled v-model="formData.name" type="text"/>
</uni-forms-item>
<uni-forms-item label="税号/身份证号" name="incoiveCode" required>
<uv-input class="input" v-model="formData.incoiveCode" type="text" placeholder="税号/身份证号(必填)"/>
</uni-forms-item>
<uni-forms-item label="手机号码">
<uv-input class="input" disabled v-model="formData.phone" type="text" placeholder="手机号码"/>
</uni-forms-item>
<uni-forms-item label="电子邮箱">
<uv-input class="input" disabled v-model="formData.email" type="text" placeholder="电子邮箱"/>
</uni-forms-item>
</block>
<block v-if="userInvoice && userInvoice.isCompany === 1">
<uni-forms-item label="名称" name="name" required>
<uv-input class="input" v-model="formData.name" type="text" placeholder="单位名称(必填)"/>
</uni-forms-item>
<uni-forms-item label="税号" name="incoiveCode" required>
<uv-input class="input" v-model="formData.incoiveCode" type="text" placeholder="纳税人识别号(必填)"/>
</uni-forms-item>
<uni-forms-item label="手机号码" name="phone" required>
<uv-input class="input" v-model="formData.phone" type="text" placeholder="手机号码"/>
</uni-forms-item>
<uni-forms-item label="电子邮箱" name="email" required>
<uv-input class="input" v-model="formData.email" type="text" placeholder="电子邮箱"/>
</uni-forms-item>
<uni-forms-item label="开户行">
<uv-input class="input" v-model="formData.bank" type="text" placeholder="开户银行名称"/>
</uni-forms-item>
<uni-forms-item label="银行账号">
<uv-input class="input" v-model="formData.account" type="text" placeholder="开户银行账号"/>
</uni-forms-item>
<uni-forms-item label="单位地址">
<uv-input class="input" v-model="formData.address" type="text" placeholder="单位地址"/>
</uni-forms-item>
<uni-forms-item label="单位电话">
<uv-input class="input" v-model="formData.tel" type="text" placeholder="单位电话"/>
</uni-forms-item>
<uni-forms-item label="备注">
<uv-textarea v-model="formData.comments" placeholder="请输入备注信息" auto-height></uv-textarea>
</uni-forms-item>
</block>
<uv-button
class="add-emergency"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }"
text="确认开票"
@click="submit"
></uv-button>
</uni-forms>
</uni-card>
</view>
</template>
<script>
import {useUserStore} from '@/store/modules/user';
import {openUrl} from '@/utils/common';
import {useTenantStore} from '@/store/modules/tenant';
import {addThinkInvoice, pageThinkInvoice, removeThinkInvoice} from "@/api/think/thinkInvoice";
import {doInvoice, pageUserInvoice} from "@/api/booking/userInvoice";
import dayjs from "dayjs";
const tenantStore = useTenantStore();
const userStore = useUserStore();
export default {
data() {
return {
orderId: 0,
list: [],
statusBarHeight: 104,
isLogin: false,
fields: {},
logo: '',
bookingUser: {},
server: [],
order: [],
// 表单数据
formData: {
incoiveNum: null,
incoiveCode: null,
orderNum: null,
oid: null,
uid: null,
price: null,
name: null,
tel: null,
address: null,
bank: null,
account: null,
code: null,
phone: null,
email: null,
type: 2,
itype: 4,
rentStartDate: null,
rentEndDate: null,
size: null,
remark: null,
invoicetype: 1,
},
// 发票类型
type: [
{
text: '电子',
value: 2
},
// {
// text: '纸质',
// value: 1
// }
],
// 开票类型
invoiceType: [
{
text: '普票',
value: 1
},
{
text: '专票',
value: 2
}
],
rules: {
// 对name字段进行必填验证
name: {
rules: [
{
required: true,
errorMessage: '请输入开票名称'
}
]
},
// 对email字段进行必填验证
email: {
rules: [
{
format: 'email',
errorMessage: '请输入正确的邮箱地址'
}
]
},
incoiveCode: {
rules: [
{
required: true,
errorMessage: '请输入纳税人识别号/身份证号'
}
]
},
phone: {
rules: [
{
required: true,
errorMessage: '请输入手机号码'
}
]
},
rentStartDate: {
rules: [
{
required: true,
errorMessage: '请选择租赁开始时间'
}
]
},
rentEndDate: {
rules: [
{
required: true,
errorMessage: '请选择租赁结束时间'
}
]
},
size: {
rules: [
{
required: true,
errorMessage: '请输入租赁面积'
}
]
},
price: {
rules: [
{
required: true,
errorMessage: '请输入开票金额'
}
]
}
},
userInvoice: null,
rentDate: null,
maxDate: dayjs().format('YYYY-MM-DD'),
};
},
onLoad(e) {
// this.formData.oid = e.id
// this.formData.orderNum = e.orderNum
// this.formData.price = e.price
},
onShow() {
this.reload();
},
methods: {
async reload(e) {
const app = this;
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
app.isLogin = Object.keys(userInfo).length > 0;
// 读取最后一次
pageUserInvoice({
limit: 1
}).then((res) => {
if (res.count > 0 && !app.formData.id) {
if (res.list && res.list.length > 0) {
this.userInvoice = res.list[0];
for (let key in app.formData) {
if (res.list[0][key]) {
app.formData[key] = res.list[0][key];
}
}
if (this.userInvoice.invoiceCode) this.formData.incoiveCode = this.userInvoice.invoiceCode
if (this.userInvoice.bankName) this.formData.bank = this.userInvoice.bankName
if (this.userInvoice.bankAccount) this.formData.account = this.userInvoice.bankAccount
}
// app.formData.orderId = app.orderId
}
});
},
navTo(item) {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
openUrl(item);
},
// 弹出登录提示框
openLogin() {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
},
editInvoice() {
uni.navigateTo({
url: `/package/user/invoice-edit?id=${this.formData.id}`
})
},
add() {
this.$refs.addForm.open('center');
},
onDel(item) {
const app = this;
uni.showModal({
title: '确定要删除吗?',
success(o) {
if (o.confirm) {
uni.showLoading({
title: '请求中.'
});
removeThinkInvoice(item.id).then((res) => {
uni.showToast({
title: '操作成功',
icon: 'none'
});
});
app.reload();
}
}
});
},
/**
* 复写 binddata 方法,如果只是为了校验,无复杂自定义操作,可忽略此方法
* @param {String} name 字段名称
* @param {String} value 表单域的值
*/
// binddata(name,value){
// // 通过 input 事件设置表单指定 name 的值
// this.$refs.form.setValue(name, value)
// },
// 触发提交表单
submit() {
const {formData} = this
this.$refs.form
.validate()
.then(async () => {
if (dayjs(this.formData.rentStartDate).isAfter(dayjs(this.formData.rentEndDate))) {
uni.showToast({
title: '开始时间不能大于结束时间',
icon: 'none'
});
return false
}
uni.showLoading({title: '保存中'})
const res = await addThinkInvoice(formData)
uni.hideLoading()
if (res && res.data) {
uni.showLoading({title: '申请开票中'})
setTimeout(() => {
uni.hideLoading()
uni.navigateBack()
}, 1000)
}
})
.catch((err) => {
console.log('表单错误信息:', err);
});
},
showPopup() {
this.$refs.datetimePicker.open()
},
confirmStart(e) {
this.formData.rentStartDate = e
},
confirmEnd(e) {
this.formData.rentEndDate = e
},
}
};
</script>
<style>
page {
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
}
</style>
<style lang="scss">
.avatar {
padding: 20px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 14px;
}
.save-user-profile {
width: 700rpx;
margin: 40rpx auto;
}
.add-emergency {
width: 500rpx !important;
margin: 40rpx auto;
}
.btn-bar {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
margin: auto;
clear: both;
}
</style>
+37
View File
@@ -0,0 +1,37 @@
<template>
<map style="width: 100%; height: 100vh;"
:longitude="longitude"
:latitude="latitude"
:scale="scale"
:markers="markers">
</map>
</template>
<script>
import coordtransform from 'coordtransform'
export default {
name: "map",
data() {
return {
markers: [],
scale: 13,
longitude: null,
latitude: null,
}
},
methods: {
},
onLoad({longitude, latitude}) {
const [lng, lat] = coordtransform.wgs84togcj02(longitude, latitude)
this.longitude = lng
this.latitude = lat
this.markers.push({
id: 0,
width: 20,
height: 30,
latitude: this.latitude,
longitude: this.longitude
})
}
}
</script>
+45
View File
@@ -0,0 +1,45 @@
<template>
<view class="min-height bg-gray-light">
<view class="card m-20 shadow flex justify-between items-center" style="margin-bottom: 30rpx; padding: 30rpx"
v-for="(item, index) in serviceList" :key="index"
@click="call(item.dictDataCode)">
<view class="flex flex-col justify-start items-start ">
<text class="text-35">{{ item.dictDataName }}</text>
<text class="text-22 text-gray mt-20">{{ item.dictDataCode }}</text>
</view>
<view class="phone-wrap">
<uv-icon name="phone-fill" color="#FFFFFF" size="40rpx"></uv-icon>
</view>
</view>
</view>
</template>
<script setup>
import {ref} from 'vue'
import {listDictData} from "@/api/system/dict-data";
const serviceList = ref([])
const getServiceList = async () => {
serviceList.value = await listDictData({dictId: 925})
console.log(serviceList.value)
}
getServiceList()
const call = (phoneNumber) => {
uni.makePhoneCall({
phoneNumber
})
}
</script>
<style lang="scss" scoped>
.phone-wrap {
width: 60rpx;
height: 60rpx;
border-radius: 60rpx;
background-color: #53AB32;
display: flex;
align-items: center;
justify-content: center;
}
</style>
+52
View File
@@ -0,0 +1,52 @@
<template>
<view class="min-height bg-gray-light p-20">
<zeng-calen :actDay="actDay" @onDayClick='onDayClick' :chooseDay="chooseDay"/>
<view class="my-20">
<uv-button type="primary" shape="circle" :disabled="disabled || hasSign" @click="signUp">
{{ hasSign ? '今日已签到' : '签到' }}
</uv-button>
</view>
</view>
</template>
<script setup>
import {ref} from 'vue'
import {addThinkIntegral, listThinkIntegral} from "@/api/think/thinkIntegral";
import {onShow} from "@dcloudio/uni-app";
import dayjs from "dayjs";
const disabled = ref(false)
const actDay = ref([])
const onDayClick = ({date}) => {
actDay.value = [date]
getLog()
}
const hasSign = ref(false)
const signLog = ref([])
const chooseDay = ref([])
const getLog = async () => {
signLog.value = await listThinkIntegral()
chooseDay.value = signLog.value.map(item => item.dateTime)
if (chooseDay.value.includes(dayjs().format('YYYY-MM-DD'))) hasSign.value = true
}
const signUp = async () => {
disabled.value = true
const res = await addThinkIntegral().catch(err => {
disabled.value = false
console.log(err)
})
if (res) {
uni.showToast({
title: '签到成功',
icon: 'success'
})
await getLog()
}
}
onShow(() => {
getLog()
})
</script>
+76
View File
@@ -0,0 +1,76 @@
<template>
<view class="bg-gray-light min-height card-body">
<uni-grid :column="3" borderColor="transparent" :highlight="true" @change="change">
<uni-grid-item v-for="(item, index) in merchant" :index="index" :key="index">
<view class="merchant-card" style="display: flex; flex-direction: column">
<image :src="item.thumb" mode="widthFix" class="merchant-image"/>
<text class="merchant-name">{{ item.name }}</text>
</view>
</uni-grid-item>
</uni-grid>
</view>
</template>
<script setup>
import {ref} from 'vue'
import coordtransform from "coordtransform";
import {listThinkSite} from "@/api/think/thinkSite";
const merchant = ref([])
const getMerchantList = async () => {
merchant.value = await listThinkSite()
}
getMerchantList()
const change = ({detail: {index}}) => {
const site = merchant.value[index]
toMap(site.lng, site.lat, site.name)
}
const toMap = (longitude, latitude, name) => {
const [lng, lat] = coordtransform.wgs84togcj02(longitude, latitude)
uni.openLocation({
type: 'gcj02',
latitude: lat,
longitude: lng,
scale: 13,
name,
})
}
</script>
<style lang="scss" scoped>
.card-body {
width: 740rpx;
margin: auto;
.merchant-card {
margin: 12rpx auto;
background: #ffffff;
border-color: slategrey;
border-radius: 16rpx;
.merchant-image {
width: 200rpx;
border-radius: 16rpx 16rpx 0 0;
height: 140rpx !important;
}
.merchant-name {
padding: 10rpx;
font-weight: 500;
font-size: 26rpx;
text-align: center;
}
.merchant-desc {
width: 400rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
</style>
+57 -1
View File
@@ -19,7 +19,8 @@
"path": "pages/order", "path": "pages/order",
"style": { "style": {
"navigationBarTitleText": "我的订单", "navigationBarTitleText": "我的订单",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"navigationStyle": "custom"
} }
}, },
{ {
@@ -77,6 +78,13 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, },
{
"path": "user/invoiceRent",
"style": {
"navigationBarTitleText": "租赁发票开具",
"enablePullDownRefresh": false
}
},
{ {
"path": "user/invoice-edit", "path": "user/invoice-edit",
"style": { "style": {
@@ -182,6 +190,48 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, },
{
"path": "user/signUp",
"style": {
"navigationBarTitleText": "签到",
"enablePullDownRefresh": false
}
},
{
"path": "user/depositList",
"style": {
"navigationBarTitleText": "场馆列表",
"enablePullDownRefresh": false
}
},
{
"path": "user/siteGuide",
"style": {
"navigationBarTitleText": "场馆导航",
"enablePullDownRefresh": false
}
},
{
"path": "user/guide",
"style": {
"navigationBarTitleText": "地图导航",
"enablePullDownRefresh": false
}
},
{
"path": "user/map",
"style": {
"navigationBarTitleText": "地图导航",
"enablePullDownRefresh": false
}
},
{
"path": "user/phoneService",
"style": {
"navigationBarTitleText": "电话客服",
"enablePullDownRefresh": false
}
},
{ {
"path": "goods/index", "path": "goods/index",
"style": { "style": {
@@ -290,6 +340,12 @@
"navigationBarTitleText": "订单详情" "navigationBarTitleText": "订单详情"
} }
}, },
{
"path": "order/check",
"style": {
"navigationBarTitleText": "订单核销"
}
},
{ {
"path": "course/index", "path": "course/index",
"style": { "style": {
+87 -57
View File
@@ -34,36 +34,36 @@
</block> </block>
</block> </block>
<!-- <view class="card-title web-text-heading">热门项目</view>--> <!-- <view class="card-title web-text-heading">热门项目</view>-->
<!-- <block v-if="itemList.length > 0">--> <!-- <block v-if="itemList.length > 0">-->
<!-- <view class="item-list">--> <!-- <view class="item-list">-->
<!-- <uni-grid :column="5" :highlight="true" :showBorder="false" @change="onItem">--> <!-- <uni-grid :column="5" :highlight="true" :showBorder="false" @change="onItem">-->
<!-- <uni-grid-item v-for="(item, index) in itemList" :index="index" :key="index">--> <!-- <uni-grid-item v-for="(item, index) in itemList" :index="index" :key="index">-->
<!-- <view--> <!-- <view-->
<!-- class="grid-item-box"--> <!-- class="grid-item-box"-->
<!-- style="--> <!-- style="-->
<!-- background-color: #ffffff;--> <!-- background-color: #ffffff;-->
<!-- margin: 10rpx;--> <!-- margin: 10rpx;-->
<!-- border-radius: 10rpx;--> <!-- border-radius: 10rpx;-->
<!-- display: flex;--> <!-- display: flex;-->
<!-- flex-direction: column;--> <!-- flex-direction: column;-->
<!-- justify-content: center;--> <!-- justify-content: center;-->
<!-- align-items: center;--> <!-- align-items: center;-->
<!-- height: 5rem;--> <!-- height: 5rem;-->
<!-- "--> <!-- "-->
<!-- >--> <!-- >-->
<!-- <uv-avatar :src="item.image" :size="27" shape="square" fontSize="16" randomBgColor></uv-avatar>--> <!-- <uv-avatar :src="item.image" :size="27" shape="square" fontSize="16" randomBgColor></uv-avatar>-->
<!-- <text class="text">{{ item.name }}</text>--> <!-- <text class="text">{{ item.name }}</text>-->
<!-- </view>--> <!-- </view>-->
<!-- </uni-grid-item>--> <!-- </uni-grid-item>-->
<!-- </uni-grid>--> <!-- </uni-grid>-->
<!-- </view>--> <!-- </view>-->
<!-- </block>--> <!-- </block>-->
<!-- <block v-else>--> <!-- <block v-else>-->
<!-- <uni-card :border="false" :padding="'12px 4px'">--> <!-- <uni-card :border="false" :padding="'12px 4px'">-->
<!-- <uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>--> <!-- <uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>-->
<!-- </uni-card>--> <!-- </uni-card>-->
<!-- </block>--> <!-- </block>-->
<!-- 商户列表 --> <!-- 商户列表 -->
<view class="card-title web-text-heading">场地预定</view> <view class="card-title web-text-heading">场地预定</view>
@@ -73,7 +73,7 @@
<uni-grid-item v-for="(item, index) in siteList" :index="index" :key="index"> <uni-grid-item v-for="(item, index) in siteList" :index="index" :key="index">
<view class="merchant-card" style="display: flex; flex-direction: column"> <view class="merchant-card" style="display: flex; flex-direction: column">
<image :src="item.thumb" mode="widthFix" class="merchant-image"/> <image :src="item.thumb" mode="widthFix" class="merchant-image"/>
<text class="merchant-name">{{ item.name }}</text> <text class="merchant-name" style="width: 180rpx">{{ item.name }}</text>
</view> </view>
</uni-grid-item> </uni-grid-item>
</uni-grid> </uni-grid>
@@ -95,7 +95,22 @@
<!-- 推荐商品 --> <!-- 推荐商品 -->
<!-- <ws-booking :goods="goods"></ws-booking> --> <!-- <ws-booking :goods="goods"></ws-booking> -->
<!-- 登录组件 --> <!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/> <ws-login ref="login" :logo="logo" @done="doLogin"/>
<uv-popup ref="popup" mode="center" round="15" :closeOnClickOverlay="true" bg-color="">
<view v-if="activity && activity.title" @click="toArticle(activity.articleId)" style="width: 60vw"
class="p-30 pos-r bg-white rounded">
<view class="flex flex-col justify-center items-center">
<text class="text-orange font-bold my-20 text-35">热门活动</text>
<text class="my-20">{{ activity.title }}</text>
</view>
<view class="mt-20">
<uv-button type="primary" shape="circle">立即查看</uv-button>
</view>
</view>
<view class="w-100p flex justify-center items-center mt-20" @click="closeActivity">
<uv-icon name="close-circle" size="80rpx" color="white"/>
</view>
</uv-popup>
</layout> </layout>
</template> </template>
@@ -111,6 +126,7 @@ import Layout from "@/components/layout.vue";
import * as MenuIcons from '@/api/menu-icons.ts'; import * as MenuIcons from '@/api/menu-icons.ts';
import {openUrl} from '@/utils/common'; import {openUrl} from '@/utils/common';
import {listThinkSite} from "@/api/think/thinkSite"; import {listThinkSite} from "@/api/think/thinkSite";
import {listArticle, pageArticle} from "@/api/cms/article";
const mpStore = useMpStore(); const mpStore = useMpStore();
@@ -143,17 +159,40 @@ export default {
hideTools: true, hideTools: true,
mp_menu_display_method: 0, mp_menu_display_method: 0,
openid: null, openid: null,
siteList: [] siteList: [],
activity: null,
}; };
}, },
onLoad() { onLoad() {
this.reload(); this.reload();
this.openid = uni.getStorageSync('openid'); this.openid = uni.getStorageSync('openid');
}, },
onShow() {
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
this.isLogin = true;
// console.log(this.isLogin)
}
},
methods: { methods: {
doLogin() {
this.isLogin = true;
this.reload()
},
async getActivity() {
const res = await pageArticle({
categoryId: 2454,
page: 1,
limit: 1,
status: 0,
})
if (res.count > 0) {
this.activity = res.list[0]
this.$refs.popup.open()
}
},
async reload() { async reload() {
const app = this; const app = this;
this.getActivity()
// 获取小程序信息包 // 获取小程序信息包
const info = await mpStore.fetchMpInfo(); const info = await mpStore.fetchMpInfo();
// 配置信息 // 配置信息
@@ -162,29 +201,6 @@ export default {
app.mpName = info.config.mpName app.mpName = info.config.mpName
// 登录状态 // 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
app.isLogin = true;
if (!uni.getStorageSync('openid')) {
// 更新openid
// #ifdef MP-WEIXIN
uni.login({
success: (res) => {
getWxOpenId({
code: res.code
}).then((response) => {
uni.setStorageSync('openid', response.openid);
updateUsers({
uid: app.userInfo.ouid,
openid: response.openid,
sessionKey: response.session_key,
unionid: response.unionid
});
});
}
});
// #endif
}
}
// 解析网站参数 // 解析网站参数
if (info.fields) { if (info.fields) {
@@ -337,6 +353,20 @@ export default {
const json = JSON.parse(item.images); const json = JSON.parse(item.images);
return json[0].url; return json[0].url;
}, },
toArticle(articleId) {
this.openUrl(`/package/article/detail?articleId=${articleId}`);
this.$refs.popup.close()
},
closeActivity(){
this.$refs.popup.close()
}
},
onShareAppMessage() {
return {
title: '广西体育中心',
path: '/pages/index'
}
} }
}; };
</script> </script>
+250 -114
View File
@@ -4,12 +4,18 @@
<!-- <uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor"--> <!-- <uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor"-->
<!-- inActiveColor="#808080" @clickItem="onClickItem"/>--> <!-- inActiveColor="#808080" @clickItem="onClickItem"/>-->
<!-- </view>--> <!-- </view>-->
<uv-sticky> <uv-sticky title="订单" bg-color="white">
<view class="flex justify-center items-center p-10"> <view class="w-100p" :style="{height: `${safeTop}px`}"></view>
<view v-if="hasMerchantRole || hasMerchantClerkRole || hasSuperAdminRole"
class="px-20 pb-20 flex justify-center items-center" style="width: calc(100vw - 250rpx)">
<uv-input v-model="orderNo" shape="circle" clearable placeholder="订单号搜索"
:customStyle="{backgroundColor: 'white'}" @change="reload"/>
</view>
<view class="flex justify-center items-center p-10" style="width: calc(100vw - 220rpx); height: 40px">
<view class="flex-2 mx-15 flex justify-center" @click="openOrderTypePicker"> <view class="flex-2 mx-15 flex justify-center" @click="openOrderTypePicker">
<uv-icon name="arrow-down" :label="orderTypeStr" label-pos="left"/> <uv-icon name="arrow-down" :label="orderTypeStr" label-pos="left"/>
</view> </view>
<view class="flex-2 mx-15 flex justify-center" @click="openOrderStatusPicker"> <view class="flex-2 mx-15 flex justify-center" @click="openOrderStatusPicker" v-if="orderType !== 2">
<uv-icon name="arrow-down" :label="orderStatusStr" label-pos="left"/> <uv-icon name="arrow-down" :label="orderStatusStr" label-pos="left"/>
</view> </view>
<view class="flex-1 mx-15 flex justify-center" @click="reset"> <view class="flex-1 mx-15 flex justify-center" @click="reset">
@@ -19,92 +25,131 @@
</uv-sticky> </uv-sticky>
<view class="order"> <view class="order">
<block v-if="orderList.length > 0"> <block v-if="orderList.length > 0">
<block v-for="(item,index) in orderList" :key="index"> <template v-if="orderType === 2">
<uni-card :border="false" :is-shadow="false" :padding="0"> <view v-for="(item, index) in orderList" class="card m-20" :key="index">
<template v-slot:title> <view class="pb-20 border-bottom flex justify-between items-center text-25">
<div class="order-title web-cell"> <text>{{ item.orderNum }}</text>
<view class="web-cell web-cell-content" v-if="orderType === 0"> <text v-if="item.status === 0">未支付</text>
<text class="merchant-name">{{ item.siteName }}</text> <text v-if="item.status === 1" class="text-red">已支付,未退款</text>
</view> <text v-if="item.status === 2" class="text-green">已退款</text>
<view class="web-cell web-cell-content flex justify-between items-center" v-if="orderType === 1"> </view>
<text class="merchant-name">{{ item.siteNames }}</text> <view class="py-20 border-bottom flex justify-between items-center text-25">
<text class="text-25 text-red" v-if="item.status === 2">待支付</text> <text>{{ item.siteName }}-{{ item.info }}</text>
<text class="text-25 text-green" v-else-if="item.status === 1">已支付</text> <text class="text-red font-bold">¥{{ item.money }}</text>
<text class="text-25 text-gray" v-else-if="item.status === 3">已退款</text> </view>
<text class="text-25 text-gray" v-else-if="item.status === 0">已取消</text> <view class="py-20 flex justify-start items-center text-25 text-gray">
</view> <text>{{ dayjs(item.createTime * 1000).format('YYYY-MM-DD HH:mm:ss') }}</text>
<block v-if="item.orderStatus === 3"> </view>
<text class="btn-status web-text-secondary">已取消</text> </view>
</block> </template>
<block v-else-if="item.orderStatus === 1"> <template v-else>
<text class="btn-status web-text-success">已完成</text> <block v-for="(item,index) in orderList" :key="index">
</block> <uni-card :border="false" :is-shadow="false" :padding="0">
<block v-else> <template v-slot:title>
<text v-if="item.payStatus === 1" class="btn-status web-text-success">已支付</text> <div class="order-title web-cell">
<view v-if="item.payStatus === 0" class="btn-status web-text-danger"> <view class="web-cell web-cell-content">
<uv-count-down :time="item.timestamp" format="mm:ss"></uv-count-down> <text class="merchant-name">订单号: {{ item.orderNum }}</text>
<text class="no-pay" style="margin-left: 10rpx;">未支付</text>
</view> </view>
</block> <view class="web-cell web-cell-content flex justify-between items-center" v-if="orderType === 1">
</div> <text class="merchant-name">{{ item.siteNames }}</text>
</template> <text class="text-25 text-red" v-if="item.status === 2">待支付</text>
<view class="order-body web-cell web-cell-align-top"> <text class="text-25 text-green" v-else-if="item.status === 1">已支付</text>
<view class="web-cell-content" @click="toDetail(item.id)"> <text class="text-25 text-gray" v-else-if="item.status === 3">已退款</text>
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false" v-if="orderType === 0"> <text class="text-25 text-gray" v-else-if="item.status === 0">已取消</text>
<block v-for="(sub,subIndex) in item.thinkOrderInfos" :key="subIndex"> </view>
<uv-cell :title="`${item.siteName} - ${sub.fieldName}`" :label="`${sub.dateTime}`" <block v-if="item.orderStatus === 3">
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false"/> <text class="btn-status web-text-secondary">已取消</text>
</block> </block>
</uv-cell-group> <block v-else-if="item.orderStatus === 1">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false" v-else-if="orderType === 1"> <text class="btn-status web-text-success">已完成</text>
<uv-cell :title="item.name" </block>
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false"> <block v-else>
</uv-cell> <text v-if="item.payStatus === 1" class="btn-status web-text-success">已支付</text>
</uv-cell-group> <view v-if="item.payStatus === 0" class="btn-status web-text-danger">
<view class="total-price" v-if="orderType === 0"> <uv-count-down :time="item.timestamp" format="mm:ss"></uv-count-down>
<view class="web-text-heading">合计:¥{{ item.totalPrice }}</view> <text class="no-pay" style="margin-left: 10rpx;">未支付</text>
</view> </view>
<view class="total-price" v-else-if="orderType === 1"> </block>
<view class="web-text-heading">合计:¥{{ item.price }}</view> </div>
</template>
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content" @click="toDetail(item.id)">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false" v-if="orderType === 0">
<block v-for="(sub,subIndex) in item.thinkOrderInfos" :key="subIndex">
<uv-cell :title="`${item.siteName} - ${sub.fieldName}`" :label="`${sub.dateTime}`"
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false"/>
</block>
</uv-cell-group>
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false"
v-else-if="orderType === 1">
<uv-cell :title="item.name"
:cellStyle="{padding: '0', paddingBottom: '5px'}" :border="false">
</uv-cell>
</uv-cell-group>
<view class="total-price" v-if="orderType === 0">
<view class="web-text-heading">合计:¥{{ item.totalPrice }}</view>
</view>
<view class="total-price" v-else-if="orderType === 1">
<view class="web-text-heading">合计:¥{{ item.price }}</view>
</view>
</view> </view>
</view> </view>
</view> <view slot="actions" class="card-actions">
<view slot="actions" class="card-actions"> <template v-if="orderType === 0">
<template v-if="orderType === 0"> <view class="card-actions-item" v-if="item.payStatus === 2 && item.orderStatus === 2">
<view class="card-actions-item" v-if="item.payStatus === 2 && item.orderStatus === 2"> <button class="mini-btn" size="mini" @click="closeOrder(item)"
<button class="mini-btn" size="mini" @click="closeOrder(item)" style="margin-right: 20rpx;">取消订单
style="margin-right: 20rpx;">取消订单 </button>
</button> <button class="mini-btn" type="primary" size="mini"
<button class="mini-btn" type="primary" size="mini" @click="openPayOrder(item.id)">立即支付
@click="openPayOrder(item.id)">立即支付 </button>
</button> </view>
</view> <view class="card-actions-item" v-if="item.payStatus === 1">
<view class="card-actions-item" v-if="item.payStatus == 1"> <button class="mini-btn mx-10" size="mini" v-if="item.orderStatus === 4">
<button class="mini-btn" size="mini" v-if="item.isOpen === 2" @click="onInvoice(item.orderId)"> 退款中
申请开票 </button>
</button> <button class="mini-btn mx-10" size="mini" v-if="item.orderStatus === 6">
<button class="mini-btn" size="mini" v-else @click="showInvoice(item.id)">查看发票</button> {{ item.payType === 1 ? '退款成功' : '已取消' }}
</view> </button>
</template> <button class="mini-btn mx-10" size="mini"
<template v-else-if="orderType === 1"> v-if="item.orderStatus === 2 && item.canRefund"
<view class="card-actions-item" v-if="item.status === 2"> @click="refund(item, index)" :disabled="item.disabled">
<button class="mini-btn" size="mini" @click="closeVipOrder(item)" {{ item.payType === 1 ? '申请退款' : '取消订单' }}
style="margin-right: 20rpx;">取消订单 </button>
</button> <button class="mini-btn mx-10" size="mini" v-if="item.orderStatus === 2" @click="toDetail(item.id)">
<button class="mini-btn" type="primary" size="mini" 核销码
@click="openPay(item.id)">立即支付 </button>
</button> <button class="mini-btn mx-10" size="mini" v-if="item.canInvoice" @click="onInvoice(item)">
</view> 申请开票
<view class="card-actions-item" v-if="item.status === 1"> </button>
<button class="mini-btn" size="mini" v-if="item.isInvoice === 2" @click="onInvoice(item.id)"> <button class="mini-btn mx-10" size="mini" v-else-if="item.isInvoice === 1"
申请开票 @click="showInvoice(item.id)">
</button> 查看发票
<button class="mini-btn" size="mini" v-else @click="showInvoice(item.id)">查看发票</button> </button>
</view> </view>
</template> </template>
</view> <template v-else-if="orderType === 1">
</uni-card> <view class="card-actions-item" v-if="item.payStatus === 2">
</block> <button class="mini-btn" size="mini" @click="closeVipOrder(item)"
style="margin-right: 20rpx;">取消订单
</button>
<button class="mini-btn" type="primary" size="mini"
@click="openPay(item.id)">立即支付
</button>
</view>
<view class="card-actions-item" v-if="item.status === 1">
<button class="mini-btn" size="mini" v-if="item.isInvoice === 2" @click="onInvoice(item)">
申请开票
</button>
<button class="mini-btn" size="mini" v-else-if="item.isInvoice === 1" @click="showInvoice(item.id)">
查看发票
</button>
</view>
</template>
</view>
</uni-card>
</block>
</template>
</block> </block>
<!-- <block v-if="orderList.length === 0 && loadMore != 'no-more'">--> <!-- <block v-if="orderList.length === 0 && loadMore != 'no-more'">-->
<!-- <uni-card :border="false" :padding="'18px 6px'">--> <!-- <uni-card :border="false" :padding="'18px 6px'">-->
@@ -141,24 +186,34 @@
<script> <script>
import * as OrderApi from '@/api/think/thinkOrder' import * as OrderApi from '@/api/think/thinkOrder'
import {
pageThinkWechatDeposit
} from '@/api/think/thinkWechatDeposit'
import { import {
getWeek, getWeek,
getKey getKey
} from '@/utils/common'; } from '@/utils/common';
import {pageThinkOrder, thinkOrderRepay} from "@/api/think/thinkOrder"; import {pageThinkOrder, thinkOrderRepay, updateThinkOrder} from "@/api/think/thinkOrder";
import {pageThinkUsersVip, thinkUsersVipRepay, updateThinkUsersVip} from "@/api/think/thinkUsersVip"; import {pageThinkUsersVip, thinkUsersVipRepay, updateThinkUsersVip} from "@/api/think/thinkUsersVip";
import {pageThinkDeposit} from "@/api/think/thinkDeposit"; import {pageThinkDeposit} from "@/api/think/thinkDeposit";
import dayjs from "dayjs";
import * as Api from "@/api/booking/userInvoice";
import {addThinkOrderRefundLog} from "@/api/think/thinkOrderRefundLog";
import {authUser} from "@/api/user";
import {useUserStore} from "@/store/modules/user";
const userStore = useUserStore();
export default { export default {
computed: {
dayjs() {
return dayjs
}
},
components: {}, components: {},
data() { data() {
return { return {
isRefresh: false, isRefresh: false,
isLogin: false, isLogin: false,
userId: 0, userId: 0,
userInfo: null,
where: { where: {
page: 1 page: 1
// sceneType: 'showOrderInfo' // 查询订单附加场地信息 // sceneType: 'showOrderInfo' // 查询订单附加场地信息
@@ -214,6 +269,11 @@ export default {
], ],
orderStatusStr: '全部状态', orderStatusStr: '全部状态',
orderStatus: null, orderStatus: null,
hasMerchantRole: false,
hasMerchantClerkRole: false,
hasSuperAdminRole: false,
orderNo: '',
safeTop: 44,
} }
}, },
// async onLoad(option) { // async onLoad(option) {
@@ -225,7 +285,16 @@ export default {
// // } // // }
// }, // },
async onShow(e) { async onShow(e) {
const sysInfo = uni.getSystemInfoSync()
this.safeTop = sysInfo.statusBarHeight
this.userId = await uni.getStorageSync('user_id') this.userId = await uni.getStorageSync('user_id')
const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) {
this.userInfo = userInfo;
this.hasMerchantRole = userInfo.roles.find((d) => d.roleCode === 'merchant');
this.hasMerchantClerkRole = userInfo.roles.find((d) => d.roleCode === 'merchantClerk');
this.hasSuperAdminRole = userInfo.roles.find((d) => d.roleCode === 'superAdmin');
}
await this.reload() await this.reload()
}, },
// 触底函数 // 触底函数
@@ -273,18 +342,63 @@ export default {
}, },
async getOrderList() { async getOrderList() {
let res let res
if (this.orderType === 0) res = await pageThinkOrder(this.where) if (this.orderType === 0) {
else if (this.orderType === 1) res = await pageThinkUsersVip(this.where) if (this.orderNo) {
else if (this.orderType === 2) res = await pageThinkDeposit(this.where) this.where.orderNum = this.orderNo
this.where.forAdmin = true
} else {
this.where.orderNum = null
this.where.forAdmin = null
}
res = await pageThinkOrder(this.where).catch(err => {
this.$refs.login.open('bottom')
})
} else if (this.orderType === 1) res = await pageThinkUsersVip(this.where).catch(err => {
this.$refs.login.open('bottom')
})
else if (this.orderType === 2) res = await pageThinkDeposit(this.where).catch(err => {
this.$refs.login.open('bottom')
})
if (this.orderList.length < res.count) { if (this.orderList.length < res.count) {
this.orderList = this.orderList.concat(res.list) let list = res.list
if (this.orderType === 1) list = list.map(item => {
item.orderNum = item.wechatOrder
item.payPrice = item.price
return item
})
if (this.orderType === 0) list = list.map(item => {
item.canRefund = false
// 游泳馆没有用就可以退
if (item.sid === 37) {
if (item.orderStatus === 2) item.canRefund = true
} else {
// 可提前6小时退
item.canRefund = item.startTime - dayjs().unix() > (3600 * 6)
}
item.disabled = false
return item
})
this.orderList = this.orderList.concat(list)
console.log(this.orderList)
this.canReset = true this.canReset = true
this.loadMore = 'no-more' this.loadMore = 'no-more'
} else { } else {
this.canReset = false; this.canReset = false;
this.loadMore = 'no-more' this.loadMore = 'no-more'
} }
if (this.orderType !== 2) {
this.orderList = this.orderList.map(item => {
item.canInvoice = false
if (this.orderType === 0 && item.isInvoice === 2 && item.orderStatus === 1) {
const date = item.dateTime.split("(")[0]
const endTime = item.dateTime.split(" - ")[1]
const time = `${date} ${endTime}:00`
if (dayjs().isAfter(dayjs(time))) item.canInvoice = true
}
return item
})
}
}, },
async onClickItem(e) { async onClickItem(e) {
const app = this const app = this
@@ -353,26 +467,20 @@ export default {
}) })
}, },
closeOrder(item) { closeOrder(item) {
const _this = this
uni.showModal({ uni.showModal({
title: '确定取消此订单?', title: '确定取消此订单?',
success(o) { async success(o) {
if (o.confirm) { if (o.confirm) {
OrderApi.updateOrder({ await updateThinkOrder({
orderStatus: 2, orderStatus: 3,
orderId: item.orderId id: item.id
}).then(msg => {
uni.showToast({
title: msg,
icon: 'none'
})
item.orderStatus = 2;
}).catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
})
uni.hideLoading()
}) })
uni.showToast({
title: '取消成功',
icon: 'none'
})
await _this.reload()
} }
} }
}); });
@@ -386,10 +494,10 @@ export default {
} }
}, },
// 申请开票 // 申请开票
onInvoice(id) { onInvoice({id, orderNum, payPrice}) {
uni.navigateTo({ let url = `/package/user/invoice?id=${id}&orderNum=${orderNum}&itype=${this.orderType + 1}`
url: '/package/user/invoice?id=' + id url += `&price=${payPrice}`
}) uni.navigateTo({url})
}, },
showInvoice(id) { showInvoice(id) {
uni.navigateTo({ uni.navigateTo({
@@ -461,7 +569,7 @@ export default {
} }
}) })
}, },
reset(){ reset() {
this.where = { this.where = {
page: 1 page: 1
} }
@@ -471,6 +579,34 @@ export default {
this.orderStatus = null this.orderStatus = null
this.orderStatusStr = '全部状态' this.orderStatusStr = '全部状态'
this.reload() this.reload()
},
refund(order, index) {
uni.showModal({
title: '确定要退款吗?',
success: async ({confirm}) => {
if (confirm) {
this.orderList[index].disabled = true
uni.showLoading({
title: '退款请求中'
})
await addThinkOrderRefundLog({
uid: order.uid,
refundAmount: order.payPrice,
sid: order.sid,
oid: order.id,
status: 1,
type: 0
})
this.orderList[index].disabled = false
uni.hideLoading()
uni.showToast({
title: '申请退款成功',
icon: 'none'
})
await this.reload()
}
}
})
} }
} }
} }
+58 -158
View File
@@ -1,6 +1,5 @@
<template> <template>
<layout class="container" @done="onLayout"> <view>
<!-- 幻灯片广告 --> <!-- 幻灯片广告 -->
<block v-if="shopInfo.files"> <block v-if="shopInfo.files">
<view class="uv-demo-block" style="width: 750rpx; margin: auto"> <view class="uv-demo-block" style="width: 750rpx; margin: auto">
@@ -9,109 +8,34 @@
radius="0" height="200" @click="onSlide"></uv-swiper> radius="0" height="200" @click="onSlide"></uv-swiper>
</view> </view>
</block> </block>
<view class="flex flex-wrap justify-start items-start card m-20">
<!-- search--> <view v-for="(item, index) in list" :key="index" class="m-15" @click="selectCate(item)">
<view class="search" style="padding: 0 10rpx; background-color: #FFFFFF"> <uv-icon size="60rpx" :name="item.image" :label="item.catname"
<uni-search-bar radius="5" placeholder="搜索商品" v-model="keywords" clearButton="auto" cancelButton="none" @confirm="search"/> label-pos="bottom" label-size="25rpx" space="8"></uv-icon>
</view>
</view> </view>
<view class="flex flex-wrap justify-start items-start">
<!-- <uv-gap height="8"></uv-gap>--> <view class="w-50p" v-for="(item, index) in goodsList" :key="index" @click="navTo(`/package/goods/detail?id=${item.goodsId}`)">
<uv-vtabs <view class="card m-20">
:chain="chain" <uv-image :src="item.image" width="300rpx" height="300rpx"></uv-image>
:list="list" <view class="mt-20 flex justify-between items-center">
keyName="title" <text class="text-25">{{ item.title }}</text>
:height="height"
:barItemActiveStyle="{color: '#ff0000'}"
:barItemActiveLineStyle="{background: '#ff0000'}"
hdHeight="100rpx"
@change="change">
<template v-for="(item,index) in children" :key="index">
<uv-vtabs-item :index="index">
<view class="item">
<text class="ele-text-secondary" style="color: #808080">{{ item.title }}</text>
</view> </view>
<view class="item" <text class="text-red text-25 mt-10">¥{{ item.minPrice }}</text>
v-for="(item,index2) in item.goods" </view>
:key="index2"> </view>
<view class="flex"> </view>
<uv-image :src="item.image" width="80" height="80" radius="6"
@click="navTo(`/package/goods/detail?id=${item.goodsId}`)"/>
<view class="goods-info ml-2" style="flex: 1">
<view class="flex flex-col justify-between" style="height: 80px">
<view class="goods-bar">
<view class="goods-name">{{ item.goodsName }}</view>
<view class="goods-desc web-text-secondary">{{ item.comments }}</view>
</view>
<view class="flex justify-between goods-price-bar">
<view class="goods-price">¥{{ item.price }}</view>
<block v-if="item.specs === 1">
<uv-button type="error" class="goods-btn" size="mini" @click="openSpecForm(item)"
:customStyle="{backgroundColor: '#ff0000', color: '#ffffff'}">选规格
</uv-button>
</block>
<block v-else>
<uv-number-box v-model="item.totalNums"
step="1"
:min="0"
:showMinus="item.totalNums > 0"
@change="addNum(item)"
>
<template v-slot:minus>
<view class="minus">
<uv-icon
name="minus"
size="12">
</uv-icon>
</view>
</template>
<template v-slot:input>
<text
style="width: 18px;text-align: center;"
class="input"
>
{{ item.totalNums }}
</text>
</template>
<template v-slot:plus>
<view class="plus">
<uv-icon
name="plus"
color="#FFFFFF"
size="12"
>
</uv-icon>
</view>
</template>
</uv-number-box>
</block>
</view>
</view>
</view>
</view>
</view>
<view
class="gap"
v-if="index<list.length-1">
<uv-gap bg-color="#f1f1f1" height="4"></uv-gap>
</view>
</uv-vtabs-item>
</template>
</uv-vtabs>
<!-- 购物车 --> <!-- 购物车 -->
<view class="cart-icon"> <view class="cart-icon">
<view class="icon" style="position: relative" @click="navTo(`/package/cart/index`)"> <view class="icon" style="position: relative" @click="navTo(`/package/cart/index`)">
<uv-badge type="error" max="40" :value="cart.totalNums" <view style="position: absolute; top: -1px; right: -1px; z-index: 9;">
style="position: absolute; top: -1px; right: -1px; z-index: 9;"></uv-badge> <uv-badge type="error" max="40" :value="cart.length"></uv-badge>
</view>
<uv-icon name="shopping-cart" size="30" color="#0c9d04"></uv-icon> <uv-icon name="shopping-cart" size="30" color="#0c9d04"></uv-icon>
</view> </view>
</view> </view>
<!-- 支付密码弹窗 -->
<uni-popup ref="specForm" type="center" border-radius="10px 10px 0 0"> <uni-popup ref="specForm" type="center" border-radius="10px 10px 0 0">
<uni-card :title="goods.goodsName" :border="false" :is-shadow="false" :padding="0"> <uni-card :title="goods.goodsName" :border="false" :is-shadow="false" :padding="0">
<view class="spec-card" style="width: 660rpx;"> <view class="spec-card" style="width: 660rpx;">
@@ -159,22 +83,20 @@
</uni-popup> </uni-popup>
<!-- 登录组件 --> <!-- 登录组件 -->
<ws-login ref="login" @done="reload"/> <ws-login ref="login" @done="reload"/>
</layout> </view>
</template> </template>
<script> <script>
import Layout from "@/components/layout.vue"; import Layout from "@/components/layout.vue";
import {listCategoryParentIdTree, listCategoryTree} from '@/api/shop/goodsCategory';
import UvAvatar from "@/uni_modules/uv-avatar/components/uv-avatar/uv-avatar.vue"; import UvAvatar from "@/uni_modules/uv-avatar/components/uv-avatar/uv-avatar.vue";
import UvImage from "@/uni_modules/uv-image/components/uv-image/uv-image.vue"; import UvImage from "@/uni_modules/uv-image/components/uv-image/uv-image.vue";
import UvButton from "@/uni_modules/uv-button/components/uv-button/uv-button.vue"; import UvButton from "@/uni_modules/uv-button/components/uv-button/uv-button.vue";
import {useMpStore} from "@/store/modules/mp";
import UvGap from "@/uni_modules/uv-gap/components/uv-gap/uv-gap.vue"; import UvGap from "@/uni_modules/uv-gap/components/uv-gap/uv-gap.vue";
import * as CartApi from "@/api/shop/cart"; import * as CartApi from "@/api/shop/cart";
import {ShoppingCartOutlined} from '@ant-design/icons-vue'; import {ShoppingCartOutlined} from '@ant-design/icons-vue';
import {listThinkGoodsCategory} from "@/api/think/thinkGoodsCategory";
const mpStore = useMpStore(); import {listThinkGoods} from "@/api/think/thinkGoods";
export default { export default {
components: {UvGap, UvButton, UvImage, UvAvatar, Layout, ShoppingCartOutlined}, components: {UvGap, UvButton, UvImage, UvAvatar, Layout, ShoppingCartOutlined},
@@ -184,9 +106,6 @@ export default {
goods: {}, goods: {},
cart: {}, cart: {},
isLogin: false, isLogin: false,
// 配置信息
config: {},
mpMenus: [],
list: [], list: [],
children: [], children: [],
chain: false, chain: false,
@@ -198,7 +117,9 @@ export default {
// 支付密码是否正确 // 支付密码是否正确
isPayPasswordCorrect: false, isPayPasswordCorrect: false,
disabledPayPayPassword: false, disabledPayPayPassword: false,
payPassword: '' payPassword: '',
goodsList: [],
cateId: null
} }
}, },
computed: { computed: {
@@ -206,70 +127,53 @@ export default {
return uni.getSystemInfoSync().windowHeight - uni.upx2px(108); return uni.getSystemInfoSync().windowHeight - uni.upx2px(108);
} }
}, },
onLoad() { async onLoad() {
await this.reload();
this.listCart(); this.listCart();
}, await this.getGoodsList();
onReady() {
// 模拟接口请求数据
uni.showLoading({
title: '加载中'
})
this.reload();
// setTimeout(() => {
// // this.list = getList;
// this.reload()
// }, 500)
}, },
methods: { methods: {
async reload() { async reload() {
const app = this;
// 获取小程序信息包
const info = await mpStore.fetchMpInfo();
// 配置信息
app.config = info.config
// 登录状态 // 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) { if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
app.isLogin = true; this.isLogin = true;
} }
this.list = await listThinkGoodsCategory()
// 查询店铺分类 // console.log(this.list)
listCategoryTree({type: 0}).then(data => {
app.list = data;
if (data.length > 0) {
const parentId = data[0].categoryId
listCategoryParentIdTree(parentId).then(children => {
app.children = children;
})
}
}).finally(err => {
uni.hideLoading();
})
}, },
listCart() { listCart() {
CartApi.listCart({type: 0, isNew: false}).then(data => { CartApi.listCart({type: 0}).then(data => {
if (data) { if (data) {
this.cart = data this.cart = data
// uni.setTabBarBadge({
// index: 1,
// text: `${data.totalNums}`
// })
} }
}) })
}, },
async getGoodsList(){
this.goodsList = await listThinkGoods({
status: 1,
cid: this.cateId
})
},
selectCate(item){
this.cateId = item.id
this.getGoodsList()
},
navTo(url) { navTo(url) {
console.log('>>>>>url') if (url === '/package/cart/index' && !this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
uni.navigateTo({url}) uni.navigateTo({url})
}, },
change(index) { // change(index) {
const app = this // const app = this
this.children = this.list[index].children; // this.children = this.list[index].children;
const parentId = this.list[index].categoryId // const parentId = this.list[index].categoryId
listCategoryParentIdTree(parentId).then(children => { // listCategoryParentIdTree(parentId).then(children => {
app.children = children; // app.children = children;
}) // })
console.log('选项改变:', index) // console.log('选项改变:', index)
}, // },
openSpecForm(goods) { openSpecForm(goods) {
if (!this.isLogin) { if (!this.isLogin) {
this.$refs.login.open('bottom'); this.$refs.login.open('bottom');
@@ -286,6 +190,8 @@ export default {
} }
CartApi.addCart({ CartApi.addCart({
...item, ...item,
goodsName: item.title,
price: item.minPrice,
spec: this.skuText, spec: this.skuText,
cartNum: 1 cartNum: 1
}).then(() => { }).then(() => {
@@ -327,7 +233,7 @@ export default {
onSlide() { onSlide() {
}, },
search(){ search() {
uni.navigateTo({ uni.navigateTo({
url: '/package/goods/index?keywords=' + this.keywords url: '/package/goods/index?keywords=' + this.keywords
}) })
@@ -337,12 +243,6 @@ export default {
uni.navigateTo({ uni.navigateTo({
url: '/package/goods/checkout?goodsId=' + this.goods.goodsId url: '/package/goods/checkout?goodsId=' + this.goods.goodsId
}) })
},
onLayout(data) {
if (data) {
// 页面图标链接
this.mpMenus = data.mpMenus;
}
} }
} }
} }
+179 -106
View File
@@ -20,87 +20,150 @@
<!-- 我的订单 --> <!-- 我的订单 -->
<!-- <ws-user-order :order="order" :is-login="isLogin" @done="openLogin"></ws-user-order> --> <!-- <ws-user-order :order="order" :is-login="isLogin" @done="openLogin"></ws-user-order> -->
<!-- 其他功能 --> <!-- 其他功能 -->
<uni-card :border="false" :padding="0"> <uni-card :border="false" :padding="0">
<!-- 场馆管理可见--> <!-- 场馆管理可见-->
<block v-if="hasMerchantRole || hasMerchantClerkRole"> <block v-if="hasMerchantRole || hasMerchantClerkRole">
<view class="server" style="min-height: 200px"> <view class="card">
<uni-list :border="false"> <block v-for="(item, index) in mpMenus" :key="index">
<block v-for="(item, index) in mpMenus" :key="index"> <block v-if="index === '1981'" v-for="(v, i) in item" :key="i">
<block v-if="index === '1981'" v-for="(v,i) in item"> <view class="flex justify-between items-center py-20 border-bottom" @click="navTo(v)">
<uni-list-item :thumb="v.avatar" link @click="navTo(v)"> <view class="flex justify-start items-center">
<template v-slot:body> <uv-icon :name="v.avatar"/>
<view class="slot-box"> <text class="text-30 ml-20">{{ v.title }}</text>
<text class="slot-text" :style="{ color: v.color ? v.color : '#333333' }">{{ </view>
v.title <uv-icon name="arrow-right" size="24rpx"/>
}}
</text>
</view>
</template>
</uni-list-item>
</block>
</block>
</uni-list>
</view> </view>
</block> </block>
<block v-else> </block>
<!-- 普通会员菜单 --> <view class="flex justify-between items-center py-20 border-bottom" @click="scan">
<view class="server" style="min-height: 200px"> <view class="flex justify-start items-center">
<uni-list :border="false"> <uv-icon name="https://oss.wsdns.cn/20241126/92f728b3b4e146d6a916259bde11a209.png"/>
<block v-for="(item, index) in mpMenus" :key="index"> <text class="text-30 ml-20">扫码核销</text>
<block v-if="index === '1981'" v-for="(v,i) in item"> </view>
<uni-list-item :thumb="v.avatar" link @click="navTo(v)"> <uv-icon name="arrow-right" size="24rpx"/>
<template v-slot:body> </view>
<view class="slot-box"> <!-- <button class="share-btn" open-type="contact">-->
<text class="slot-text" :style="{ color: v.color ? v.color : '#333333' }">{{ <!-- <view class="flex justify-between items-center py-20 border-bottom">-->
v.title <!-- <view class="flex justify-start items-center">-->
}} <!-- <uv-icon name="https://oss.wsdns.cn/20240806/670b965e729b4a92a60927bf51bc8afe.png"/>-->
</text> <!-- <text class="text-30 ml-20" style="font-weight: normal!important;">联系客服</text>-->
</view> <!-- </view>-->
</template> <!-- <uv-icon name="arrow-right" size="24rpx"/>-->
</uni-list-item> <!-- </view>-->
</block> <!-- </button>-->
</block> </view>
</uni-list> <!-- <view class="server" style="min-height: 200px">-->
</view> <!-- <uni-list :border="false">-->
<!-- <block v-for="(item, index) in mpMenus" :key="index">-->
<!-- <block v-if="index === '1981'" v-for="(v,i) in item">-->
<!-- <uni-list-item :thumb="v.avatar" link @click="navTo(v)">-->
<!-- <template v-slot:body>-->
<!-- <view class="slot-box">-->
<!-- <text class="slot-text" :style="{ color: v.color ? v.color : '#333333' }">{{-->
<!-- v.title-->
<!-- }}-->
<!-- </text>-->
<!-- </view>-->
<!-- </template>-->
<!-- </uni-list-item>-->
<!-- </block>-->
<!-- </block>-->
<!-- <uni-list-item thumb="https://oss.wsdns.cn/20240806/670b965e729b4a92a60927bf51bc8afe.png" link>-->
<!-- <template v-slot:body>-->
<!-- <view class="slot-box">-->
<!-- <button class="share-btn" open-type="contact">联系客服</button>-->
<!-- </view>-->
<!-- </template>-->
<!-- </uni-list-item>-->
<!-- </uni-list>-->
<!-- </view>-->
</block>
<block v-else>
<!-- 普通会员菜单 -->
<view class="server" style="min-height: 200px">
<view class="card">
<block v-for="(item, index) in mpMenus" :key="index">
<block v-if="index === '1981'" v-for="(v, i) in item" :key="i">
<view class="flex justify-between items-center py-20 border-bottom" @click="navTo(v)">
<view class="flex justify-start items-center">
<uv-icon :name="v.avatar"/>
<text class="text-30 ml-20">{{ v.title }}</text>
</view>
<uv-icon name="arrow-right" size="24rpx"/>
</view>
</block>
</block> </block>
</uni-card> <!-- <button class="share-btn" open-type="contact">-->
<!-- <view class="flex justify-between items-center py-20 border-bottom">-->
<!-- <view class="flex justify-start items-center">-->
<!-- <uv-icon name="https://oss.wsdns.cn/20240806/670b965e729b4a92a60927bf51bc8afe.png"/>-->
<!-- <text class="text-30 ml-20" style="font-weight: normal!important;">联系客服</text>-->
<!-- </view>-->
<!-- <uv-icon name="arrow-right" size="24rpx"/>-->
<!-- </view>-->
<!-- </button>-->
</view>
<!-- <uni-list :border="false">-->
<!-- <block v-for="(item, index) in mpMenus" :key="index">-->
<!-- <block v-if="index === '1981'" v-for="(v,i) in item">-->
<!-- <uni-list-item :thumb="v.avatar" link @click="navTo(v)">-->
<!-- <template v-slot:body>-->
<!-- <view class="slot-box">-->
<!-- <text class="slot-text" :style="{ color: v.color ? v.color : '#333333' }">{{-->
<!-- v.title-->
<!-- }}-->
<!-- </text>-->
<!-- </view>-->
<!-- </template>-->
<!-- </uni-list-item>-->
<!-- </block>-->
<!-- </block>-->
<!-- <uni-list-item thumb="https://oss.wsdns.cn/20240806/670b965e729b4a92a60927bf51bc8afe.png" link>-->
<!-- <template v-slot:body>-->
<!-- <button class="share-btn" open-type="contact">联系客服</button>-->
<!-- </template>-->
<!-- </uni-list-item>-->
<!-- </uni-list>-->
</view>
</block>
</uni-card>
<!-- <block v-for="(item, index) in mpMenus" :key="index">--> <!-- <block v-for="(item, index) in mpMenus" :key="index">-->
<!-- <block v-if="index === '1981'">--> <!-- <block v-if="index === '1981'">-->
<!-- <uni-card :title="item[0].groupName" :border="false" :padding="0">--> <!-- <uni-card :title="item[0].groupName" :border="false" :padding="0">-->
<!-- <uv-skeleton rows="1" rowsHeight="30" rowsWidth="100%" :loading="mpMenus.length === 0" :title="false">--> <!-- <uv-skeleton rows="1" rowsHeight="30" rowsWidth="100%" :loading="mpMenus.length === 0" :title="false">-->
<!-- <div class="flex space-around py-6 flex-wrap">--> <!-- <div class="flex space-around py-6 flex-wrap">-->
<!-- <block v-for="(item,index) in item" :key="index">--> <!-- <block v-for="(item,index) in item" :key="index">-->
<!-- <div--> <!-- <div-->
<!-- class="service-item flex flex-col justify-center items-center web-cell-content web-text-center px-20"--> <!-- class="service-item flex flex-col justify-center items-center web-cell-content web-text-center px-20"-->
<!-- @click="navTo(item)">--> <!-- @click="navTo(item)">-->
<!-- <uv-avatar :src="item.avatar" :size="24" mode="widthFix"></uv-avatar>--> <!-- <uv-avatar :src="item.avatar" :size="24" mode="widthFix"></uv-avatar>-->
<!-- <text style="white-space: nowrap">{{ item.title }}</text>--> <!-- <text style="white-space: nowrap">{{ item.title }}</text>-->
<!-- </div>--> <!-- </div>-->
<!-- </block>--> <!-- </block>-->
<!-- </div>--> <!-- </div>-->
<!-- <w-gap height="5"></w-gap>--> <!-- <w-gap height="5"></w-gap>-->
<!-- </uv-skeleton>--> <!-- </uv-skeleton>-->
<!-- </uni-card>--> <!-- </uni-card>-->
<!-- </block>--> <!-- </block>-->
<!-- <block v-if="index === '1982' && (hasMerchantClerkRole || hasMerchantRole)">--> <!-- <block v-if="index === '1982' && (hasMerchantClerkRole || hasMerchantRole)">-->
<!-- <uni-card :title="item[0].groupName" :border="false" :padding="0">--> <!-- <uni-card :title="item[0].groupName" :border="false" :padding="0">-->
<!-- <uv-skeleton rows="1" rowsHeight="30" rowsWidth="100%" :loading="mpMenus.length === 0" :title="false">--> <!-- <uv-skeleton rows="1" rowsHeight="30" rowsWidth="100%" :loading="mpMenus.length === 0" :title="false">-->
<!-- <div class="flex space-around py-6 flex-wrap">--> <!-- <div class="flex space-around py-6 flex-wrap">-->
<!-- <block v-for="(item,index) in item" :key="index">--> <!-- <block v-for="(item,index) in item" :key="index">-->
<!-- <div--> <!-- <div-->
<!-- class="service-item flex flex-col justify-center items-center web-cell-content web-text-center px-20"--> <!-- class="service-item flex flex-col justify-center items-center web-cell-content web-text-center px-20"-->
<!-- @click="navTo(item)">--> <!-- @click="navTo(item)">-->
<!-- <image :src="item.avatar" style="width: 30px; height: 30px;" mode="widthFix"></image>--> <!-- <image :src="item.avatar" style="width: 30px; height: 30px;" mode="widthFix"></image>-->
<!-- <text style="white-space: nowrap">{{ item.title }}</text>--> <!-- <text style="white-space: nowrap">{{ item.title }}</text>-->
<!-- </div>--> <!-- </div>-->
<!-- </block>--> <!-- </block>-->
<!-- </div>--> <!-- </div>-->
<!-- <w-gap height="5"></w-gap>--> <!-- <w-gap height="5"></w-gap>-->
<!-- </uv-skeleton>--> <!-- </uv-skeleton>-->
<!-- </uni-card>--> <!-- </uni-card>-->
<!-- </block>--> <!-- </block>-->
<!-- </block>--> <!-- </block>-->
<!-- <ws-personal :form="users" ref="personal" @done="reload" />--> <!-- <ws-personal :form="users" ref="personal" @done="reload" />-->
<!-- 登录组件 --> <!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/> <ws-login ref="login" :logo="logo" @done="reload"/>
@@ -114,7 +177,7 @@
import {useUserStore} from '@/store/modules/user'; import {useUserStore} from '@/store/modules/user';
import * as MpMenuApi from '@/api/cms/mp-menu'; import * as MpMenuApi from '@/api/cms/mp-menu';
import * as UserCardApi from '@/api/booking/userCard'; import * as UserCardApi from '@/api/booking/userCard';
import {getThinkUsers,updateThinkUsers} from '@/api/think/thinkUsers'; import {getThinkUsers, updateThinkUsers} from '@/api/think/thinkUsers';
import {openUrl} from '@/utils/common'; import {openUrl} from '@/utils/common';
import {useMpStore} from "@/store/modules/mp"; import {useMpStore} from "@/store/modules/mp";
import {getWxOpenId, loginByOpenId} from '@/api/passport/login'; import {getWxOpenId, loginByOpenId} from '@/api/passport/login';
@@ -123,6 +186,7 @@ import Layout from "@/components/layout.vue";
import {useTenantStore} from '@/store/modules/tenant'; import {useTenantStore} from '@/store/modules/tenant';
import {authUser} from "@/api/user"; import {authUser} from "@/api/user";
import UvAvatar from "@/uni_modules/uv-avatar/components/uv-avatar/uv-avatar.vue"; import UvAvatar from "@/uni_modules/uv-avatar/components/uv-avatar/uv-avatar.vue";
import {getThinkOrderByCode} from "@/api/think/thinkOrder";
const tenantStore = useTenantStore(); const tenantStore = useTenantStore();
const mpStore = useMpStore(); const mpStore = useMpStore();
@@ -185,10 +249,10 @@ export default {
app.isLogin = true; app.isLogin = true;
} }
// 获取旧系统用户信息 // 获取旧系统用户信息
if(uni.getStorageSync('uid')){ if (uni.getStorageSync('uid')) {
await getThinkUsers(uni.getStorageSync('uid')).then(data => { await getThinkUsers(uni.getStorageSync('uid')).then(data => {
app.users = data; app.users = data;
console.log(app.users,'>>>>') console.log(app.users, '>>>>')
}) })
} }
// 当前登录用户信息 // 当前登录用户信息
@@ -199,7 +263,7 @@ export default {
uni.setStorageSync('user_id', app.userInfo.userId); uni.setStorageSync('user_id', app.userInfo.userId);
// 更新第三方系统的用户ID // 更新第三方系统的用户ID
if(!userInfo.uid && uni.getStorageSync('uid')){ if (!userInfo.uid && uni.getStorageSync('uid')) {
await authUser({uid: uni.getStorageSync('uid')}).then(res => { await authUser({uid: uni.getStorageSync('uid')}).then(res => {
console.log('更新第三方系统的用户ID') console.log('更新第三方系统的用户ID')
}) })
@@ -267,31 +331,21 @@ export default {
} }
// 菜单数据 // 菜单数据
MpMenuApi.pageMpMenu({type: 0, limit: 100}) MpMenuApi.pageMpMenu({type: 0, limit: 100})
.then((res) => { .then((res) => {
app.order = res.list.filter((d) => d.rows == 0); app.order = res.list.filter((d) => d.rows == 0);
app.server = res.list.filter((d) => d.rows == 1); app.server = res.list.filter((d) => d.rows == 1);
// console.log('app.hasMerchantRole: ',app.hasMerchantRole); if (!app.hasMerchantRole && !app.hasMerchantClerkRole) {
// console.log('app.hasMerchantClerkRole: ',app.hasMerchantClerkRole); app.server = res.list.filter((d) => d.rows == 1 && d.adminShow == 0);
// console.log('app.hasSuperAdminRole: ',app.hasSuperAdminRole); }
if (!app.hasMerchantRole && !app.hasMerchantClerkRole) { app.hideTools = false;
// console.log('11111: ',11111); })
app.server = res.list.filter((d) => d.rows == 1 && d.adminShow == 0); .catch(() => {
} uni.showToast({
app.hideTools = false; title: '请检查您的网络.',
}) icon: 'none'
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
app.hideTools = false;
}); });
app.hideTools = false;
UserCardApi.pageUserCard({payStatus: 1, userId: uni.getStorageSync('user_id')}).then(res => { });
console.log('res8888889: ', res);
app.userInfo.cards = res.count
app.userInfo.coupon = 1;
})
}, },
navTo(item) { navTo(item) {
if (!this.isLogin) { if (!this.isLogin) {
@@ -312,9 +366,28 @@ export default {
this.$refs.login.open('bottom'); this.$refs.login.open('bottom');
return false; return false;
} }
if(text){ if (text) {
uni.navigateTo({url: text}) uni.navigateTo({url: text})
} }
},
scan() {
uni.scanCode({
onlyFromCamera: true,
success: async ({result}) => {
const res = await getThinkOrderByCode(result)
if (!res.res) return uni.showToast({
title: res.msg,
icon: 'none'
})
uni.navigateTo({url: `/package/order/check?id=${res.data.id}`})
},
fail: (err) => {
uni.showToast({
title: '扫码失败',
icon: 'none'
})
}
});
} }
} }
}; };
+31 -1225
View File
File diff suppressed because it is too large Load Diff
+7 -1
View File
@@ -469,9 +469,10 @@ h6 {
margin: 30rpx; margin: 30rpx;
} }
.ml-5{ .ml-5 {
margin-left: 5rpx; margin-left: 5rpx;
} }
.ml-8 { .ml-8 {
margin-left: 8rpx; margin-left: 8rpx;
} }
@@ -499,6 +500,7 @@ h6 {
.mt-5 { .mt-5 {
margin-top: 5rpx; margin-top: 5rpx;
} }
.mt-6 { .mt-6 {
margin-top: 6rpx; margin-top: 6rpx;
} }
@@ -611,6 +613,7 @@ h6 {
.ml-20 { .ml-20 {
margin-left: 20rpx; margin-left: 20rpx;
} }
.mr-20 { .mr-20 {
margin-right: 20rpx; margin-right: 20rpx;
} }
@@ -854,9 +857,12 @@ h6 {
background: none; background: none;
margin: 0; margin: 0;
padding: 0; padding: 0;
font-size: 30rpx;
font-weight: normal;
&::after { &::after {
border: none; border: none;
font-weight: normal;
} }
} }
@@ -77,7 +77,7 @@
</view> </view>
</view> </view>
<view class="close-wrap text-gray-800" @click="closeLogin"> <view class="close-wrap text-gray-800" @click="closeLogin" :style="{top: `${top + 30}px`}">
<uv-icon name="close-circle" size="30"></uv-icon> <uv-icon name="close-circle" size="30"></uv-icon>
</view> </view>
</view> </view>
@@ -133,6 +133,7 @@ export default {
phone: '', phone: '',
code: '' code: ''
}, },
top: uni.getSystemInfoSync().safeAreaInsets.top
}; };
}, },
mounted() { mounted() {
+8
View File
@@ -0,0 +1,8 @@
## 1.0.5(2023-05-20)
.
## 1.0.2(2023-04-06)
修复了左右切换的问题
## 1.0.1(2023-04-05)
[1.0.1]
## 1.0.0(2023-04-05)
1.0.0
@@ -0,0 +1,455 @@
<template>
<view>
<!-- 日期选择器 -->
<view class="content">
<view class="calendar-wrapper">
<!-- 选择月份 -->
<view class="header" v-if="headerBar">
<view class="iconfont iconarrow-left-bold pre" @click="changeMonth('pre')">上个月</view>
<view>{{ y + '年' + formatNum(m) + '月' }}</view>
<view class="iconfont iconarrow-left-bold-copy next" @click="changeMonth('next')">下个月</view>
</view>
<!-- 星期栏 -->
<view class="week">
<view class="week-day" v-for="(item, index) in weekDay" :key="index">{{ item }}</view>
</view>
<!-- 日历数字 -->
<view class="content" :style="{ height: height }">
<view :style="{ top: positionTop + 'rpx' }" class="days">
<view class="item" v-for="(item,index) in dates" :key="index">
<view class="day" @click="selectOne(item, $event)" :class="{
choose: getActday(`${item.year}-${item.month}-${item.date}`) && item.isCurM,//选中的日期
chooseMarkDay:getChoose(`${item.year}-${item.month}-${item.date}`),
nolm: !item.isCurM,//不在本月的日
today: isToday(item.year, item.month, item.date),//当日日期
isWorkDay: isWorkDay(item.year, item.month, item.date)//周一至周五
}">
{{ Number(item.date) }}
</view>
<view class="iconfont iconyixuanzhong"
:class="{markDays:getChoose(`${item.year}-${item.month}-${item.date}`)}"
v-if="getChoose(`${item.year}-${item.month}-${item.date}`) && !isMarkDay(item.year, item.month, item.date)&&item.isCurM">
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
props: {
// 星期几为第一天(0为星期日)
weekstart: {
type: Number,
default: 0
},
// 标记的日期
markDays: {
type: Array,
default: () => {
return [];
}
},
//是否展示月份切换按钮
headerBar: {
type: Boolean,
default: true
},
//过去日期是否不可点击
disabledAfter: {
type: Boolean,
default: false
},
//接收用户选择的参数
actDay: {
type: Array,
default: [],
},
//接受已经被选择的参数
chooseDay: {
type: Array,
default: [],
}
},
data() {
return {
weektext: ['日', '一', '二', '三', '四', '五', '六'],
y: new Date().getFullYear(), // 年
m: new Date().getMonth() + 1, // 月
d: new Date().getDate(), //日
dates: [], // 当前月的日期数据
positionTop: 0,
choose: '',
chooseArr: [],
}
},
created() {
this.dates = this.monthDay(this.y, this.m);
console.log('')
},
mounted() {
// this.choose = this.getToday().date;
},
computed: {
// 顶部星期栏
weekDay() {
return this.weektext.slice(this.weekstart).concat(this.weektext.slice(0, this.weekstart));
},
height() {
return (this.dates.length / 7) * 80 + 'rpx';
}
},
methods: {
//已被投标的日期
getChoose(day) {
for (let i = 0; i < this.chooseDay.length; i++) {
if (day == this.chooseDay[i]) {
return true;
}
}
},
//用户选择的日期
getActday(day) {
for (let i = 0; i < this.actDay.length; i++) {
if (day == this.actDay[i] && !this.getChoose(day)) {
console.log("选中了", this.actDay);
return true;
}
}
},
formatNum(num) {
let res = Number(num);
return res < 10 ? '0' + res : res;
},
getToday() {
let date = new Date();
let y = date.getFullYear();
let m = date.getMonth();
let d = date.getDate();
let week = new Date().getDay();
let weekText = ['日', '一', '二', '三', '四', '五', '六'];
let formatWeek = '星期' + weekText[week];
let today = {
date: y + '-' + this.formatNum(m + 1) + '-' + this.formatNum(d),
week: formatWeek
};
return today;
},
// 获取当前月份数据
monthDay(y, month) {
let dates = [];
let m = Number(month);
let firstDayOfMonth = new Date(y, m - 1, 1).getDay(); // 当月第一天星期几
let lastDateOfMonth = new Date(y, m, 0).getDate(); // 当月最后一天
let lastDayOfLastMonth = new Date(y, m - 2, 0).getDate(); // 上一月的最后一天
let weekstart = this.weekstart == 7 ? 0 : this.weekstart;
let startDay = (() => {
// 周初有几天是上个月的
if (firstDayOfMonth == weekstart) {
return 0;
} else if (firstDayOfMonth > weekstart) {
return firstDayOfMonth - weekstart;
} else {
return 7 - weekstart + firstDayOfMonth;
}
})();
let endDay = 7 - ((startDay + lastDateOfMonth) % 7); // 结束还有几天是下个月的
for (let i = 1; i <= startDay; i++) {
dates.push({
date: this.formatNum(lastDayOfLastMonth - startDay + i),
day: weekstart + i - 1 || 7,
month: m - 1 >= 0 ? this.formatNum(m - 1) : 12,
year: m - 1 >= 0 ? y : y - 1
});
}
for (let j = 1; j <= lastDateOfMonth; j++) {
dates.push({
date: this.formatNum(j),
day: (j % 7) + firstDayOfMonth - 1 || 7,
month: this.formatNum(m),
year: y,
isCurM: true, //是否当前月份
});
}
for (let k = 1; k <= endDay; k++) {
dates.push({
date: this.formatNum(k),
day: (lastDateOfMonth + startDay + weekstart + k - 1) % 7 || 7,
month: m + 1 <= 11 ? this.formatNum(m + 1) : 0,
year: m + 1 <= 11 ? y : y + 1
});
}
// console.log(dates); //日期
return dates;
},
isWorkDay(y, m, d) {
//是否工作日
let ymd = `${y}/${m}/${d}`;
let formatDY = new Date(ymd.replace(/-/g, '/'));
let week = formatDY.getDay();
if (week == 0 || week == 6) {
return false;
} else {
return true;
}
},
isFutureDay(y, m, d) {
//是否未来日期
let ymd = `${y}/${m}/${d}`;
let formatDY = new Date(ymd.replace(/-/g, '/'));
let showTime = formatDY.getTime();
let curTime = new Date().getTime();
if (showTime > curTime) {
return true;
} else {
return false;
}
},
// 标记日期
isMarkDay(y, m, d) {
let flag = false;
for (let i = 0; i < this.markDays.length; i++) {
let dy = `${y}-${m}-${d}`;
if (this.markDays[i] == dy) {
flag = true;
break;
}
}
return flag;
},
isToday(y, m, d) {
let checkD = y + '-' + m + '-' + d;
let today = this.getToday().date;
if (checkD == today) {
return true;
} else {
return false;
}
},
// 点击回调
selectOne(i, event) {
let date = `${i.year}-${i.month}-${i.date}`;
let selectD = new Date(date).getTime();
let curTime = new Date().getTime();
let week = new Date(date).getDay();
let weekText = ['日', '一', '二', '三', '四', '五', '六'];
let formatWeek = '星期' + weekText[week];
let response = {
date: date,
week: formatWeek
};
if (!i.isCurM) {
console.log('不在当前月范围内');
return false;
}
if (selectD < curTime) {
if (this.disabledAfter) {
console.log('过去日期不可选');
return false;
} else {
this.choose = date;
this.$emit('onDayClick', response);
}
} else {
this.choose = date;
this.chooseArr.push(date)
this.$emit('onDayClick', response);
}
// console.log(response);
},
//改变年月
changYearMonth(y, m) {
this.dates = this.monthDay(y, m);
this.y = y;
this.m = m;
},
changeMonth(type) {
if (type == 'pre') {
if (this.m + 1 == 2) {
this.m = 12;
this.y = this.y - 1;
} else {
this.m = this.m - 1;
}
} else {
if (this.m + 1 == 13) {
this.m = 1;
this.y = this.y + 1;
} else {
this.m = this.m + 1;
}
}
this.dates = this.monthDay(this.y, this.m);
}
}
}
</script>
<style lang="scss">
.content {
.content_box {
}
// .popup_body {
// height: 800rpx;
// border-radius: 20rpx 20rpx 0 0;
// background-color: #fff;
// .close_popup {
// display: flex;
// flex-direction: row-reverse;
// padding: 20rpx;
// .iconfont {
// font-size: 36rpx;
// }
// }
.calendar-wrapper {
color: #6f6d6d;
font-size: 28rpx;
text-align: center;
background-color: #fff;
padding-bottom: 10rpx;
border-radius: 20rpx;
.header {
display: flex;
align-items: center;
justify-content: center;
height: 88rpx;
color: #42464A;
font-size: 32rpx;
font-weight: bold;
border-bottom: 2rpx solid #f2f2f2;
.pre,
.next {
font-size: 28rpx;
padding: 8rpx 15rpx;
border-radius: 10rpx;
// border: 2rpx solid #dcdfe6;
}
.pre {
margin-right: 30rpx;
}
.next {
margin-left: 30rpx;
}
}
.week {
display: flex;
align-items: center;
height: 80rpx;
line-height: 80rpx;
border-bottom: 1rpx solid rgba(255, 255, 255, 0.2);
view {
flex: 1;
}
}
.content {
position: relative;
overflow: hidden;
transition: height 0.4s ease;
.days {
transition: top 0.3s;
display: flex;
align-items: center;
flex-wrap: wrap;
position: relative;
.item {
position: relative;
display: block;
height: 80rpx;
line-height: 80rpx;
width: calc(100% / 7);
.day {
font-style: normal;
display: inline-block;
vertical-align: middle;
width: 60rpx;
height: 60rpx;
line-height: 60rpx;
overflow: hidden;
border-radius: 60rpx;
&.choose {
background-color: #4bcdc4;
color: #fff;
}
&.chooseMarkDay {
//已被投标的日期
background-color: #43a761;
color: #5b5b5b !important;
}
&.nolm {
color: #fff;
opacity: 0;
}
}
.isWorkDay {
color: #25272a;
}
.notSigned {
font-style: normal;
width: 8rpx;
height: 8rpx;
background: #fa7268;
border-radius: 10rpx;
position: absolute;
left: 50%;
bottom: 0;
pointer-events: none;
}
.today {
color: #fff;
background-color: #a0eac1;
}
.workDay {
font-style: normal;
width: 8rpx;
height: 8rpx;
background: #4d7df9;
border-radius: 10rpx;
position: absolute;
left: 50%;
bottom: 0;
pointer-events: none;
}
.markDays {
font-style: normal;
position: absolute;
top: 2rpx;
right: 11rpx;
pointer-events: none;
font-size: 80rpx;
color: rgba(160, 234, 193, 0.5);
}
}
}
}
}
// }
}
</style>
+85
View File
@@ -0,0 +1,85 @@
{
"id": "zeng-calen",
"displayName": "日历组件可选择周与月标记打卡支持左右切换",
"version": "1.0.5",
"description": "zeng-calen日历组件可选择周与月支持左右切换",
"keywords": [
"日历",
"多选",
"单选",
"日期选择",
"标记打卡"
],
"repository": "",
"engines": {
"HBuilderX": "^3.4.2"
},
"dcloudext": {
"type": "component-vue",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "插件不采集任何数据",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"Vue": {
"vue2": "y",
"vue3": "y"
},
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y",
"钉钉": "y",
"快手": "y",
"飞书": "y",
"京东": "y"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}
+69
View File
@@ -0,0 +1,69 @@
### 代码块
直接引入就可以使用,代码如下:
```xml
<template>
<view class="content">
<zeng-calen :actDay="actDay" :chooseDay="chooseDay" @onDayClick='onDayClick'></zeng-calen>
</view>
</template>
<script>
export default {
data() {
return {
actDay: [], //用户选择的日期
chooseDay: ["2023-04-13", "2023-04-15", "2023-04-16", "2023-04-05"], //已被投标的数据
}
},
onLoad() {
},
methods: {
// 展开日历
onDayClick(data) {
let choose = data.date //用户点中的数据
if (this.actDay.includes(choose)) { //如果用户点击的日期已经存在
// 移除元素下标
const index = this.actDay.indexOf(choose);
//删除用户点击的日期
this.actDay.splice(index, 1)
} else if (this.chooseDay.includes(choose)) { //判断是否已经被投标
uni.showToast({
title: "这个日期已经被投标了",
icon: "none"
})
} else {
//添加用户点击的日期
this.actDay.push(choose)
}
},
}
}
</script>
<style>
</style>
```
###
Calendar Props:
| 属性名 | 类型 | 默认值 | 说明 |
| :----- | :--: | :-------: | :-------: |
| weekstart | Number | 0 | 星期几为第一天(0为星期日) |
| markDays | Array | null | 已标记的日期 |
| headerBar | Boolean | true | 是否展示月份切换按钮 |
| disabledAfter | Boolean | false | 过去日期是否不可点击 |
| actDay | Array | null | 接收用户选择的参数 |
| chooseDay | Array | null | 接受已经被选择的参数 |
###
Calendar Events:
| 事件 | 说明 |
| :----- | :--: |
| onDayClick | 选中的日期 |
+48 -40
View File
@@ -1,7 +1,7 @@
import Request from 'luch-request' import Request from 'luch-request'
import { import {
SERVER_API_URL, SERVER_API_URL,
TENANT_ID TENANT_ID
} from '@/config/setting'; } from '@/config/setting';
const http = new Request(); const http = new Request();
@@ -10,56 +10,64 @@ const http = new Request();
* @param {Function} * @param {Function}
*/ */
http.setConfig((config) => { http.setConfig((config) => {
/* config 为默认全局配置*/ /* config 为默认全局配置*/
config.baseURL = SERVER_API_URL; /* 根域名 */ config.baseURL = SERVER_API_URL; /* 根域名 */
return config return config
}) })
// 拦截器(请求之前拦截) // 拦截器(请求之前拦截)
http.interceptors.request.use((config) => { // 可使用async await 做异步操作 http.interceptors.request.use((config) => { // 可使用async await 做异步操作
const token = uni.getStorageSync('access_token') const token = uni.getStorageSync('access_token')
config.header = { config.header = {
...config.header, ...config.header,
TenantId: TENANT_ID TenantId: TENANT_ID
} }
if (token) { if (token) {
config.header.Authorization = token config.header.Authorization = token
} }
if (config.data) { if (config.data) {
config.data.tenantId = TENANT_ID config.data.tenantId = TENANT_ID
} }
if (!token) { if (!token) {
// 如果token不存在,需要加签 // 如果token不存在,需要加签
// config.params.tenantId = TENANT_ID // config.params.tenantId = TENANT_ID
// config.params.sign = getSign(config.params, appSecret); // config.params.sign = getSign(config.params, appSecret);
} }
return config return config
}, config => { // 可使用async await 做异步操作 }, config => { // 可使用async await 做异步操作
return Promise.reject(config) return Promise.reject(config)
}) })
// 拦截器(请求之后拦截) // 拦截器(请求之后拦截)
http.interceptors.response.use((response) => { http.interceptors.response.use((response) => {
/* 对响应成功做点什么 可使用async await 做异步操作*/ /* 对响应成功做点什么 可使用async await 做异步操作*/
// if (response.data.code !== 200) { // 服务端返回的状态码不等于200,则reject() // if (response.data.code !== 200) { // 服务端返回的状态码不等于200,则reject()
// return Promise.reject(response) // return Promise.reject 可使promise状态进入catch // return Promise.reject(response) // return Promise.reject 可使promise状态进入catch
// if (response.config.custom.verification) { // 演示自定义参数的作用 // if (response.config.custom.verification) { // 演示自定义参数的作用
// return response.data // return response.data
// } // }
// token过期 // token过期
if (response.data.code == 401) { if (response.data.code == 401) {
uni.removeStorageSync('access_token')
} uni.removeStorageSync('user_id')
if (response.data.code == 1) { uni.removeStorageSync('phone')
return Promise.reject(response.data) }
} if (response.data.code == 1) {
return response return Promise.reject(response.data)
}
if (response.data.message === '请先登录') {
uni.removeStorageSync('access_token')
uni.removeStorageSync('user_id')
uni.removeStorageSync('phone')
return Promise.reject(response.data)
}
return response
}, (response) => { }, (response) => {
/* 对响应错误做点什么 (statusCode !== 200)*/ /* 对响应错误做点什么 (statusCode !== 200)*/
console.log(response) console.log(response)
return Promise.reject(response) return Promise.reject(response)
}) })
export default http export default http