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_SOCKET_URL=wss://server.gxwebsoft.com
VITE_SERVER_URL=https://server.gxwebsoft.com/api
VITE_API_URL=https://modules.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_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
+2 -5
View File
@@ -1,8 +1,5 @@
VITE_APP_NAME=后台管理系统
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_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 type { ApiResult, PageResult } from '@/api';
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) {
const res = await request.get<ApiResult<PageResult<UserInvoice>>>(
MODULES_API_URL + '/booking/user-invoice/page',
THINK_API_URL + '/booking/booking-user-invoice/page',
{
params
}
@@ -24,7 +25,7 @@ export async function pageUserInvoice(params: UserInvoiceParam) {
*/
export async function listUserInvoice(params?: UserInvoiceParam) {
const res = await request.get<ApiResult<UserInvoice[]>>(
MODULES_API_URL + '/booking/user-invoice',
THINK_API_URL + '/booking/booking-user-invoice',
{
params
}
@@ -40,7 +41,7 @@ export async function listUserInvoice(params?: UserInvoiceParam) {
*/
export async function addUserInvoice(data: UserInvoice) {
const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/booking/user-invoice',
THINK_API_URL + '/booking/booking-user-invoice',
data
);
if (res.data.code === 0) {
@@ -54,7 +55,7 @@ export async function addUserInvoice(data: UserInvoice) {
*/
export async function updateUserInvoice(data: UserInvoice) {
const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/booking/user-invoice',
THINK_API_URL + '/booking/booking-user-invoice',
data
);
if (res.data.code === 0) {
@@ -68,7 +69,7 @@ export async function updateUserInvoice(data: UserInvoice) {
*/
export async function removeUserInvoice(id?: number) {
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) {
return res.data.message;
@@ -81,7 +82,7 @@ export async function removeUserInvoice(id?: number) {
*/
export async function removeBatchUserInvoice(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/booking/user-invoice/batch',
THINK_API_URL + '/booking/booking-user-invoice/batch',
{
data
}
@@ -97,7 +98,7 @@ export async function removeBatchUserInvoice(data: (number | undefined)[]) {
*/
export async function getUserInvoice(id: number) {
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) {
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>>(
MODULES_API_URL + '/booking/user-invoice/doInvoice',
THINK_API_URL + '/think/think-invoice/doInvoice',
data
);
if (res.data.code === 0) {
@@ -123,9 +124,9 @@ export async function doInvoice(data: UserInvoice) {
/**
* 根据orderNo查询发票
*/
export async function showInvoice(orderNo: string) {
export async function showInvoice(id: number) {
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) {
return res.data.data;
+12 -12
View File
@@ -1,6 +1,6 @@
import request from '@/utils/request';
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 {Merchant} from "@/api/shop/merchant/model";
@@ -9,7 +9,7 @@ import type {Merchant} from "@/api/shop/merchant/model";
*/
export async function pageCart(params: CartParam) {
const res = await request.get<ApiResult<PageResult<Cart>>>(
MODULES_API_URL + '/shop/cart/page',
THINK_API_URL + '/shop/cart/page',
{
params
}
@@ -25,7 +25,7 @@ export async function pageCart(params: CartParam) {
*/
export async function listCart(params?: CartParam) {
const res = await request.get<ApiResult<CartVo>>(
MODULES_API_URL + '/shop/cart',
THINK_API_URL + '/shop/cart',
{
params
}
@@ -41,7 +41,7 @@ export async function listCart(params?: CartParam) {
*/
export async function addCart(data: Cart) {
const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/shop/cart',
THINK_API_URL + '/shop/cart',
data
);
console.log(res)
@@ -56,7 +56,7 @@ export async function addCart(data: Cart) {
*/
export async function updateCart(data: Cart) {
const res = await request.put<ApiResult<unknown>>(
MODULES_API_URL + '/shop/cart',
THINK_API_URL + '/shop/cart',
data
);
if (res.data.code === 0) {
@@ -70,7 +70,7 @@ export async function updateCart(data: Cart) {
*/
export async function removeCart(id?: number) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/shop/cart/' + id
THINK_API_URL + '/shop/cart/' + id
);
if (res.data.code === 0) {
return res.data.message;
@@ -81,7 +81,7 @@ export async function removeCart(id?: number) {
// 按店铺ID更新选中
export async function updateCartByMerchantId(id?: number) {
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) {
return res.data.message;
@@ -93,7 +93,7 @@ export async function updateCartByMerchantId(id?: number) {
// 全选操作
export async function onSelectAll(yes: Boolean) {
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) {
return res.data;
@@ -105,7 +105,7 @@ export async function onSelectAll(yes: Boolean) {
* 批量修改
*/
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) {
return res.data.message;
}
@@ -117,7 +117,7 @@ export async function updateBatchCart(data: Cart[]) {
*/
export async function removeBatchCart(data: (number | undefined)[]) {
const res = await request.delete<ApiResult<unknown>>(
MODULES_API_URL + '/shop/cart/batch',
THINK_API_URL + '/shop/cart/batch',
data
);
if (res.data.code === 0) {
@@ -131,7 +131,7 @@ export async function removeBatchCart(data: (number | undefined)[]) {
*/
export async function getCart(id: number) {
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) {
return res.data.data;
@@ -144,7 +144,7 @@ export async function getCart(id: number) {
*/
export async function myCart(params: CartParam) {
const res = await request.get<ApiResult<Merchant[]>>(
MODULES_API_URL + '/shop/cart/myCart',
THINK_API_URL + '/shop/cart/myCart',
{
params
}
+3 -2
View File
@@ -123,8 +123,9 @@ export async function bindCard(data: ThinkCard) {
THINK_API_URL + '/think/think-card/bindCard',
data
);
if (res.data.code === 0 && res.data.data) {
return res.data.data;
console.log('res.data.code', res.data.code)
if (res.data.code === 0) {
return res.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 { 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
);
if (res.data.code === 0) {
return res.data.message;
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 { 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
);
if (res.data.code === 0) {
return res.data.message;
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
+1 -1
View File
@@ -44,7 +44,7 @@ export async function addThinkInvoice(data: ThinkInvoice) {
data
);
if (res.data.code === 0) {
return res.data.message;
return res.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 { 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));
}
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) {
const res = await request.post<ApiResult<ThinkOrder>>(
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));
}
export async function thinkUsersVipRepay(data: any) {
const res = await request.post<ApiResult<ThinkUsersVip>>(
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));
}
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",
"@vitejs/plugin-vue": "^5.0.5",
"autoprefixer": "^9.8.8",
"coordtransform": "^2.1.2",
"crypto-js": "^4.2.0",
"dayjs": "^1.11.11",
"decimal.js": "^10.4.3",
@@ -28,6 +29,5 @@
"repository": {},
"author": "",
"license": "ISC",
"displayName": "websoft-app",
"devDependencies": {}
"displayName": "websoft-app"
}
+1 -1
View File
@@ -7,7 +7,7 @@
<uv-cell :title="`${item.title}`" :label="item.createTime" :cellStyle="{padding: '8px'}"
:border="false" @click="openUrl('/package/article/detail?id='+item.articleId)">
<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>
</uv-cell>
</uv-cell-group>
+82 -109
View File
@@ -5,62 +5,64 @@
<uv-tabs :list="next7day" :itemStyle="{height: '58px'}" :activeStyle="{ color: '#2ba91c'}" lineColor="#2ba91c"
:inactiveStyle="{ color: '#808080' }" @change="onDateTime"></uv-tabs>
</uv-sticky>
<view class="uni-padding-wrap uni-common-mt">
<uni-segmented-control :current="current" :values="items" activeColor="#2ba91c" inActiveColor="#ff0000"
@clickItem="onType"/>
<template v-if="merchantId !== 37">
<view class="uni-padding-wrap uni-common-mt" v-if="fieldList && fieldList.length && fieldList[0].isHalf === 1">
<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 class="uni-badge-wrap">
<view class="badge-item">
<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 class="badge-item">
<uv-badge :isDot="true" type="info"></uv-badge>
<text class="web-text-secondary">已出售</text>
</view>
<!-- 场地列表 -->
<view class="checkout-body web-text-primary" v-if="periodList.length > 0">
<template v-for="(item,index) in periodList" :key="index">
<view class="period-item">
<view class="period">{{ item.timePeriod }}</view>
<view class="field-list">
<template v-for="(field,index2) in fieldList" :key="index2">
<view class="field"
:class="isActive(field, item)"
@click="onField(field, item)">
<text class="field-name">{{ field.name }}</text>
<text class="price">{{ item.price }}元</text>
</view>
</template>
</view>
</view>
</template>
<!-- 排版样式备份 -->
<view class="period-item" style="display: none;">
<view class="period">18:00 - 20:00</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 class="checkout-body web-text-primary" v-if="periodList.length > 0">
<template v-for="(item, index) in periodList" :key="index">
<view class="period-item">
<view class="period">{{ item.timePeriod }}</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>
<template v-for="(field, index2) in fieldList" :key="index2">
<view class="field"
:class="isActive(field, item)"
@click="onField(field, item)">
<text class="field-name">{{ field.name }}</text>
<text class="price">{{ isHalf !== 1 ? item.price : item.halfPrice }}元</text>
</view>
</template>
</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 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>
@@ -180,7 +182,7 @@ export default {
}
},
onLoad(option) {
this.merchantId = option.id
this.merchantId = parseInt(option.id)
this.reload();
},
onShow() {
@@ -194,7 +196,8 @@ export default {
const app = this
let totalPrice = 0;
app.selection.map(d => {
totalPrice = totalPrice + d.price
if (app.isHalf === 1) totalPrice += d.halfPrice
else totalPrice += d.price
})
carStore.totalPrice = totalPrice
console.log('totalPrice: ', totalPrice);
@@ -256,7 +259,9 @@ export default {
},
setDateList() {
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')
this.next7day.push({
week: day.format('d') === '0' ? '7' : day.format('d'),
@@ -276,8 +281,14 @@ export default {
this.periodList = []
this.timeList.forEach(item => {
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() {
this.disabled = !this.disabled;
@@ -305,7 +316,7 @@ export default {
},
async getFieldList() {
if (!this.periodList.length) {
return uni.showToast({
return uni.showToast({
title: '暂无可预订场地',
icon: 'none'
})
@@ -324,53 +335,6 @@ export default {
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() {
// this.showCarInfo = !this.showCarInfo;
// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
@@ -380,8 +344,11 @@ export default {
this.$refs.popup.close()
},
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
}
const app = this
@@ -402,6 +369,7 @@ export default {
})
return false
}
// console.log(field)
const split = item.timePeriod.split(' - ')
const siteTime = field.periodVoList.find(d => d.period === item.timePeriod)
// 添加到购物车
@@ -412,11 +380,12 @@ export default {
fieldId: field.id,
fieldName: field.name,
price: item.price,
halfPrice: item.halfPrice,
childrenPrice: item.childrenPrice,
adultNum: 1,
childrenNum: 0,
siteName: merchant.name,
isChildren: item.isChildren,
isChildren: 2,
isHalf: this.isHalf,
type: this.type,
timePeriod: item.timePeriod,
@@ -428,7 +397,7 @@ export default {
dateTime: `${this.dateTime}`,
comments: `${this.dateTime}(${getWeek(week)})${item.timePeriod}`,
})
console.log(app.selection);
// console.log(app.selection);
// console.log('period: ', period);
// 是否支持儿童票
// console.log('item.isChildren: ', item.isChildren);
@@ -448,7 +417,10 @@ export default {
},
isActive(field, item) {
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) {
return 'web-bg-warning'
}
@@ -467,6 +439,7 @@ export default {
uni.navigateTo({
url: '/package/booking/confirm',
success: (res) => {
console.log(this.selection)
res.eventChannel.emit('data', this.selection)
}
})
+278 -179
View File
@@ -25,15 +25,8 @@
<uv-cell
:title="`${item.fieldName}`"
:label="`${item.dateTime} ${getWeek(this.week)} ${item.timePeriod}`"
:value="form.sid === 37 ? '' : `¥${item.type === 1 ? item.price :item.halfPrice}`"
: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">
<template v-slot:title>
@@ -48,34 +41,26 @@
</uv-radio-group>
</template>
</uv-cell> -->
<block v-for="(item,index) in radiolist" :key="index">
<uv-cell iconStyle="checkbox-mark" :cellStyle="{ padding: '10px 5px' }" :border="false"
v-if="childrenPrice > 0">
<template v-slot:title>
<view class="flex">
<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 v-if="form.sid === 37">
<uv-cell @click="changeIsChildren(2)" iconStyle="checkbox-mark" :title="`成人票 ¥${item.price}`"
:cellStyle="{ padding: '10px 5px' }">
<template v-slot:right-icon>
<uv-icon v-if="parseInt(isChildren) === 2" size="30rpx" name="checkbox-mark"></uv-icon>
</template>
</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>
</uv-cell-group>
@@ -103,7 +88,38 @@
</view>
</view>
</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="web-cell web-cell-content web-cell-align-top">
<uni-icons type="circle" size="20" color="#a4a5a7" v-if="!disabled" @click="onDisabled"></uni-icons>
@@ -161,23 +177,26 @@
<script>
import * as Api from '@/api/shop/order';
import * as UserApi from '@/api/booking/users';
import * as UserCardApi from '@/api/booking/userCard';
import * as PaymentApi from '@/api/system/payment';
import {checkPayPassword} from '@/api/passport/login';
import {storeToRefs} from 'pinia';
import {cal} from '@/utils/decimal';
import {getWeek, getKey} from '@/utils/common';
import {useCarStore} from '@/store/modules/car';
import {useUserStore} from '@/store/modules/user';
import dayjs from "dayjs";
import {addThinkOrder} from "@/api/think/thinkOrder";
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 carStore = useCarStore();
// const { merchantId, merchantCode, orderInfo, period, totalPrice, reducePrice, payPrice, childrenPrice, carNum, carNum2, merchant, type, dateTime } = storeToRefs(carStore);
export default {
computed: {
dayjs() {
return dayjs
}
},
data() {
return {
orderId: 0,
@@ -212,9 +231,12 @@ export default {
cardId: 0,
getWeek,
isLogin: false,
disabled: false,
disabled: true,
cardList: [],
userCard: {},
userCard: [],
allUserCard: [],
vipCard: [],
allVipCard: [],
// isRefresh: true,
// 支付密码是否正确
isPayPasswordCorrect: false,
@@ -222,23 +244,10 @@ export default {
payPassword: '',
// 折扣率
discount: 1,
// 票类型
radiolist: [
{
name: '成人票',
price: 50,
totalPrice: 50,
disabled: false
},
{
name: '儿童票',
price: 35,
totalPrice: 35,
disabled: false
}
],
radiovalue: '成人票',
userCardList: []
originPrice: 0,
isChildren: null,
peopleNum: 1,
};
},
async onLoad() {
@@ -251,9 +260,12 @@ export default {
const eventChannel = this.getOpenerEventChannel();
const _this = this
this.userInfo = await userStore.fetchUserInfo();
eventChannel.on('data', function (data) {
eventChannel.on('data', async (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 = []
data.forEach(item => {
const [startTime, endTime] = item.timePeriod.split(' - ')
@@ -276,6 +288,7 @@ export default {
name: _this.userInfo.realName,
phone: _this.userInfo.phone,
sid: data[0].sid,
fid: data[0].fieldId,
cid: null,
vid: null,
code: null,
@@ -284,9 +297,14 @@ export default {
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() {
this.userInfo = await userStore.fetchUserInfo();
@@ -365,12 +383,19 @@ export default {
}
// 请求数据
app.userCard = []
Promise.all([app.getUserCard(), app.getPayment()]).then((res) => {
const userCard = res[0];
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) => {
if (d.type == 0) {
@@ -390,48 +415,131 @@ export default {
const res = await listUserThinkCard()
if (res.length) {
this.userCard = res
// if (this.userCard) {
// // 整理表单字段
// form.cardId = userCard.id;
// form.payType = 2;
// app.payType = 2;
//
// // 1年卡
// if (userCard.type == 1) {
// }
//
// // 2次卡
// if (userCard.type == 2) {
// }
//
// // 3月卡
// if (userCard.type == 3) {
// }
//
// // 4会员IC卡
// if (userCard.type == 2) {
// }
// // 5充值卡
// if (userCard.type == 5) {
// // 折扣率
// app.discount = cal.cheng(userCard.discount, 0.1);
//
// // 订单金额
// const orderPrice = totalPrice || form.totalPrice;
// if (orderPrice) {
// console.log('orderPrice: ', orderPrice);
// // 折后金额
// const lastTotalPrice = cal.cheng(orderPrice, app.discount);
// console.log('折后金额: ', lastTotalPrice);
// // 减少的金额
// app.reducePrice = cal.jian(orderPrice, lastTotalPrice);
// console.log('减少的金额: ', app.reducePrice);
// // 实付额
// app.payPrice = orderPrice * app.discount;
// console.log('实付额: ', app.payPrice);
// }
// }
// }
if (this.userCard.length > 0) {
this.userCard = this.userCard.filter(card => {
const sid = card.sid.split(',').map(Number);
return sid.includes(parseInt(this.form.sid))
});
this.allUserCard = JSON.parse(JSON.stringify(this.userCard))
this.allUserCard = this.allUserCard.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.allUserCard.length; i++) {
const item = this.allUserCard[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.allUserCard = JSON.parse(JSON.stringify(newList))
this.makeUserCardList()
}
}
},
makeUserCardList() {
this.userCard = this.allUserCard.filter(item => dayjs(item.expireTime * 1000).isAfter(dayjs()))
if (this.isChildren === 2) {
this.userCard = this.userCard.filter(item => item.cardType !== 2)
} else {
this.userCard = this.userCard.filter(item => item.cardType === 2)
}
if (this.userCard.length) {
this.userCard.sort((a, b) => a.type - b.type)
this.form.payType = 5
this.form.vid = null
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) {
const app = this;
const {form, totalPrice, carNum, childrenPrice, radiovalue} = this;
// app.payType = index;
app.form.payType = index;
app.form.cardId = 0;
console.log('childrenPrice: ', childrenPrice);
// 重新总金额
app.payPrice = 0;
app.reducePrice = 0;
await app.countTotalPrice()
if (index === 2) {
await app.reload();
}
this.form.payType = index;
this.form.vid = null
this.form.code = null
this.reducePrice = 0
if (this.form.sid !== 37) this.payPrice = this.originPrice
if (this.form.payType === 2) this.makeUserVipCardList()
if (this.form.payType === 5) this.makeUserCardList()
},
openUrl(url) {
if (!this.isLogin) {
@@ -506,38 +607,6 @@ export default {
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() {
const app = this;
const {form} = this;
@@ -555,9 +624,16 @@ export default {
});
return false;
}
if (form.payType === 2 && !app.userCard) {
if (form.payType === 2 && !app.form.vid) {
uni.showToast({
title: '没有找到可用的会员卡',
title: '请选择会员卡',
icon: 'none'
});
return false;
}
if (form.payType === 5 && !app.form.code) {
uni.showToast({
title: '请选择IC卡',
icon: 'none'
});
return false;
@@ -570,8 +646,19 @@ export default {
uni.showLoading({
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)
.then((data) => {
const orderInfo = data;
@@ -608,13 +695,8 @@ export default {
fail: function (err) {
console.log('支付失败', err);
app.disabled = false;
uni.reLaunch({
url: '/pages/order/order',
success: function (e) {
var page = getCurrentPages()[0];
if (page == undefined || page == null) return;
page.onLoad();
}
uni.switchTab({
url: '/pages/order'
});
// uni.switchTab({
// url: '/pages/order/order'
@@ -639,20 +721,13 @@ export default {
setTimeout(function () {
app.disabled = false;
app.$refs.payPasswordForm.close();
uni.reLaunch({
url: '/pages/order/order',
success: function (e) {
var page = getCurrentPages()[0];
if (page == undefined || page == null) return;
page.onLoad();
}
});
uni.switchTab({url: '/pages/order'})
}, 1500);
}
}
// 使用会员卡支付
if (form.payType === 2) {
if (form.payType === 2 || form.payType === 5) {
if (!orderInfo) {
return uni.showToast({
title: '支付失败',
@@ -666,18 +741,10 @@ export default {
});
setTimeout(function () {
app.disabled = false;
uni.reLaunch({
url: '/pages/order/order',
success: function (e) {
var page = getCurrentPages()[0];
if (page == undefined || page == null) return;
page.onLoad();
}
});
uni.switchTab({url: '/pages/order'})
}, 1500);
}
}
uni.hideLoading();
})
.catch((res) => {
@@ -687,6 +754,38 @@ export default {
});
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">
<view class="web-text-heading booking-content">
<view v-html="merchant.content"></view>
<uv-parse :content="merchant.info"></uv-parse>
</view>
</uni-card>
<view class="xieyi web-cell web-text-secondary 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="checkbox" size="20" color="#11a954" v-else @click="onDisabled"></uni-icons>
<view class="text" @click="onDisabled">
<text>我已阅读并同意</text>
<text class="link"
@click.stop="navTo('/package/article/detail?articleId=503')">《订票协议》
</text>
</view>
</view>
</view>
<!-- <view class="xieyi web-cell web-text-secondary 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="checkbox" size="20" color="#11a954" v-else @click="onDisabled"></uni-icons>-->
<!-- <view class="text" @click="onDisabled">-->
<!-- <text>我已阅读并同意</text>-->
<!-- <text class="link"-->
<!-- @click.stop="navTo('/package/article/detail?articleId=503')">《订票协议》-->
<!-- </text>-->
<!-- </view>-->
<!-- </view>-->
<!-- </view>-->
<view class="save-btn">
<uv-button
:customStyle="{background: 'linear-gradient(to right, #ccff66, #008e04)',borderRadius: '30px',color: '#ffffff'}"
text="预定场地" @click="save"></uv-button>
text="预定场地" @click="openProtocol"></uv-button>
</view>
</view>
<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">
<view class="popup-booking-tel">
@@ -82,6 +82,19 @@
</uni-popup>
<!-- 登录组件 -->
<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>
<script>
@@ -92,6 +105,8 @@ import {getThinkSite, getThinkSiteWithDistance} from "@/api/think/thinkSite";
import {getLocationAction} from "@/utils";
import request from "@/utils/request";
import X2js from 'x2js';
import {getArticle, pageArticle} from "@/api/cms/article";
import coordtransform from "coordtransform";
const carStore = useCarStore();
@@ -107,6 +122,9 @@ export default {
disabled: true,
lat: null,
lng: null,
protocol: null,
countDown: 0,
timer: null,
}
},
async onLoad(option) {
@@ -115,6 +133,7 @@ export default {
const {longitude, latitude} = await getLocationAction()
this.lat = latitude
this.lng = longitude
await this.getProtocol()
await this.reload();
},
onShow() {
@@ -124,6 +143,32 @@ export default {
}
},
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() {
const app = this
@@ -175,9 +220,12 @@ export default {
})
},
mapTo(item) {
const latitude = item.lat;
const longitude = item.lng;
const [lng, lat] = coordtransform.wgs84togcj02(longitude, latitude)
uni.openLocation({
latitude: parseFloat(item.lat),
longitude: parseFloat(item.lng),
latitude: lat,
longitude: lng,
success: function () {
console.log('success');
}
@@ -202,9 +250,10 @@ export default {
console.log('返回可以用于uni.openLocation的经纬度: ', res);
const latitude = this.merchant.lat;
const longitude = this.merchant.lng;
const [lng, lat] = coordtransform.wgs84togcj02(longitude, latitude)
uni.openLocation({
latitude: latitude,
longitude: longitude,
latitude: lat,
longitude: lng,
success: function () {
console.log('success');
}
@@ -213,18 +262,26 @@ export default {
});
},
save() {
if (!this.disabled) {
uni.showToast({
title: '请先阅读并同意订票协议',
icon: 'none'
})
return false
}
// if (!this.disabled) {
// uni.showToast({
// title: '请先阅读并同意订票协议',
// icon: 'none'
// })
// return false
// }
if (this.timer) clearTimeout(this.timer)
this.$refs.protocolPopup.close()
uni.navigateTo({
url: '/package/booking/checkout?id=' + this.id
})
}
}
},
onHide() {
if (this.timer) clearTimeout(this.timer)
},
onUnload() {
if (this.timer) clearTimeout(this.timer)
},
}
</script>
<style>
+50 -93
View File
@@ -1,51 +1,40 @@
<template>
<layout @done="onLayout">
<uv-empty :show="cart.totalNums === 0" mode="car" class="none"
<view>
<uv-empty :show="cart.length === 0" mode="car" class="none"
icon="https://cdn.uviewui.com/uview/empty/car.png"></uv-empty>
<block v-for="(item,index) in cart.shops" :key="index">
<uni-card :border="false" :padding="0">
<template v-slot:title>
<view class="title-bar flex items-center">
<uv-avatar :src="item.shopLogo" size="24"></uv-avatar>
<view class="title ml-1">{{ 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 6px'}" :border="false">
<template v-slot:icon>
<uv-avatar v-if="cart.selected" src="https://oss.wsdns.cn/20240723/cc887e4a1cd749ebb5a1cfa2484c01f2.png"
size="16" @click="onSelected(cart)"></uv-avatar>
<uv-avatar v-else src="https://oss.wsdns.cn/20240723/2f9ae761ebb343fcbcaccd7441c88e20.png" size="16"
@click="onSelected(cart)"></uv-avatar>
</template>
<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 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>
<uni-card :border="false" :padding="0" v-if="cart.length">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff', marginBottom: '20px'}" :border="false">
<uv-cell v-for="(cart, index) in cart" :cellStyle="{padding: '12px 6px'}" :border="false" :key="index">
<template v-slot:icon>
<uv-avatar v-if="cart.selected" src="https://oss.wsdns.cn/20240723/cc887e4a1cd749ebb5a1cfa2484c01f2.png"
size="16" @click="onSelected(cart)"></uv-avatar>
<uv-avatar v-else src="https://oss.wsdns.cn/20240723/2f9ae761ebb343fcbcaccd7441c88e20.png" size="16"
@click="onSelected(cart)"></uv-avatar>
</template>
<template v-slot:title>
<view class="goods-title flex items-center w-full">
<uv-image
:src="cart.image"
width="120rpx" height="120rpx" radius="5"/>
<view class="goods-info flex flex-col justify-between w-75p">
<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 mt-15">
<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>
</template>
</uv-cell>
</uv-cell-group>
</uni-card>
</block>
</view>
</template>
</uv-cell>
</uv-cell-group>
</uni-card>
<uv-gap height="100"></uv-gap>
@@ -53,13 +42,13 @@
:style="'bottom: ' + bottom + 'px;'">
<view class="flex flex-row items-center ml-15" @click="onSelectAll">
<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>
<uv-avatar src="https://oss.wsdns.cn/20240723/cc887e4a1cd749ebb5a1cfa2484c01f2.png" v-else
size="16"></uv-avatar>
<text class="ml-10 text-22">全选</text>
<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 class="price-bar flex flex-row items-center">
@@ -68,12 +57,12 @@
<text class="web-text-heading text-22">合计:</text>
<text class="text-22 web-text-danger">¥</text>
<uv-count-to :startVal="0" decimals="2" duration="100" color="#ff0000" bold
:endVal="cart.totalPrice"></uv-count-to>
:endVal="totalPrice"></uv-count-to>
</view>
<!-- <text class="text-red-500 text-22 text-right">已优惠¥0.00</text>-->
</view>
<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'}"
@click="save"></uv-button>
</view>
@@ -95,7 +84,7 @@
</uv-cell-group>
</uni-card>
</uni-popup>
</layout>
</view>
</template>
<script>
@@ -146,7 +135,6 @@ export default {
isRefresh: false,
isLogin: false,
userId: 0,
config: {},
isNew,
canReset: false,
loadMore: 'more',
@@ -170,11 +158,11 @@ export default {
styleType: 'text',
getWeek,
// 骨架屏
hideTools: true
hideTools: true,
selectNums: 0,
totalPrice: 0,
}
},
onLoad() {
},
onShow() {
this.reload();
},
@@ -207,10 +195,6 @@ export default {
app.bottom = 0;
// #endif
// 获取小程序信息包
const info = await mpStore.fetchMpInfo();
// 配置信息
app.config = info.config
// 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
app.isLogin = true;
@@ -222,18 +206,21 @@ export default {
app.loadMore = 'loading'
// 加载购物车数据
this.selectNums = 0
CartApi.listCart(where).then(data => {
if(data){
app.cart = data
if (data) {
app.cart = data.map(item => {
if (item.selected) {
this.selectNums += 1
this.totalPrice += parseFloat((item.price * item.cartNum).toFixed(2))
}
return item
})
}
}).finally(() => {
app.loadMore = 'more'
uni.hideLoading()
})
},
onLayout({mpMenus}) {
this.mpMenus = mpMenus;
},
openUrl(url) {
uni.navigateTo({
@@ -277,27 +264,12 @@ export default {
},
// 弹出登录提示框
async openLogin() {
// 当前租户信息
const info = await mpStore.fetchMpInfo();
// 配置信息
this.config = info.config
this.userId = uni.getStorageSync('user_id');
if (!this.userId) {
this.$refs.login.open('bottom')
return false;
}
},
// 申请开票
onInvoice(id) {
uni.navigateTo({
url: '/package/user/invoice?id=' + id
})
},
showInvoice(id) {
uni.navigateTo({
url: `/package/user/invoice-show?id=${id}`
})
},
openCarInfo() {
this.$refs.popup.open('bottom')
},
@@ -338,23 +310,15 @@ export default {
});
},
onRemove() {
const {shops} = this.cart
CartApi.removeBatchCart(shops[0]?.carts?.map(d => d.id)).then(res => {
CartApi.removeBatchCart(this.cart.map(d => d.id)).then(res => {
uni.showToast({
title: '删除成功',
icon: 'success',
})
this.shops = []
// 更新购物车角标
uni.removeTabBarBadge({
index: 2
})
});
},
save() {
// if (this.shops.length === 0) {
// return false
// }
uni.redirectTo({url: `/package/goods/checkout?selected=true&isNew=false`})
}
}
@@ -362,13 +326,6 @@ export default {
</script>
<style lang="scss">
.admin-tools {
width: 700rpx;
margin: 20rpx auto;
padding: 0 16rpx;
font-size: 24rpx;
}
.title-bar {
padding: 20rpx 10rpx;
}
+188 -269
View File
@@ -1,100 +1,64 @@
<template>
<view class="container">
<uni-card :border="false" :is-shadow="false">
<view class="delivery flex justify-between items-center bg-white m-a p-10">
<uv-button :customStyle="{ borderRadius: '30px', backgroundColor: `${deliveryType === 0 ? '#ff0000' : '#c9c9c9'}`, color: '#ffffff', padding: '0rpx 80rpx' }" :text="'快递配送'" @click="onDeliveryType(0)"></uv-button>
<uv-button :customStyle="{ borderRadius: '30px', backgroundColor: `${deliveryType === 0 ? '#c9c9c9' : '#ff0000'}`, color: '#ffffff', padding: '0rpx 80rpx' }" :text="'上门自提'" @click="onDeliveryType(1)"></uv-button>
</view>
</uni-card>
<uni-card :border="false" :is-shadow="false" v-if="address.name">
<uv-cell
v-if="deliveryType === 0"
:title="`${address.name} &nbsp; ${address.phone}`"
:label="`${address.address}`"
icon="map"
:cellStyle="{ padding: '5px 0' }"
:border="false"
@click="openAddressList"
>
<template v-slot:right-icon>
<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>
<uni-card :border="false" :padding="10">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff', marginBottom: '20px'}" :border="false">
<uv-cell v-for="(cart, index) in carts" :cellStyle="{padding: '12px 0'}" :border="false" :index="index">
<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 flex-col justify-between w-75p">
<view class="goods-name">
<uv-text :lines="1" bold :text="cart.goodsName"></uv-text>
<uv-text v-if="cart.spec" 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 }}/{{ cart.goods.maxIntegral }}积分</view>
<view class="tool-btn web-text-secondary">
x {{ cart.cartNum }}
</view>
</view>
</view>
</template>
</uv-cell>
</uv-cell-group>
</uni-card>
</block>
</view>
</template>
</uv-cell>
</uv-cell-group>
</uni-card>
<uni-card title="选择支付方式" :border="false" :is-shadow="false">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<block v-for="(item, index) in payment" :key="index">
<uv-cell
:title="`${item.name}`"
:icon="`${item.image}`"
:cellStyle="{ padding: '20rpx 10rpx', borderRadius: '8rpx', backgroundColor: item.type === payType ? '#f6fff1' : '' }"
:border="false"
@click="onPayType(item.type)"
>
{{ item.type }}
<template v-slot:right-icon>
<uv-icon name="checkbox-mark" v-if="item.type === payType"></uv-icon>
</template>
</uv-cell>
</block>
<uv-cell
title="微信支付"
icon="https://oss.wsdns.cn/20240511/8d7af0f0374040cb9b9255eff5fb812d.png?x-oss-process=image/resize,m_fixed,w_100,h_100/quality,Q_90"
:cellStyle="{ padding: '20rpx 10rpx', borderRadius: '8rpx', backgroundColor: 1 === payType ? '#f6fff1' : '' }"
:border="false"
@click="onPayType(1)"
>
微信支付
<template v-slot:right-icon>
<uv-icon name="checkbox-mark" v-if="1 === payType"></uv-icon>
</template>
</uv-cell>
<uv-cell v-if="canPointPay"
: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>
<view slot="actions" class="card-actions">
<view class="card-actions-item" @click="actionsClick('分享')">
<!-- <span class="web-text-danger">已优惠¥0.00</span>-->
<view class="card-actions-item">
<!-- <span class="web-text-danger">已优惠¥0.00</span>-->
<span style="vertical-align:super">¥</span>
<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>
</uni-card>
@@ -102,12 +66,14 @@
<view class="xieyi web-cell web-text-secondary 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/cc887e4a1cd749ebb5a1cfa2484c01f2.png" size="20" v-else @click="onDisabled"></uv-avatar>
<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/cc887e4a1cd749ebb5a1cfa2484c01f2.png" size="20" v-else
@click="onDisabled"></uv-avatar>
<view class="text" @click="onDisabled">
<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>
</view>
@@ -119,14 +85,15 @@
<view class="checkout-car">
<view class="car-total">
<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>
<uv-button
class="save-btn"
:disabled="!disabled || cart.totalPrice === 0"
:customStyle="{ background: 'linear-gradient(to right, #f5a4a4, #ff0000)', borderRadius: '0 30px 30px 0', color: '#ffffff', border: 'none', padding: '22px 30px' }"
text="提交订单"
@click="save"
class="save-btn"
:disabled="!disabled"
:customStyle="{ background: 'linear-gradient(to right, #f5a4a4, #ff0000)', borderRadius: '0 30px 30px 0', color: '#ffffff', border: 'none', padding: '22px 30px' }"
text="提交订单"
@click="save"
></uv-button>
</view>
</view>
@@ -173,16 +140,16 @@
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<block v-for="(item, index) in shopList" :key="index">
<uv-cell :cellStyle="{ padding: '10px 0' }" @click="onShopAddress(item)">
<!-- <template v-slot:icon>-->
<!-- <uv-avatar text="门店" fontSize="12" size="32" randomBgColor></uv-avatar>-->
<!-- </template>-->
<!-- <template v-slot:icon>-->
<!-- <uv-avatar text="门店" fontSize="12" size="32" randomBgColor></uv-avatar>-->
<!-- </template>-->
<template v-slot:title>
<view class="flex flex-col">
<view class="title-bar">
<text class="web-text-heading" style="font-weight: 700">{{ item.merchantName }}</text>
</view>
<view class="title-bar web-text-secondary">
{{ item.address || '良庆镇五象大道401号南宁航洋信和广场1号楼4楼' }}
{{ item.address }}
</view>
</view>
</template>
@@ -205,13 +172,6 @@
<uv-code-input mode="box" dot :space="0" :maxlength="6" hairline v-model="payPassword"
@finish="onPayPassword"></uv-code-input>
</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>
<text @click="navTo(`/package/user/pay-password`)" class="web-text-primary">忘记支付密码?</text>
</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 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 {addThinkGoodsOrder} from "@/api/think/thinkGoodsOrder";
import {getThinkUsers, thinkUserInfo} from "@/api/think/thinkUsers";
const mpStore = useMpStore();
const userStore = useUserStore();
@@ -280,11 +242,12 @@ export default {
isNew: undefined,
selected: undefined,
},
cart: {},
carts: {},
week: 0,
goodsList,
// 订单总金额
totalPrice,
totalPrice: 0,
totalPoint: 0,
reducePrice: 0,
merchantId,
merchantName,
@@ -297,11 +260,14 @@ export default {
// 支付密码是否正确
isPayPasswordCorrect: false,
disabledPayPayPassword: false,
payPassword: ''
payPassword: '',
canPointPay: false,
thinkUserInfo: {},
};
},
onLoad(where) {
this.where = where;
this.getThinkUserInfo()
this.reload();
},
onShow() {
@@ -312,24 +278,30 @@ export default {
this.openLogin();
},
methods: {
async getThinkUserInfo() {
this.thinkUserInfo = await thinkUserInfo()
console.log(this.thinkUserInfo)
},
async reload() {
const app = this;
const {where} = this;
// 当前小程序信息
const info = await mpStore.fetchMpInfo();
// 配置信息
app.config = info.config
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
app.userInfo = userInfo;
// 加载购物车数据
CartApi.listCart(where).then(data => {
if(data){
app.cart = data
console.log(app.cart.shops);
if (data) {
this.totalPoint = 0
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);
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() {
this.disabled = !this.disabled;
@@ -381,19 +335,23 @@ export default {
this.address = item;
this.$refs.userAddressForm.close();
},
onShopAddress(item){
onShopAddress(item) {
this.shopAddress = item;
this.$refs.shopAddressForm.close();
},
// 切换支付方式
onPayType(index) {
if (index === 2 && this.totalPoint > this.thinkUserInfo.integral) return uni.showToast({
title: '积分不足',
icon: 'none'
})
this.payType = index;
},
openAddressList() {
if(this.deliveryType === 0){
if (this.deliveryType === 0) {
this.$refs.userAddressForm.open('center');
}
if(this.deliveryType === 1){
if (this.deliveryType === 1) {
this.$refs.shopAddressForm.open('center');
}
},
@@ -404,7 +362,7 @@ export default {
return false;
}
},
onDeliveryType(index){
onDeliveryType(index) {
this.deliveryType = index
},
// 验证支付密码
@@ -419,18 +377,18 @@ export default {
this.disabledPayPayPassword = true;
const {payPassword} = this;
checkPayPassword({payPassword})
.then((res) => {
this.disabledPayPayPassword = false;
this.isPayPasswordCorrect = true;
this.save();
})
.catch((err) => {
uni.showToast({
title: err.message,
icon: 'none'
});
this.disabledPayPayPassword = false;
.then((res) => {
this.disabledPayPayPassword = false;
this.isPayPasswordCorrect = true;
this.save();
})
.catch((err) => {
uni.showToast({
title: err.message,
icon: 'none'
});
this.disabledPayPayPassword = false;
});
},
openCarInfo(cart) {
if (cart.spec) {
@@ -439,8 +397,6 @@ export default {
},
save() {
const app = this;
const {totalPrice,shops} = this.cart;
console.log(totalPrice)
if (!this.disabled) {
uni.showToast({
@@ -449,139 +405,101 @@ export default {
});
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({
title: '订单提交中.'
});
console.log({
type: 0, // 0商城订单
merchantId: shops[0]?.shopId,
merchantName: shops[0]?.shopName,
totalPrice: totalPrice,
payPrice: totalPrice,
goodsList: shops[0].carts,
comments: shops[0]?.shopName,
// 微信支付
payType: app.payType,
// 下单日期
dateTime: app.dateTime
const infoList = []
this.carts.forEach(item => {
infoList.push({
goodsId: item.goodsId,
title: item.goodsName,
image: item.image,
goodsPrice: item.goods.minPrice,
linePrice: item.goods.linePrice,
integral: item.goods.maxIntegral,
goodsAttr: ''
})
})
Api.addOrder({
type: 0, // 0商城订单
merchantId: shops[0]?.shopId,
merchantName: shops[0]?.shopName,
totalPrice: totalPrice,
payPrice: totalPrice,
goodsList: shops[0].carts,
comments: shops[0]?.shopName,
// 微信支付
addThinkGoodsOrder({
name: '',
phone: '',
address: '',
totalPrice: this.totalPrice,
num: 1,
payPrice: this.totalPrice,
orderStatus: 1,
infoList,
payType: app.payType,
// 下单日期
dateTime: app.dateTime
})
.then((data) => {
const orderInfo = data;
// 调起微信支付
if (app.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/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){
.then((data) => {
const orderInfo = data;
// 调起微信支付
if (app.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;
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();
}
uni.navigateTo({
url: '/package/goods/order'
});
}, 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;
}
}
.delivery{
.delivery {
}
</style>
+95 -153
View File
@@ -1,7 +1,7 @@
<template>
<view class="">
<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>
<uni-card :border="false" :is-shadow="false" :padding="0">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false">
@@ -9,17 +9,17 @@
<template v-slot:title>
<view class="pirce-bar" style="display: flex;">
<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>
</template>
<template v-slot:right-icon>
<text class="web-text-secondary" style="text-decoration: line-through">划线价¥{{ form.price * 2 }}</text>
</template>
<!-- <template v-slot:right-icon>-->
<!-- <text class="web-text-secondary" style="text-decoration: line-through">划线价¥{{ form.price * 2 }}</text>-->
<!-- </template>-->
</uv-cell>
<uv-cell :cellStyle="{padding: '0px 5px 15px 5px'}">
<template v-slot:title>
<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>
</template>
</uv-cell>
@@ -32,49 +32,49 @@
</uv-cell-group>
</uni-card>
<uni-card :border="false" :is-shadow="false" :padding="0">
<uv-cell :cellStyle="{padding: '10px 5px'}" :center="true" @click="openSpecForm">
<template v-slot:title>
<view class="flex" v-if="!skuText">
<view class="web-text-secondary w-15p">可选</view>
<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"
@click="radioClick">
</uv-tags>
</view>
</view>
<view class="flex" v-else>
<view class="web-text-secondary w-15p">已选</view>
<uv-text class="web-text-heading" type="warning" plain :text="skuText" />
</view>
</template>
<template v-slot:value>
<uv-icon name="arrow-right" color="#cccccc"></uv-icon>
</template>
</uv-cell>
<uv-cell :cellStyle="{padding: '10px 5px'}">
<template v-slot:title>
<view class="flex">
<view class="web-text-secondary w-15p">配送</view>
<view class="web-text-heading">啦啦</view>
</view>
</template>
<template v-slot:value>
<uv-icon name="arrow-right" color="#cccccc"></uv-icon>
</template>
</uv-cell>
<uv-cell :border="false" :cellStyle="{padding: '10px 5px'}">
<template v-slot:title>
<view class="flex">
<view class="web-text-secondary w-15p">保障</view>
<view class="web-text-heading value">坏了包赔 假一赔十 七天无理由</view>
</view>
</template>
<template v-slot:value>
<uv-icon name="arrow-right" color="#cccccc"></uv-icon>
</template>
</uv-cell>
</uni-card>
<!-- <uni-card :border="false" :is-shadow="false" :padding="0">-->
<!-- <uv-cell :cellStyle="{padding: '10px 5px'}" :center="true" @click="openSpecForm">-->
<!-- <template v-slot:title>-->
<!-- <view class="flex" v-if="!skuText">-->
<!-- <view class="web-text-secondary w-15p">可选</view>-->
<!-- <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"-->
<!-- @click="radioClick">-->
<!-- </uv-tags>-->
<!-- </view>-->
<!-- </view>-->
<!-- <view class="flex" v-else>-->
<!-- <view class="web-text-secondary w-15p">已选</view>-->
<!-- <uv-text class="web-text-heading" type="warning" plain :text="skuText"/>-->
<!-- </view>-->
<!-- </template>-->
<!-- <template v-slot:value>-->
<!-- <uv-icon name="arrow-right" color="#cccccc"></uv-icon>-->
<!-- </template>-->
<!-- </uv-cell>-->
<!-- <uv-cell :cellStyle="{padding: '10px 5px'}">-->
<!-- <template v-slot:title>-->
<!-- <view class="flex">-->
<!-- <view class="web-text-secondary w-15p">配送</view>-->
<!-- <view class="web-text-heading">啦啦</view>-->
<!-- </view>-->
<!-- </template>-->
<!-- <template v-slot:value>-->
<!-- <uv-icon name="arrow-right" color="#cccccc"></uv-icon>-->
<!-- </template>-->
<!-- </uv-cell>-->
<!-- <uv-cell :border="false" :cellStyle="{padding: '10px 5px'}">-->
<!-- <template v-slot:title>-->
<!-- <view class="flex">-->
<!-- <view class="web-text-secondary w-15p">保障</view>-->
<!-- <view class="web-text-heading value">坏了包赔 假一赔十 七天无理由</view>-->
<!-- </view>-->
<!-- </template>-->
<!-- <template v-slot:value>-->
<!-- <uv-icon name="arrow-right" color="#cccccc"></uv-icon>-->
<!-- </template>-->
<!-- </uv-cell>-->
<!-- </uni-card>-->
<uni-card title="商品详情" :is-shadow="false" :border="false" :padding="0">
<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 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 {getThinkGoods} from "@/api/think/thinkGoods";
const cartStore = useCartStore();
const {
@@ -243,14 +244,17 @@ export default {
type,
isNew,
dateTime,
options: [{
icon: 'server-fill',
text: '客服'
}, {
icon: 'bag',
text: '购物车',
info: 0
}],
options: [
{
icon: 'server-fill',
text: '客服'
},
{
icon: 'bag',
text: '购物车',
info: 0
}
],
buttonGroup: [
{
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() {
return new Promise((resolve, reject) => {
GoodsApi.getGoods(this.id).then(result => {
getThinkGoods(this.id).then(result => {
resolve(result)
}).catch(reject)
})
@@ -353,55 +337,6 @@ export default {
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}) {
console.log(index, content)
// 客服按钮
@@ -418,13 +353,17 @@ export default {
}
// 前往购物车
if (index === 1) {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
uni.navigateTo({url: `/package/cart/index`})
}
},
save({index, content}) {
const app = this
const {form} = this
if (!app.isLogin && !cartStore.isLogin) {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
@@ -435,32 +374,34 @@ export default {
})
return false
}
console.log(index)
// 加入购物车
if (index === 0) {
form.cartNum = 1;
form.isNew = false;
form.price = form.minPrice;
cartStore.isNew = false;
// 单规格
if (form.specs === 0) {
CartApi.addCart(form).then(data => {
app.reload()
uni.showToast({
title: '添加成功',
icon: 'success'
});
}).catch(res => {
uni.showToast({
title: res.message,
icon: 'none'
});
})
return false
}
// if (form.specs === 0) {
CartApi.addCart(form).then(data => {
app.reload()
uni.showToast({
title: '添加成功',
icon: 'success'
});
}).catch(res => {
uni.showToast({
title: res.message,
icon: 'none'
});
})
return false
// }
// 多规格
if (form.specs === 1) {
this.$refs.specForm.open('center');
return false;
}
// if (form.specs === 1) {
// this.$refs.specForm.open('center');
// return false;
// }
return false;
}
// 立即购买
@@ -474,6 +415,7 @@ export default {
this.$refs.specForm.open('center');
return false;
}
form.price = form.minPrice;
CartApi.addCart(form).then(cartId => {
// 跳转页面
uni.navigateTo({
+314 -328
View File
@@ -1,413 +1,399 @@
<template>
<view class="order" v-if="form.orderId">
<uni-card :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :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">
<uv-cell
:cellStyle="{ padding: '0', paddingBottom: '5px' }"
:border="false"
>
<view class="order" v-if="form.id">
<uni-card :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff' }" :border="false">
<!-- <uv-cell :title="`${form.merchantName}`" :label="` `" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" />-->
<block v-for="(item, index) in form.infoList" :key="index">
<uv-cell
:cellStyle="{ padding: '0', paddingBottom: '5px' }"
:border="false"
>
<template v-slot:icon>
<uv-image :src="item.image" width="100" height="100" />
<uv-image :src="item.image" width="100" height="100"/>
</template>
<template v-slot:title>
<view class="goods-info flex flex-col">
<view class="flex">
<uv-text lines="2" bold :text="item.goodsName"></uv-text>
<text>¥{{ item.price }}</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>
<uv-text lines="2" bold :text="item.title"></uv-text>
<text>¥{{ item.goodsPrice }}</text>
</view>
</view>
</template>
</uv-cell>
<uv-cell :label="`成人票 ¥50`" :value="`x ${item.adultNum}`" v-if="item.isChildren" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" />
<uv-cell :label="`儿童票 ¥35`" :value="`x ${item.childrenNum}`" v-if="item.isChildren" :cellStyle="{ padding: '0', paddingBottom: '5px' }" :border="false" />
</block>
</uv-cell-group>
</view>
</view>
<view slot="actions" class="card-actions">
<view class="web-text-heading">合计:¥{{ form.totalPrice }}</view>
<view class="web-text-danger">实付:¥{{ form.payPrice }}</view>
</view>
</uni-card>
<block v-if="form.orderNo">
<uni-card :border="false" :is-shadow="false" :padding="0">
<view class="web-cell web-cell-align-top">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff', padding: '8px 0' }" :border="false">
<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>
</block>
</uv-cell-group>
</view>
</view>
<view slot="actions" class="card-actions">
<view class="web-text-heading">合计:¥{{ form.totalPrice }}</view>
<view class="web-text-danger">实付:¥{{ form.payPrice }}</view>
</view>
</uni-card>
<block v-if="form.orderNo">
<uni-card :border="false" :is-shadow="false" :padding="0">
<view class="web-cell web-cell-align-top">
<uv-cell-group :customStyle="{ backgroundColor: '#ffffff', padding: '8px 0' }" :border="false">
<uv-cell :title="`订单号`" :value="`${form.orderNum}`" :cellStyle="{ padding: '8px' }"/>
<uv-cell :title="`订单状态`" :cellStyle="{ padding: '8px' }">
<template v-slot:value>
<view v-if="form.orderStatus === 2">
<span class="web-text-secondary">已取消</span>
</view>
<view v-else-if="form.payStatus === 0">
<!-- <uv-count-down :time="form.timestamp" format="mm:ss"></uv-count-down> -->
<span style="color: #ff0000">未支付</span>
</view>
<view v-else>{{ orderStatus[form.orderStatus] }}</view>
</template>
</uv-cell>
<uv-cell :title="`下单时间`" :value="`${form.createTime}`" :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-group>
</view>
</uni-card>
</block>
<uv-gap height="20"></uv-gap>
<view class="checkout-car" v-if="form.payStatus === 0 && form.orderStatus !== 2">
<view class="car-total">
<text style="color: #ebcf00">¥</text>
<uv-count-to decimals="2" duration="30" color="#ebcf00" bold :endVal="form.payPrice"></uv-count-to>
</view>
<uv-button
class="save-btn"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '0 30px 30px 0', color: '#ffffff', border: 'none', padding: '22px 30px' }"
text="去支付"
@click="navTo(`/package/booking/confirm?id=${form.orderId}`)"
></uv-button>
</view>
<!-- 登录组件 -->
<ws-login ref="login" @done="reload" />
</view>
<view v-else-if="form.payStatus === 2">
<!-- <uv-count-down :time="form.timestamp" format="mm:ss"></uv-count-down> -->
<span style="color: #ff0000">未支付</span>
</view>
<view v-else>{{ orderStatus[form.orderStatus] }}</view>
</template>
</uv-cell>
<uv-cell :title="`下单时间`" :value="`${form.createTime}`" :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-group>
</view>
</uni-card>
</block>
<uv-gap height="20"></uv-gap>
<view class="checkout-car" v-if="form.payStatus === 0 && form.orderStatus !== 2">
<view class="car-total">
<text style="color: #ebcf00">¥</text>
<uv-count-to decimals="2" duration="30" color="#ebcf00" bold :endVal="form.payPrice"></uv-count-to>
</view>
<uv-button
class="save-btn"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '0 30px 30px 0', color: '#ffffff', border: 'none', padding: '22px 30px' }"
text="去支付"
@click="navTo(`/package/booking/confirm?id=${form.orderId}`)"
></uv-button>
</view>
<!-- 登录组件 -->
<ws-login ref="login" @done="reload"/>
</view>
</template>
<script>
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 UvImage from "@/uni_modules/uv-image/components/uv-image/uv-image.vue";
import {getThinkGoodsOrder} from "@/api/think/thinkGoodsOrder";
export default {
components: {UvImage, UvAvatar},
data() {
return {
isLogin: false,
orderId: 0,
userId: 0,
form: {},
where: {
page: 1
},
canReset: false,
loadMore: 'more',
logo: '',
items: ['全部订单', '未支付', '已支付', '已完成', '押金'],
orderStatus: ['已支付', '已完成', '已取消', '取消中', '退款申请中', '退款被拒绝', '退款成功', '客户端申请退款'],
payType: [
'余额支付',
'微信支付',
'会员卡支付',
'支付宝',
'现金',
'POS机',
'VIP月卡',
'VIP年卡',
'VIP次卡',
'IC月卡',
'IC年卡',
'IC次卡',
'免费',
'VIP充值卡',
'IC充值卡',
'积分支付',
'VIP季卡',
'IC季卡'
],
orderList: [],
styles: [
{
value: 'button',
text: '按钮',
checked: true
},
{
value: 'text',
text: '文字'
}
],
h5_url: '',
colors: ['#333333', '#4cd964', '#dd524d'],
current: 0,
colorIndex: 0,
activeColor: '#108001',
styleType: 'text'
};
},
onLoad(option) {
this.orderId = option.id;
// 判断是否登录
this.openLogin();
// 加载数据
this.reload();
},
onShow() {
// 判断是否登录
this.openLogin();
},
// 触底函数
onReachBottom() {
const app = this;
const { where } = this;
if (app.canReset) {
app.where.page = ++where.page;
app.reload();
}
},
methods: {
reload() {
const app = this;
const { where, userId, orderId } = this;
if (userId == 0) {
app.openLogin();
return;
}
where.userId = userId;
uni.showLoading({
title: '数据读取中.'
});
OrderApi.getOrder(orderId).then((data) => {
console.log('data: ', data);
app.form = data;
components: {UvImage, UvAvatar},
data() {
return {
isLogin: false,
orderId: 0,
userId: 0,
form: {},
where: {
page: 1
},
canReset: false,
loadMore: 'more',
logo: '',
items: ['全部订单', '未支付', '已支付', '已完成', '押金'],
orderStatus: ['已支付', '已完成', '已取消', '取消中', '退款申请中', '退款被拒绝', '退款成功', '客户端申请退款'],
payType: [
'余额支付',
'微信支付',
'会员卡支付',
'支付宝',
'现金',
'POS机',
'VIP月卡',
'VIP年卡',
'VIP次卡',
'IC月卡',
'IC年卡',
'IC次卡',
'免费',
'VIP充值卡',
'IC充值卡',
'积分支付',
'VIP季卡',
'IC季卡'
],
orderList: [],
styles: [
{
value: 'button',
text: '按钮',
checked: true
},
{
value: 'text',
text: '文字'
}
],
h5_url: '',
colors: ['#333333', '#4cd964', '#dd524d'],
current: 0,
colorIndex: 0,
activeColor: '#108001',
styleType: 'text'
};
},
onLoad(option) {
this.orderId = option.id;
// 判断是否登录
this.openLogin();
// 加载数据
this.reload();
},
onShow() {
// 判断是否登录
this.openLogin();
},
// 触底函数
onReachBottom() {
const app = this;
const {where} = this;
if (app.canReset) {
app.where.page = ++where.page;
app.reload();
}
},
methods: {
reload() {
const app = this;
const {where, userId, orderId} = this;
if (userId == 0) {
app.openLogin();
return;
}
uni.showLoading({
title: '数据读取中.'
});
getThinkGoodsOrder(orderId).then((data) => {
app.form = data;
// 页面标题
if (data.orderStatus == 1) {
uni.setNavigationBarTitle({
title: '订单详情(已完成)'
});
}
// 页面标题
if (data.orderStatus == 1) {
uni.setNavigationBarTitle({
title: '订单详情(已完成)'
});
}
uni.hideLoading();
});
uni.hideLoading();
});
// H5版网址
const h5_url = uni.getStorageSync('h5_url');
const tid = uni.getStorageSync('TenantId');
if (h5_url) {
app.h5_url = h5_url;
} else {
app.h5_url = `http://${tid}.h5.wsdns.cn`;
}
},
navTo(url) {
uni.navigateTo({
url
});
},
onClickItem(e) {
const app = this;
const { where, userId } = this;
const index = e.currentIndex;
if (this.current !== e.currentIndex) {
this.current = e.currentIndex;
}
if (userId == 0) {
app.openLogin();
return;
}
// 全部
if (index == 0) {
where.payStatus = undefined;
where.orderStatus = undefined;
}
// 未支付
if (index == 1) {
where.payStatus = 2;
}
// 已支付
if (index == 2) {
where.payStatus = 1;
}
// 已完成
if (index == 3) {
where.orderStatus = 1;
}
// 押金
if (index == 4) {
pageWechatDeposit({
uid: uni.getStorageSync('user_id')
}).then((res) => {
console.log('res: ', res);
app.orderList = res.list;
});
return false;
}
this.reload();
},
// 弹出登录提示框
async openLogin() {
this.userId = uni.getStorageSync('user_id');
if (!this.userId) {
this.$refs.login.open('bottom');
return false;
}
}
}
// H5版网址
const h5_url = uni.getStorageSync('h5_url');
const tid = uni.getStorageSync('TenantId');
if (h5_url) {
app.h5_url = h5_url;
} else {
app.h5_url = `http://${tid}.h5.wsdns.cn`;
}
},
navTo(url) {
uni.navigateTo({
url
});
},
onClickItem(e) {
const app = this;
const {where, userId} = this;
const index = e.currentIndex;
if (this.current !== e.currentIndex) {
this.current = e.currentIndex;
}
if (userId == 0) {
app.openLogin();
return;
}
// 全部
if (index == 0) {
where.payStatus = undefined;
where.orderStatus = undefined;
}
// 未支付
if (index == 1) {
where.payStatus = 2;
}
// 已支付
if (index == 2) {
where.payStatus = 1;
}
// 已完成
if (index == 3) {
where.orderStatus = 1;
}
// 押金
if (index == 4) {
pageWechatDeposit({
uid: uni.getStorageSync('user_id')
}).then((res) => {
console.log('res: ', res);
app.orderList = res.list;
});
return false;
}
this.reload();
},
// 弹出登录提示框
async openLogin() {
this.userId = uni.getStorageSync('user_id');
if (!this.userId) {
this.$refs.login.open('bottom');
return false;
}
}
}
};
</script>
<style lang="scss">
.content {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
height: 150px;
text-align: center;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
height: 150px;
text-align: center;
}
.content-text {
font-size: 14px;
color: #666;
font-size: 14px;
color: #666;
}
.color-tag {
width: 25px;
height: 25px;
width: 25px;
height: 25px;
}
.uni-list {
flex: 1;
flex: 1;
}
.order {
.order-title {
padding: 20rpx 0;
border-bottom: 1px #eee solid;
.order-title {
padding: 20rpx 0;
border-bottom: 1px #eee solid;
.merchant-avatar {
margin-right: 12rpx;
}
.merchant-avatar {
margin-right: 12rpx;
}
.merchant-name {
// padding-left: 12rpx;
}
.merchant-name {
// padding-left: 12rpx;
}
.btn-status {
font-size: 30rpx;
display: flex;
}
}
.btn-status {
font-size: 30rpx;
display: flex;
}
}
.order-body {
padding: 16px 0;
.goods-info{
.order-body {
padding: 16px 0;
.goods-info {
margin-left: 8rpx;
.goods-name{
.goods-name {
font-weight: 500;
}
.goods-desc{
.goods-desc {
color: #808080;
}
}
.goods-image{
.goods-image {
width: 160rpx;
height: 160rpx;
border-radius: 8rpx;
}
}
}
}
.ele-flex {
display: flex;
justify-content: space-between;
display: flex;
justify-content: space-between;
}
.card-actions {
display: flex;
flex-direction: row;
justify-content: space-between;
padding: 0 10px;
align-items: center;
height: 45px;
border-top: 1px #eee solid;
display: flex;
flex-direction: row;
justify-content: space-between;
padding: 0 10px;
align-items: center;
height: 45px;
border-top: 1px #eee solid;
.web-text-heading {
font-size: 30rpx;
font-weight: 500;
}
.web-text-heading {
font-size: 30rpx;
font-weight: 500;
}
.web-text-danger {
font-size: 30rpx;
font-weight: 500;
}
.web-text-danger {
font-size: 30rpx;
font-weight: 500;
}
}
.card-actions-item {
display: flex;
flex-direction: row;
align-items: center;
display: flex;
flex-direction: row;
align-items: center;
}
.card-actions-item-text {
font-size: 12px;
color: #666;
margin-left: 5px;
font-size: 12px;
color: #666;
margin-left: 5px;
}
.btn-status {
font-size: 30rpx;
display: flex;
font-size: 30rpx;
display: flex;
}
.close {
top: 60rpx !important;
top: 60rpx !important;
}
.qrcode {
margin-top: 30rpx;
text-align: center;
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
margin-top: 30rpx;
text-align: center;
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
}
.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;
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-selected {
color: #ccc;
display: flex;
align-items: center;
padding: 0 20rpx;
}
.car-total {
display: flex;
color: #ebcf00;
align-items: center;
padding-left: 40rpx;
.car-total {
display: flex;
color: #ebcf00;
align-items: center;
padding-left: 40rpx;
.save-btn {
}
}
.save-btn {
}
}
}
</style>
+73 -83
View File
@@ -1,7 +1,8 @@
<template>
<view>
<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 class="order">
<block v-if="orderList.length > 0">
@@ -9,45 +10,39 @@
<uni-card :border="false" :is-shadow="false" :padding="0">
<template v-slot:title>
<div class="order-title web-cell">
<view class="web-cell web-cell-content">
<view class="merchant-avatar">
<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 v-if="item.payStatus === 2">
<text class="btn-status web-text-danger">未支付</text>
</block>
<block v-else>
<text v-if="item.payStatus == 1" class="btn-status web-text-success">已支付</text>
<view v-if="item.payStatus == 0" class="btn-status web-text-danger">
<!-- <uv-count-down :time="item.timestamp" format="mm:ss"></uv-count-down>-->
<text class="no-pay" style="margin-left: 10rpx">未支付</text>
<view v-if="item.orderStatus === 1" class="btn-status web-text-success">
<text class="no-pay" style="margin-left: 10rpx">已支付</text>
</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>
</div>
</template>
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content">
<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
:title="`${sub.goodsName}`"
:label="`${sub.comments}`"
:cellStyle="{ padding: '0', paddingBottom: '5px' }"
:border="false"
@click="openUrl(`/package/goods/order-detail?id=${item.orderId}`)"
:title="`${sub.title}`"
:cellStyle="{ padding: '0', paddingBottom: '5px' }"
:border="false"
@click="openUrl(`/package/goods/order-detail?id=${item.id}`)"
>
<template v-slot:icon>
<uv-avatar :src="sub.image" fontSize="12" size="50" shape="square"></uv-avatar>
</template>
<template v-slot:value>
<view class="goods-price-bar">
<view class="goods-price web-text-heading">¥{{sub.price}}</view>
<view class="total-num web-text-secondary" style="font-size: 13px;letter-spacing: 1px;">共{{ item.totalNum }}件</view>
<view class="goods-price web-text-heading">¥{{ sub.goodsPrice }}</view>
</view>
</template>
</uv-cell>
@@ -61,12 +56,15 @@
</view>
<view slot="actions" class="card-actions">
<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" style="background-color: #ff0000; color: #FFFFFF" @click="toPay(item.orderId)">去支付</button>
<button class="mini-btn" size="mini" @click="closeOrder(item)" style="margin-right: 20rpx">取消订单
</button>
<button class="mini-btn" size="mini" style="background-color: #ff0000; color: #FFFFFF"
@click="toPay(item.orderId)">去支付
</button>
</view>
<!-- <view class="card-actions-item" v-if="item.payStatus == 1 && item.isInvoice == 0" @click="onInvoice(item.orderId)">-->
<!-- <button class="mini-btn" size="mini">申请开票</button>-->
<!-- </view>-->
<!-- <view class="card-actions-item" v-if="item.payStatus == 1 && item.isInvoice == 0" @click="onInvoice(item.orderId)">-->
<!-- <button class="mini-btn" size="mini">申请开票</button>-->
<!-- </view>-->
</view>
</uni-card>
</block>
@@ -91,15 +89,16 @@
</block>
<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>
</template>
<script>
import * as OrderApi from '@/api/shop/order';
import { pageWechatDeposit } from '@/api/shop/wechatDeposit';
import { getWeek, getKey } from '@/utils/common';
import {pageWechatDeposit} from '@/api/shop/wechatDeposit';
import {getWeek, getKey} from '@/utils/common';
import {pageThinkGoodsOrder} from "@/api/think/thinkGoodsOrder";
export default {
components: {},
@@ -142,11 +141,6 @@ export default {
onLoad(option) {
// 判断是否登录
this.openLogin();
// 加载数据
// this.reload()
// if(option.isRefresh){
// this.isRefresh = true
// }
},
onShow(e) {
// 判断是否登录
@@ -156,7 +150,7 @@ export default {
// 触底函数
onReachBottom() {
const app = this;
const { where } = this;
const {where} = this;
if (app.canReset) {
app.where.page = ++where.page;
app.reload();
@@ -165,46 +159,41 @@ export default {
methods: {
reload() {
const app = this;
const { where, userId } = this;
const {where, userId} = this;
if (userId === 0) {
app.openLogin();
return;
}
where.userId = userId;
// uni.showLoading({
// title: '数据读取中.'
// })
app.loadMore = 'loading';
OrderApi.pageOrder(where)
.then((res) => {
const list = res.list.map((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;
pageThinkGoodsOrder(where)
.then((res) => {
const list = res.list.map((d) => {
return d;
});
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) {
const app = this;
const { where, userId } = this;
const {where, userId} = this;
const index = e.currentIndex;
if (this.current !== e.currentIndex) {
this.current = e.currentIndex;
@@ -269,20 +258,20 @@ export default {
orderStatus: 2,
orderId: item.orderId
})
.then((msg) => {
uni.showToast({
title: msg,
icon: 'none'
});
item.orderStatus = 2;
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
uni.hideLoading();
.then((msg) => {
uni.showToast({
title: msg,
icon: 'none'
});
item.orderStatus = 2;
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
uni.hideLoading();
});
}
}
});
@@ -401,7 +390,8 @@ export default {
font-size: 30rpx !important;
}
}
.goods-price-bar{
.goods-price-bar {
display: flex;
flex-direction: column;
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>
<view class="order" v-if="form.id">
<view class="qrcode" v-if="form.payStatus === 1 && form.orderStatus === 2">
<uv-image :src="`${IMG_URL}${form.qrcode}`" width="200" height="200"/>
<text class="web-text-secondary">核销码</text>
<!-- <uv-image :src="`${IMG_URL}${form.qrcode}`" width="200" height="200"/>-->
<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>
<uni-card title="预定信息" :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top">
@@ -140,7 +142,9 @@ export default {
current: 0,
colorIndex: 0,
activeColor: '#108001',
styleType: 'text'
styleType: 'text',
countDown: 120,
interval: null
};
},
onLoad(option) {
@@ -176,19 +180,7 @@ export default {
uni.showLoading({
title: '数据读取中.'
});
OrderApi.getThinkOrder(orderId).then((data) => {
app.form = data;
// 页面标题
if (data.orderStatus === 1) {
uni.setNavigationBarTitle({
title: '订单详情(已完成)'
});
}
uni.hideLoading();
});
this.getOrder()
// H5版网址
const h5_url = uni.getStorageSync('h5_url');
const tid = uni.getStorageSync('TenantId');
@@ -211,6 +203,34 @@ export default {
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() {
const orderInfo = await thinkOrderRepay({id: this.orderId})
const _this = this
+132 -267
View File
@@ -1,284 +1,149 @@
<template>
<view class="page">
<!-- 其他功能 -->
<uni-card :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false">
<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'}">
<template v-slot:icon>
<uv-avatar :src="item.image" fontSize="12" size="50" randomBgColor></uv-avatar>
</template>
</uv-cell>
</block>
</uv-cell-group>
</view>
</view>
</uni-card>
<!-- <view class="btn-bar">
<uv-button class="save-user-profile"
:customStyle="{background: 'linear-gradient(to right, #70b915, #008e04)',borderRadius: '30px',color: '#ffffff'}"
text="添加收货地址" @click="add"></uv-button>
</view> -->
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
</view>
<view class="page">
<!-- 其他功能 -->
<uni-card :border="false" :is-shadow="false" :padding="0">
<view class="order-body web-cell web-cell-align-top">
<view class="web-cell-content">
<uv-cell-group :customStyle="{backgroundColor: '#ffffff'}" :border="false">
<block v-for="(item,index) in list" :key="index">
<uv-cell :title="item.name" isLink
:url="`/package/booking/index?id=${item.id}`" :cellStyle="{padding: '10px 0'}">
<template v-slot:icon>
<uv-avatar :src="item.thumb" fontSize="12" size="50" randomBgColor></uv-avatar>
</template>
</uv-cell>
</block>
</uv-cell-group>
</view>
</view>
</uni-card>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
</view>
</template>
<script>
import * as Api from '@/api/shop/userAddress';
import * as MerchantApi from '@/api/shop/merchant';
import regions from '@/api/regions-data.json';
import {
getWxOpenId
} from '@/api/passport/login';
import {
openUrl
} from '@/utils/common';
import {
useUserStore
} from '@/store/modules/user';
import {
useCarStore
} from '@/store/modules/car';
import * as Api from '@/api/shop/userAddress';
import * as MerchantApi from '@/api/shop/merchant';
import regions from '@/api/regions-data.json';
import {
getWxOpenId
} from '@/api/passport/login';
import {
openUrl
} from '@/utils/common';
import {
useUserStore
} from '@/store/modules/user';
import {
useCarStore
} from '@/store/modules/car';
import {listThinkSite} from "@/api/think/thinkSite";
const userStore = useUserStore();
const carStore = useCarStore();
const userStore = useUserStore();
const carStore = useCarStore();
export default {
data() {
return {
sid: '',
list: [],
statusBarHeight: 104,
isLogin: false,
form: {
name: '',
phone: ''
},
// 表单数据
formData: {},
fields: {},
logo: '',
server: [],
order: [],
regions,
rules: {
// 对name字段进行必填验证
name: {
rules: [{
required: true,
errorMessage: '请输入收件人名称',
}]
},
phone: {
rules: [{
required: true,
format: 'number',
errorMessage: '请输入正确的手机号码',
}]
},
address: {
rules: [{
required: true,
errorMessage: '请输入详情地址',
}]
},
region: {
rules: [{
required: true,
errorMessage: '请选择所在地区',
}, {
validateFunction: function(rule, value, data, callback) {
console.log('value: ', value);
if (value.length < 2) {
callback('请至少勾选两个兴趣爱好')
}
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()
})
}
}
}
export default {
data() {
return {
sid: '',
list: [],
statusBarHeight: 104,
isLogin: false,
form: {
name: '',
phone: ''
},
// 表单数据
formData: {},
fields: {},
logo: '',
server: [],
order: [],
regions,
}
},
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
}
this.list = await listThinkSite({ids: this.sid})
},
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;
}
},
}
}
</script>
<style>
page {
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
}
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;
}
.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;
}
.save-user-profile {
width: 700rpx;
margin: 40rpx auto;
}
.add-address {
width: 600rpx !important;
margin: 40rpx auto;
}
.add-address {
width: 600rpx !important;
margin: 40rpx auto;
}
.btn-bar {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
margin: auto;
clear: both;
}
.btn-bar {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
margin: auto;
clear: both;
}
.title-bar {
display: flex;
.title-bar {
display: flex;
.web-text-heading {
margin-right: 20rpx;
}
.web-text-heading {
margin-right: 20rpx;
}
.web-text-secondary {
margin-right: 20rpx;
}
}
.web-text-secondary {
margin-right: 20rpx;
}
}
</style>
+60 -60
View File
@@ -1,76 +1,76 @@
<template>
<view class="page">
<!-- 其他功能 -->
<block v-for="(item, index) in list" :key="index">
<uni-card :border="false" :is-shadow="false" :padding="0">
<uv-cell :title="item.comments" :label="item.createTime" :value="`¥${item.price}`" :cellStyle="{ padding: '10px 0' }" :border="false"></uv-cell>
</uni-card>
</block>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload" />
</view>
<view class="page">
<!-- 其他功能 -->
<uni-card :border="false" :is-shadow="false" :padding="0">
<uv-cell-group>
<uv-cell :title="item.date" v-for="(item, index) in list" :key="index">
<template #value>
<text v-if="item.order" class="text-green">已使用</text>
<text v-else class="text-gray">未使用</text>
</template>
</uv-cell>
</uv-cell-group>
</uni-card>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
</view>
</template>
<script>
import * as Api from '@/api/booking/userCardLog';
import { openUrl } from '@/utils/common';
import { useUserStore } from '@/store/modules/user';
import {openUrl} from '@/utils/common';
import {useUserStore} from '@/store/modules/user';
import {thinkUsersVipLog} from "@/api/think/thinkUsersVip";
const userStore = useUserStore();
export default {
data() {
return {
cardId: 0,
list: [],
isLogin: false,
logo: uni.getStorageSync('app_logo'),
};
},
onLoad(o) {
this.cardId = o.id;
this.reload();
},
methods: {
async reload(e) {
const app = this;
const { cardId } = this;
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) {
app.isLogin = true;
app.userInfo = userInfo;
} else {
app.isLogin = false;
app.$refs.login.open('bottom');
return false;
}
data() {
return {
cardId: 0,
list: [],
isLogin: false,
logo: uni.getStorageSync('app_logo'),
};
},
onLoad(o) {
this.cardId = o.id;
this.reload();
},
methods: {
async reload(e) {
const app = this;
const {cardId} = this;
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) {
app.isLogin = true;
app.userInfo = userInfo;
} else {
app.isLogin = false; v
app.$refs.login.open('bottom');
return false;
}
// 获取会员卡使用记录
Api.pageUserCardLog({cardId}).then((res) => {
app.list = res.list.map(d => {
d.createTime = uni.$uv.date(d.createTime,'yyyy-mm-dd hh:MM:ss')
return d;
});
});
},
navTo(item) {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
openUrl(item);
}
}
// 获取会员卡使用记录
this.list = await thinkUsersVipLog(this.cardId)
},
navTo(item) {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
openUrl(item);
}
}
};
</script>
<style>
page {
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
}
</style>
<style lang="scss">
+359 -495
View File
@@ -1,548 +1,412 @@
<template>
<view class="container">
<!-- deBug信息 -->
<view class="web-debug web-text-success" style="display: none">
场馆ID:{{ merchantId }} 场馆编号:{{ merchantCode }} 场馆名称:{{ merchantName }} 日期:{{ dateTime }} 星期:{{ week }} 订单总金额:{{ totalPrice }} 类型:{{
type
}}
商品信息:{{ goodsList }}
</view>
<view class="card-list">
<view class="container" :style="{ background: `url(${form.image}) no-repeat center center`, backgroundSize: '100%', opacity: '0.85' }">
<view class="content web-cell web-cell-align-top">
<view class="merchant-avatar">
<uv-avatar :src="form.merchantAvatar" size="42" style="border: 3rpx solid #ffffff"></uv-avatar>
</view>
<view class="card-info web-cell-content">
<view class="title-bar">
<view class="web-text-heading" style="color: #ffffff; font-size: 17px; font-weight: 600">{{ form.name }}</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 class="container">
<!-- deBug信息 -->
<view class="web-debug web-text-success">
<view class="card-list">
<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' }">
<view class="content web-cell web-cell-align-top">
<view class="card-info web-cell-content">
<view class="title-bar">
<view class="web-text-heading" style="color: #ffffff; font-size: 17px; font-weight: 600">{{
form.name
}}
</view>
<view class="desc" style="font-size: 14px">{{ cardType[form.type] }}</view>
<view class="mt-20" v-if="form.expireTime">
{{ dayjs(form.expireTime * 1000).format('YYYY-MM-DD HH:mm:ss') }} 过期
</view>
</view>
</template>
</uni-list-item>
</uni-list>
</view>
</uni-card>
<!-- <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>
</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="reload" />
<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>
<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>
<script>
import * as Api from '@/api/booking/userCard';
import * as OrderApi from '@/api/shop/order';
import * as MerchantApi from '@/api/shop/merchant';
import { storeToRefs } from 'pinia';
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卡', '充值卡'];
import {getThinkUsersVip} from "@/api/think/thinkUsersVip";
import dayjs from "dayjs";
const cardType = ['', '年卡', '次卡', '月卡', '会员VIP卡', '充值卡'];
export default {
data() {
return {
id: 0,
goodsId: 0,
userInfo: {},
form: {},
address: {},
addressList: [],
week: 0,
cardType,
goodsList,
// 订单总金额
totalPrice,
reducePrice: 0,
merchantId,
merchantName,
merchantCode,
getWeek,
payType: 1,
isLogin: false,
disabled: false
};
},
onLoad(option) {
this.id = option.cardId;
this.reload();
},
onShow() {
// 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
this.isLogin = true;
}
this.openLogin();
},
methods: {
async reload() {
const app = this;
const { id } = this;
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
app.userInfo = userInfo;
Api.getUserCard(id).then((data) => {
app.form = data;
});
},
onDisabled() {
this.disabled = !this.disabled;
},
navTo(url) {
uni.navigateTo({
url
});
},
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();
});
}
}
data() {
return {
id: 0,
goodsId: 0,
form: {},
address: {},
addressList: [],
week: 0,
cardType,
payType: 1,
isLogin: false,
disabled: false
};
},
onLoad(option) {
this.id = option.cardId;
this.getInfo();
},
onShow() {
// 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
this.isLogin = true;
}
this.openLogin();
},
methods: {
dayjs,
async getInfo() {
this.form = await getThinkUsersVip(this.id)
},
onDisabled() {
this.disabled = !this.disabled;
},
navTo(url) {
uni.navigateTo({
url
});
},
openUrl(url) {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
} else {
uni.navigateTo({
url
});
}
},
openQrCode() {
this.$refs.addForm.open('center');
},
// 弹出登录提示框
openLogin() {
if (!this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
},
}
};
</script>
<style>
page {
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
}
</style>
<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 {
.container {
width: 700rpx;
position: relative;
margin: 25rpx auto;
display: flex;
justify-content: space-between;
align-items: center;
border-radius: 20rpx;
position: relative;
box-shadow: 0 0px 6px 0 rgba(0, 0, 0, 0.2);
// background: linear-gradient(to right, #70b915, #008e04);
color: #ffffff;
.card-num {
position: absolute;
z-index: 1;
bottom: 30rpx;
left: 30rpx;
}
}
.container {
width: 700rpx;
position: relative;
margin: 25rpx auto;
display: flex;
justify-content: space-between;
align-items: center;
border-radius: 20rpx;
position: relative;
box-shadow: 0 0px 6px 0 rgba(0, 0, 0, 0.2);
// background: linear-gradient(to right, #70b915, #008e04);
color: #ffffff;
.container::before {
content: '';
display: block;
position: absolute;
border-radius: 20rpx;
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; /* 设置透明度 */
}
.card-num {
position: absolute;
z-index: 1;
bottom: 30rpx;
left: 30rpx;
}
}
.content {
position: relative;
z-index: 1;
width: 700rpx;
height: 370rpx;
display: flex;
justify-content: space-between;
.merchant-avatar {
margin-top: 30rpx;
margin-left: 30rpx;
}
.card-info {
height: 120rpx;
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;
.container::before {
content: '';
display: block;
position: absolute;
border-radius: 20rpx;
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; /* 设置透明度 */
}
.merchant-avatar {
margin-right: 12rpx;
}
.content {
position: relative;
z-index: 1;
width: 700rpx;
height: 370rpx;
display: flex;
justify-content: space-between;
.card-name {
font-weight: 600;
}
.merchant-avatar {
margin-top: 30rpx;
margin-left: 30rpx;
}
.btn-status {
font-size: 30rpx;
display: flex;
}
}
.card-info {
height: 120rpx;
margin-top: 30rpx;
margin-left: 10rpx;
display: flex;
justify-content: space-between;
align-items: center;
.order-body {
padding: 16px 0;
}
.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 {
margin-right: 12rpx;
}
.card-name {
font-weight: 600;
}
.btn-status {
font-size: 30rpx;
display: flex;
}
}
.order-body {
padding: 16px 0;
}
}
.card-actions {
display: flex;
flex-direction: row;
justify-content: flex-end;
height: 45px;
border-top: 1px #eee solid;
display: flex;
flex-direction: row;
justify-content: flex-end;
height: 45px;
border-top: 1px #eee solid;
}
.card-actions-item {
display: flex;
flex-direction: row;
align-items: center;
display: flex;
flex-direction: row;
align-items: center;
.web-text-heading {
font-size: 38rpx;
margin-left: 28rpx;
}
.web-text-heading {
font-size: 38rpx;
margin-left: 28rpx;
}
}
.card-actions-item-text {
font-size: 12px;
color: #666;
margin-left: 5px;
font-size: 12px;
color: #666;
margin-left: 5px;
}
.address-body {
width: 660rpx;
margin: auto;
width: 660rpx;
margin: auto;
}
.to-pay {
width: 600rpx !important;
margin: 40rpx auto;
display: flex;
justify-content: center;
width: 600rpx !important;
margin: 40rpx auto;
display: flex;
justify-content: center;
}
.btn-bar {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
margin: auto;
clear: both;
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
margin: auto;
clear: both;
}
.title-bar {
display: flex;
display: flex;
.web-text-heading {
margin-right: 20rpx;
}
.web-text-heading {
margin-right: 20rpx;
}
.web-text-secondary {
margin-right: 20rpx;
}
.web-text-secondary {
margin-right: 20rpx;
}
}
.xieyi {
margin-bottom: 80rpx;
padding: 0 30rpx;
margin-bottom: 80rpx;
padding: 0 30rpx;
.text {
margin-left: 5rpx;
.text {
margin-left: 5rpx;
.link {
color: #0f80ff;
}
}
.link {
color: #0f80ff;
}
}
}
.money-bar {
display: flex;
justify-content: space-around;
align-items: center;
.money-item {
text-align: center;
display: flex;
flex-direction: column;
}
.web-divider-vertical {
height: 60rpx;
width: 1rpx;
background-color: #e6e6e6;
}
display: flex;
justify-content: space-around;
align-items: center;
.money-item {
text-align: center;
display: flex;
flex-direction: column;
}
.web-divider-vertical {
height: 60rpx;
width: 1rpx;
background-color: #e6e6e6;
}
}
.qrcode{
width: 600rpx;
height: 600rpx;
margin: 30rpx auto;
line-height: 2rem;
background-color: #ffffff;
text-align: center;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
.qrcode {
width: 600rpx;
height: 600rpx;
margin: 30rpx auto;
line-height: 2rem;
background-color: #ffffff;
text-align: center;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
</style>
+1 -1
View File
@@ -29,7 +29,7 @@
<view class="desc web-text-heading" style="color: #ffffff; font-size: 14px">{{ item.month }}个月</view>
</block> -->
<view v-if="item.type === 2" class="desc web-text-heading" style="color: #ffffff; font-size: 14px">剩余{{
item.number
item.num
}}次
</view>
<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-forms ref="form" :modelValue="formData" :rules="rules" :label-width="80">
<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 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 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>
</uni-card>
@@ -27,31 +33,31 @@
<view class="btn-bar">
<uv-button
class="save-user-profile"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }"
text="立即激活"
@click="submit"
class="save-user-profile"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }"
text="立即激活"
@click="submit"
></uv-button>
</view>
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
<!-- EmergencyEdit弹窗 -->
<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-item label="姓名" prop="userInfo.name" borderBottom>
<uv-input placeholder="请输入姓名" v-model="form.name" maxlength="11"
:customStyle="{ margin: '10px 0' }"></uv-input>
</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"
:customStyle="{ margin: '10px 0' }"></uv-input>
</uv-form-item>
<uv-button
class="add-emergency"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }"
text="保存"
@click="save"
class="add-emergency"
:customStyle="{ background: 'linear-gradient(to right, #70b915, #008e04)', borderRadius: '30px', color: '#ffffff' }"
text="保存"
@click="save"
></uv-button>
</uv-form>
</uni-card>
@@ -68,7 +74,9 @@ import {openUrl} from '@/utils/common';
import {useTenantStore} from '@/store/modules/tenant';
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();
@@ -81,14 +89,14 @@ export default {
statusBarHeight: 104,
isLogin: false,
form: {
name: '',
phone: ''
cardNum: '',
username: '',
phone: '',
},
// 表单数据
formData: {},
fields: {},
logo: '',
bookingUser: {},
server: [],
order: []
};
@@ -97,26 +105,22 @@ export default {
this.reload();
},
methods: {
async getThinkUser() {
const res = await thinkUserInfo();
this.formData.username = res.username;
this.formData.phone = res.phone;
},
async reload(e) {
const app = this;
Api.pageThinkCard({}).then(res => {
console.log(res)
})
// 当前登录用户信息
const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) {
app.isLogin = true;
app.userInfo = userInfo;
await this.getThinkUser()
} else {
app.isLogin = false;
}
// 获取联系人列表
// Api.pageEmergency({
// userId: userInfo.userId
// }).then((res) => {
// app.list = res.list;
// });
},
navTo(item) {
if (!this.isLogin) {
@@ -135,41 +139,43 @@ export default {
add() {
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() {
this.$refs.form.validate().then(res => {
Api.bindCard(this.formData).then(res => {
console.log(res)
}).catch(err => {
this.$refs.form.validate().then(async () => {
const res = await bindCard(this.formData).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
});
})
if (res) {
uni.showToast({
title: '绑定成功',
icon: 'none'
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
}
}).catch(err => {
console.log('表单错误信息:', err);
})
},
scan() {
uni.scanCode({
onlyFromCamera: true,
success: async ({result}) => {
this.formData.cardNum = result
},
fail: (err) => {
uni.showToast({
title: '扫码失败',
icon: 'none'
})
}
});
}
}
};
</script>
+256 -236
View File
@@ -1,268 +1,288 @@
<template>
<view class="page">
<uni-card :border="false" :is-shadow="false" :padding="20">
<uni-forms ref="form" :modelValue="formData" :rules="rules" label-position="top">
<uni-forms-item label="抬头类型" name="isCompany">
<uni-data-checkbox v-model="formData.isCompany" :localdata="type" />
</uni-forms-item>
<block v-if="formData.isCompany == 0">
<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="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>
</block>
<block v-if="formData.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="invoiceCode" required>
<uv-input class="input" v-model="formData.invoiceCode" 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="开户行" name="bankName" required>
<uv-input class="input" v-model="formData.bankName" type="text" placeholder="开户银行名称" />
</uni-forms-item>
<uni-forms-item label="银行账号" name="bankAccount" required>
<uv-input class="input" v-model="formData.bankAccount" type="text" placeholder="开户银行账号" />
</uni-forms-item>
<uni-forms-item label="单位地址" name="address" required>
<uv-input class="input" v-model="formData.address" type="text" placeholder="单位地址" />
</uni-forms-item>
<uni-forms-item label="单位电话" name="tel" required>
<uv-input class="input" v-model="formData.tel" type="text" placeholder="单位电话" />
</uni-forms-item>
<uni-forms-item label="备注" name="comments">
<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>
<view class="page">
<uni-card :border="false" :is-shadow="false" :padding="20">
<uni-forms ref="form" :modelValue="formData" :rules="rules" label-position="top" label-width="200rpx">
<uni-forms-item label="抬头类型" name="isCompany">
<uni-data-checkbox v-model="formData.isCompany" :localdata="type"/>
</uni-forms-item>
<block v-if="formData.isCompany == 0">
<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="invoiceCode" required>
<uv-input class="input" v-model="formData.invoiceCode" type="text" placeholder="税号/身份证号(必填)"/>
</uni-forms-item>
<uni-forms-item label="手机号码">
<uv-input class="input" v-model="formData.phone" type="text" placeholder="手机号码"/>
</uni-forms-item>
<uni-forms-item label="电子邮箱">
<uv-input class="input" v-model="formData.email" type="text" placeholder="电子邮箱"/>
</uni-forms-item>
</block>
<block v-if="formData.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="invoiceCode" required>
<uv-input class="input" v-model="formData.invoiceCode" 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.bankName" type="text" placeholder="开户银行名称"/>
</uni-forms-item>
<uni-forms-item label="银行账号">
<uv-input class="input" v-model="formData.bankAccount" 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 {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';
const tenantStore = useTenantStore();
const userStore = useUserStore();
export default {
data() {
return {
list: [],
statusBarHeight: 104,
isLogin: false,
fields: {},
logo: '',
bookingUser: {},
server: [],
order: [],
// 表单数据
formData: {
type: 0,
invoiceType: 0
},
// 发票类型
type: [
{
text: '个人',
value: 0
},
{
text: '单位',
value: 1
}
],
// 开票类型
invoiceType: [
{
text: '普票',
value: 0
},
{
text: '专票',
value: 1
}
],
rules: {
// 对name字段进行必填验证
name: {
rules: [
{
required: true,
errorMessage: '请输入开票名称'
}
]
},
// 对email字段进行必填验证
email: {
rules: [
{
format: 'email',
errorMessage: '请输入正确的邮箱地址'
}
]
}
}
};
},
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;
}
data() {
return {
list: [],
statusBarHeight: 104,
isLogin: false,
fields: {},
logo: '',
bookingUser: {},
server: [],
order: [],
// 表单数据
formData: {
type: 0,
invoiceType: 0
},
// 发票类型
type: [
{
text: '个人',
value: 0
},
{
text: '单位',
value: 1
}
],
// 开票类型
invoiceType: [
{
text: '普票',
value: 0
},
{
text: '专票',
value: 1
}
],
rules: {
// 对name字段进行必填验证
name: {
rules: [
{
required: true,
errorMessage: '请输入开票名称'
}
]
},
// 对email字段进行必填验证
email: {
rules: [
{
required: true,
format: 'email',
errorMessage: '请输入邮箱地址'
}
]
},
phone: {
rules: [
{
required: true,
errorMessage: '请输入手机号'
}
]
},
invoiceCode: {
rules: [
{
required: true,
errorMessage: '请输入税号'
}
]
}
}
};
},
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({
userId: userInfo.userId,
limit: 1
}).then((res) => {
if (res.count > 0 && !app.formData.id) {
app.formData = res.list[0];
}
});
},
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;
}
},
add() {
this.$refs.addForm.open('center');
},
onDel(item) {
const app = this;
uni.showModal({
title: '确定要删除吗?',
success(o) {
if (o.confirm) {
uni.showLoading({
title: '请求中.'
});
Api.removeUserInvoice(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() {
this.$refs.form
.validate()
.then((res) => {
const saveOrUpdate = this.formData.id ? Api.updateUserInvoice : Api.addUserInvoice;
saveOrUpdate(this.formData)
.then((message) => {
uni.showToast({
title: '保存成功',
icon: 'success'
});
setTimeout(() => {
uni.navigateBack({
delta: 2
})
},1000)
})
.catch((err) => {
console.log(err);
});
console.log('表单数据信息:', res);
})
.catch((err) => {
console.log('表单错误信息:', err);
});
}
}
// 读取最后一次
Api.pageUserInvoice({
userId: userInfo.userId,
limit: 1
}).then((res) => {
if (res.count > 0 && !app.formData.id) {
app.formData = res.list[0];
}
});
},
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;
}
},
add() {
this.$refs.addForm.open('center');
},
onDel(item) {
const app = this;
uni.showModal({
title: '确定要删除吗?',
success(o) {
if (o.confirm) {
uni.showLoading({
title: '请求中.'
});
Api.removeUserInvoice(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() {
this.$refs.form
.validate()
.then((res) => {
const saveOrUpdate = this.formData.id ? Api.updateUserInvoice : Api.addUserInvoice;
saveOrUpdate(this.formData)
.then((message) => {
uni.showToast({
title: '保存成功',
icon: 'success'
});
setTimeout(() => {
uni.navigateBack({
delta: 2
})
}, 1000)
})
.catch((err) => {
console.log(err);
});
console.log('表单数据信息:', res);
})
.catch((err) => {
console.log('表单错误信息:', err);
});
}
}
};
</script>
<style>
page {
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
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;
padding: 20px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 14px;
}
.save-user-profile {
width: 700rpx;
margin: 40rpx auto;
width: 700rpx;
margin: 40rpx auto;
}
.add-emergency {
width: 500rpx !important;
margin: 40rpx auto;
width: 500rpx !important;
margin: 40rpx auto;
}
.btn-bar {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
margin: auto;
clear: both;
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
margin: auto;
clear: both;
}
</style>
+104 -108
View File
@@ -1,14 +1,18 @@
<template>
<view class="container">
<image class="responsive-image" :src="imgUrls" mode="widthFix" @click="onDown(pdfUrl)"></image>
<uv-button @click="onDown(pdfUrl)">复制发票链接</uv-button>
</view>
<view class="container">
<view v-for="(item, index) in list" :key="index">
<image class="responsive-image" :src="item.imgUrls" mode="widthFix"
@click="onDown(item.pdfUrl)"></image>
<uv-button @click="onDown(item.pdfUrl)">复制发票链接</uv-button>
</view>
</view>
</template>
<script>
// import { useUserStore } from '@/store/modules/user';
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';
// const tenantStore = useTenantStore();
@@ -16,117 +20,109 @@ import { copyText, openUrl } from '@/utils/common';
// const userStore = useUserStore();
export default {
data() {
return {
isLogin: false,
logo: '',
imgUrls: '',
pdfUrl: ''
};
},
onLoad(e) {
this.reload(e.id);
},
methods: {
async reload(oid) {
const app = this;
// 当前登录用户信息
// const userInfo = await userStore.fetchUserInfo();
// if (Object.keys(userInfo).length > 0) {
// app.isLogin = true;
// app.userInfo = userInfo;
// } else {
// app.isLogin = false;
// }
data() {
return {
isLogin: false,
logo: '',
list: [],
pdfUrl: ''
};
},
onLoad(e) {
this.reload(e.id);
},
methods: {
async reload(oid) {
const app = this;
// 当前登录用户信息
// const userInfo = await userStore.fetchUserInfo();
// if (Object.keys(userInfo).length > 0) {
// app.isLogin = true;
// app.userInfo = userInfo;
// } else {
// app.isLogin = false;
// }
// 读取最后一次
await Api.pageThinkInvoice({oid}).then((res) => {
if (res) {
const json = JSON.parse(res);
if (json.code) {
const result = json.result;
console.log('json: ', json);
console.log('json: ', json.code);
console.log('result: ', result);
if (result.length > 0) {
app.imgUrls = result[0].imgUrls;
app.pdfUrl = result[0].pdfUrl;
}
}
}
});
},
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;
}
},
onDown(text) {
const app = this;
// 复制发票
uni.setClipboardData({
data: app.pdfUrl,
success: function () {
console.log('success');
},
complete: function (res) {}
});
uni.getClipboardData({
success: function (res) {
},
complete: function (res) {
}
});
// 读取最后一次showInvoice
await Api.pageThinkInvoice({oid}).then(async (res) => {
if (res && res.list && res.list.length > 0) {
const invoiceRes = await showInvoice(res.list[0].id)
this.list = JSON.parse(invoiceRes)
}
});
},
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;
}
},
onDown(data) {
const app = this;
// 复制发票
uni.setClipboardData({
data,
success: function () {
console.log('success');
},
complete: function (res) {
}
});
uni.getClipboardData({
success: function (res) {
},
complete: function (res) {
}
});
},
saveFile(tempFilePath) {
//保存到本地
//文件保存到本地
uni.saveFile({
tempFilePath: tempFilePath, //临时路径
success: function (res) {
uni.showToast({
icon: 'none',
mask: true,
title: '文件已保存:' + res.savedFilePath, //保存路径
duration: 3000
});
setTimeout(() => {
//打开文档查看
uni.openDocument({
filePath: res.savedFilePath,
success: function (res) {
// console.log('打开文档成功');
}
});
}, 3000);
}
});
}
}
},
saveFile(tempFilePath) {
//保存到本地
//文件保存到本地
uni.saveFile({
tempFilePath: tempFilePath, //临时路径
success: function (res) {
uni.showToast({
icon: 'none',
mask: true,
title: '文件已保存:' + res.savedFilePath, //保存路径
duration: 3000
});
setTimeout(() => {
//打开文档查看
uni.openDocument({
filePath: res.savedFilePath,
success: function (res) {
// console.log('打开文档成功');
}
});
}, 3000);
}
});
}
}
};
</script>
<style lang="scss">
.container {
width: 100%; /* 确保容器宽度为100% */
width: 100%; /* 确保容器宽度为100% */
}
.responsive-image {
width: 750rpx; /* 图片宽度自适应容器宽度 */
height: auto; /* 图片高度自适应宽度保持比例 */
display: block; /* 避免图片下方出现空白 */
max-width: 100%; /* 最大宽度不超过父容器宽度 */
/* 可以设置最大高度限制,防止图片过高 */
// max-height: 300px; /* 根据需要设置最大高度 */
margin-bottom: 10px;
width: 750rpx; /* 图片宽度自适应容器宽度 */
height: auto; /* 图片高度自适应宽度保持比例 */
display: block; /* 避免图片下方出现空白 */
max-width: 100%; /* 最大宽度不超过父容器宽度 */
/* 可以设置最大高度限制,防止图片过高 */
// max-height: 300px; /* 根据需要设置最大高度 */
margin-bottom: 10px;
}
</style>
+15 -13
View File
@@ -6,6 +6,7 @@
:cellStyle="{ padding: '5px 0' }"
:border="false"
@click="switchTabTo(`/pages/order`)"
icon="https://oss.wsdns.cn/20241206/eb94f79b4d9049999554e11bc355480e.png"
>
<template v-slot:right-icon>
<uv-icon name="arrow-right"></uv-icon>
@@ -17,25 +18,26 @@
:title="`租赁发票`"
:cellStyle="{ padding: '5px 0' }"
:border="false"
@click="navTo(`/package/user/card`)"
>
<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`)"
@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>-->
<!-- <uv-icon name="arrow-right"></uv-icon>-->
<!-- </template>-->
<!-- </uv-cell>-->
<!-- </uni-card>-->
</view>
</template>
+289 -262
View File
@@ -1,293 +1,320 @@
<template>
<view class="page">
<uni-card :border="false" :is-shadow="false">
<uv-cell
:title="`${formData.name ? formData.name : '请填写开票信息'}`"
:label="`${formData.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>
<block v-if="formData.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="phone" required>
<uv-input class="input" disabled v-model="formData.phone" type="text" placeholder="手机号码" />
</uni-forms-item>
<uni-forms-item label="电子邮箱" name="email" required>
<uv-input class="input" disabled v-model="formData.email" type="text" placeholder="电子邮箱" />
</uni-forms-item>
</block>
<block v-if="formData.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="invoiceCode" required>
<uv-input class="input" v-model="formData.invoiceCode" 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="开户行" name="bankName" required>
<uv-input class="input" v-model="formData.bankName" type="text" placeholder="开户银行名称" />
</uni-forms-item>
<uni-forms-item label="银行账号" name="bankAccount" required>
<uv-input class="input" v-model="formData.bankAccount" type="text" placeholder="开户银行账号" />
</uni-forms-item>
<uni-forms-item label="单位地址" name="address" required>
<uv-input class="input" v-model="formData.address" type="text" placeholder="单位地址" />
</uni-forms-item>
<uni-forms-item label="单位电话" name="tel" required>
<uv-input class="input" v-model="formData.tel" type="text" placeholder="单位电话" />
</uni-forms-item>
<uni-forms-item label="备注" name="comments">
<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>
<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>
<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="手机号码" name="phone">
<uv-input class="input" disabled v-model="formData.phone" type="text" placeholder="手机号码"/>
</uni-forms-item>
<uni-forms-item label="电子邮箱" name="email">
<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="开户行" name="bankName">
<uv-input class="input" v-model="formData.bank" type="text" placeholder="开户银行名称"/>
</uni-forms-item>
<uni-forms-item label="银行账号" name="bankAccount">
<uv-input class="input" v-model="formData.account" type="text" placeholder="开户银行账号"/>
</uni-forms-item>
<uni-forms-item label="单位地址" name="address">
<uv-input class="input" v-model="formData.address" type="text" placeholder="单位地址"/>
</uni-forms-item>
<uni-forms-item label="单位电话" name="tel">
<uv-input class="input" v-model="formData.tel" type="text" placeholder="单位电话"/>
</uni-forms-item>
<uni-forms-item label="备注" name="comments">
<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 * as Api from '@/api/booking/userInvoice';
import { openUrl } from '@/utils/common';
import {useUserStore} from '@/store/modules/user';
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 userStore = useUserStore();
export default {
data() {
return {
orderId: 0,
list: [],
statusBarHeight: 104,
isLogin: false,
fields: {},
logo: '',
bookingUser: {},
server: [],
order: [],
// 表单数据
formData: {
type: 0,
invoiceType: 0
},
// 发票类型
type: [
{
text: '电子',
value: 0
},
{
text: '纸质',
value: 1
}
],
// 开票类型
invoiceType: [
{
text: '普票',
value: 0
},
{
text: '专票',
value: 1
}
],
rules: {
// 对name字段进行必填验证
name: {
rules: [
{
required: true,
errorMessage: '请输入开票名称'
}
]
},
// 对email字段进行必填验证
email: {
rules: [
{
format: 'email',
errorMessage: '请输入正确的邮箱地址'
}
]
}
}
};
},
onLoad(e){
this.orderId = e.id
},
onShow() {
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;
}
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: 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: '请输入正确的邮箱地址'
}
]
}
},
userInvoice: null,
};
},
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({
userId: userInfo.userId,
limit: 1
}).then((res) => {
if (res.count > 0 && !app.formData.id) {
app.formData = res.list[0];
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: '请求中.'
});
Api.removeUserInvoice(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((res) => {
Api.doInvoice(formData)
.then((message) => {
console.log('message: ',message);
uni.showToast({
title: '开票成功',
icon: 'success'
});
setTimeout(() => {
uni.navigateBack()
},1000)
})
.catch((err) => {
console.log(err);
});
console.log('表单数据信息:', res);
})
.catch((err) => {
console.log('表单错误信息:', err);
});
}
}
// 读取最后一次
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 () => {
uni.showLoading({title: '保存中'})
const res = await addThinkInvoice(formData)
uni.hideLoading()
if (res && res.data) {
uni.showLoading({title: '申请开票中'})
await doInvoice(res.data)
uni.hideLoading()
uni.showToast({
title: '开票成功',
icon: 'success'
});
setTimeout(() => {
uni.navigateBack()
}, 1000)
}
})
.catch((err) => {
console.log('表单错误信息:', err);
});
}
}
};
</script>
<style>
page {
background-size: 100%;
background-repeat: no-repeat;
background-color: #f0f2f5;
width: 750rpx;
overflow-x: hidden;
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;
padding: 20px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 14px;
}
.save-user-profile {
width: 700rpx;
margin: 40rpx auto;
width: 700rpx;
margin: 40rpx auto;
}
.add-emergency {
width: 500rpx !important;
margin: 40rpx auto;
width: 500rpx !important;
margin: 40rpx auto;
}
.btn-bar {
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
margin: auto;
clear: both;
width: 700rpx;
left: 25rpx;
position: fixed;
bottom: 30rpx;
margin: auto;
clear: both;
}
</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",
"style": {
"navigationBarTitleText": "我的订单",
"enablePullDownRefresh": false
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
@@ -77,6 +78,13 @@
"enablePullDownRefresh": false
}
},
{
"path": "user/invoiceRent",
"style": {
"navigationBarTitleText": "租赁发票开具",
"enablePullDownRefresh": false
}
},
{
"path": "user/invoice-edit",
"style": {
@@ -182,6 +190,48 @@
"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",
"style": {
@@ -290,6 +340,12 @@
"navigationBarTitleText": "订单详情"
}
},
{
"path": "order/check",
"style": {
"navigationBarTitleText": "订单核销"
}
},
{
"path": "course/index",
"style": {
+87 -57
View File
@@ -34,36 +34,36 @@
</block>
</block>
<!-- <view class="card-title web-text-heading">热门项目</view>-->
<!-- <block v-if="itemList.length > 0">-->
<!-- <view class="item-list">-->
<!-- <uni-grid :column="5" :highlight="true" :showBorder="false" @change="onItem">-->
<!-- <uni-grid-item v-for="(item, index) in itemList" :index="index" :key="index">-->
<!-- <view-->
<!-- class="grid-item-box"-->
<!-- style="-->
<!-- background-color: #ffffff;-->
<!-- margin: 10rpx;-->
<!-- border-radius: 10rpx;-->
<!-- display: flex;-->
<!-- flex-direction: column;-->
<!-- justify-content: center;-->
<!-- align-items: center;-->
<!-- height: 5rem;-->
<!-- "-->
<!-- >-->
<!-- <uv-avatar :src="item.image" :size="27" shape="square" fontSize="16" randomBgColor></uv-avatar>-->
<!-- <text class="text">{{ item.name }}</text>-->
<!-- </view>-->
<!-- </uni-grid-item>-->
<!-- </uni-grid>-->
<!-- </view>-->
<!-- </block>-->
<!-- <block v-else>-->
<!-- <uni-card :border="false" :padding="'12px 4px'">-->
<!-- <uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>-->
<!-- </uni-card>-->
<!-- </block>-->
<!-- <view class="card-title web-text-heading">热门项目</view>-->
<!-- <block v-if="itemList.length > 0">-->
<!-- <view class="item-list">-->
<!-- <uni-grid :column="5" :highlight="true" :showBorder="false" @change="onItem">-->
<!-- <uni-grid-item v-for="(item, index) in itemList" :index="index" :key="index">-->
<!-- <view-->
<!-- class="grid-item-box"-->
<!-- style="-->
<!-- background-color: #ffffff;-->
<!-- margin: 10rpx;-->
<!-- border-radius: 10rpx;-->
<!-- display: flex;-->
<!-- flex-direction: column;-->
<!-- justify-content: center;-->
<!-- align-items: center;-->
<!-- height: 5rem;-->
<!-- "-->
<!-- >-->
<!-- <uv-avatar :src="item.image" :size="27" shape="square" fontSize="16" randomBgColor></uv-avatar>-->
<!-- <text class="text">{{ item.name }}</text>-->
<!-- </view>-->
<!-- </uni-grid-item>-->
<!-- </uni-grid>-->
<!-- </view>-->
<!-- </block>-->
<!-- <block v-else>-->
<!-- <uni-card :border="false" :padding="'12px 4px'">-->
<!-- <uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>-->
<!-- </uni-card>-->
<!-- </block>-->
<!-- 商户列表 -->
<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">
<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>
<text class="merchant-name" style="width: 180rpx">{{ item.name }}</text>
</view>
</uni-grid-item>
</uni-grid>
@@ -95,7 +95,22 @@
<!-- 推荐商品 -->
<!-- <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>
</template>
@@ -111,6 +126,7 @@ import Layout from "@/components/layout.vue";
import * as MenuIcons from '@/api/menu-icons.ts';
import {openUrl} from '@/utils/common';
import {listThinkSite} from "@/api/think/thinkSite";
import {listArticle, pageArticle} from "@/api/cms/article";
const mpStore = useMpStore();
@@ -143,17 +159,40 @@ export default {
hideTools: true,
mp_menu_display_method: 0,
openid: null,
siteList: []
siteList: [],
activity: null,
};
},
onLoad() {
this.reload();
this.openid = uni.getStorageSync('openid');
},
onShow() {
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
this.isLogin = true;
// console.log(this.isLogin)
}
},
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() {
const app = this;
this.getActivity()
// 获取小程序信息包
const info = await mpStore.fetchMpInfo();
// 配置信息
@@ -162,29 +201,6 @@ export default {
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) {
@@ -337,6 +353,20 @@ export default {
const json = JSON.parse(item.images);
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>
+250 -114
View File
@@ -4,12 +4,18 @@
<!-- <uni-segmented-control :current="current" :values="items" :styleType="styleType" :activeColor="activeColor"-->
<!-- inActiveColor="#808080" @clickItem="onClickItem"/>-->
<!-- </view>-->
<uv-sticky>
<view class="flex justify-center items-center p-10">
<uv-sticky title="订单" bg-color="white">
<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">
<uv-icon name="arrow-down" :label="orderTypeStr" label-pos="left"/>
</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"/>
</view>
<view class="flex-1 mx-15 flex justify-center" @click="reset">
@@ -19,92 +25,131 @@
</uv-sticky>
<view class="order">
<block v-if="orderList.length > 0">
<block v-for="(item,index) in orderList" :key="index">
<uni-card :border="false" :is-shadow="false" :padding="0">
<template v-slot:title>
<div class="order-title web-cell">
<view class="web-cell web-cell-content" v-if="orderType === 0">
<text class="merchant-name">{{ item.siteName }}</text>
</view>
<view class="web-cell web-cell-content flex justify-between items-center" v-if="orderType === 1">
<text class="merchant-name">{{ item.siteNames }}</text>
<text class="text-25 text-red" v-if="item.status === 2">待支付</text>
<text class="text-25 text-green" v-else-if="item.status === 1">已支付</text>
<text class="text-25 text-gray" v-else-if="item.status === 3">已退款</text>
<text class="text-25 text-gray" v-else-if="item.status === 0">已取消</text>
</view>
<block v-if="item.orderStatus === 3">
<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 v-else>
<text v-if="item.payStatus === 1" class="btn-status web-text-success">已支付</text>
<view v-if="item.payStatus === 0" class="btn-status web-text-danger">
<uv-count-down :time="item.timestamp" format="mm:ss"></uv-count-down>
<text class="no-pay" style="margin-left: 10rpx;">未支付</text>
<template v-if="orderType === 2">
<view v-for="(item, index) in orderList" class="card m-20" :key="index">
<view class="pb-20 border-bottom flex justify-between items-center text-25">
<text>{{ item.orderNum }}</text>
<text v-if="item.status === 0">未支付</text>
<text v-if="item.status === 1" class="text-red">已支付,未退款</text>
<text v-if="item.status === 2" class="text-green">已退款</text>
</view>
<view class="py-20 border-bottom flex justify-between items-center text-25">
<text>{{ item.siteName }}-{{ item.info }}</text>
<text class="text-red font-bold">¥{{ item.money }}</text>
</view>
<view class="py-20 flex justify-start items-center text-25 text-gray">
<text>{{ dayjs(item.createTime * 1000).format('YYYY-MM-DD HH:mm:ss') }}</text>
</view>
</view>
</template>
<template v-else>
<block v-for="(item,index) in orderList" :key="index">
<uni-card :border="false" :is-shadow="false" :padding="0">
<template v-slot:title>
<div class="order-title web-cell">
<view class="web-cell web-cell-content">
<text class="merchant-name">订单号: {{ item.orderNum }}</text>
</view>
</block>
</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"/>
<view class="web-cell web-cell-content flex justify-between items-center" v-if="orderType === 1">
<text class="merchant-name">{{ item.siteNames }}</text>
<text class="text-25 text-red" v-if="item.status === 2">待支付</text>
<text class="text-25 text-green" v-else-if="item.status === 1">已支付</text>
<text class="text-25 text-gray" v-else-if="item.status === 3">已退款</text>
<text class="text-25 text-gray" v-else-if="item.status === 0">已取消</text>
</view>
<block v-if="item.orderStatus === 3">
<text class="btn-status web-text-secondary">已取消</text>
</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>
<block v-else-if="item.orderStatus === 1">
<text class="btn-status web-text-success">已完成</text>
</block>
<block v-else>
<text v-if="item.payStatus === 1" class="btn-status web-text-success">已支付</text>
<view v-if="item.payStatus === 0" class="btn-status web-text-danger">
<uv-count-down :time="item.timestamp" format="mm:ss"></uv-count-down>
<text class="no-pay" style="margin-left: 10rpx;">未支付</text>
</view>
</block>
</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 slot="actions" class="card-actions">
<template v-if="orderType === 0">
<view class="card-actions-item" v-if="item.payStatus === 2 && item.orderStatus === 2">
<button class="mini-btn" size="mini" @click="closeOrder(item)"
style="margin-right: 20rpx;">取消订单
</button>
<button class="mini-btn" type="primary" size="mini"
@click="openPayOrder(item.id)">立即支付
</button>
</view>
<view class="card-actions-item" v-if="item.payStatus == 1">
<button class="mini-btn" size="mini" v-if="item.isOpen === 2" @click="onInvoice(item.orderId)">
申请开票
</button>
<button class="mini-btn" size="mini" v-else @click="showInvoice(item.id)">查看发票</button>
</view>
</template>
<template v-else-if="orderType === 1">
<view class="card-actions-item" v-if="item.status === 2">
<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.id)">
申请开票
</button>
<button class="mini-btn" size="mini" v-else @click="showInvoice(item.id)">查看发票</button>
</view>
</template>
</view>
</uni-card>
</block>
<view slot="actions" class="card-actions">
<template v-if="orderType === 0">
<view class="card-actions-item" v-if="item.payStatus === 2 && item.orderStatus === 2">
<button class="mini-btn" size="mini" @click="closeOrder(item)"
style="margin-right: 20rpx;">取消订单
</button>
<button class="mini-btn" type="primary" size="mini"
@click="openPayOrder(item.id)">立即支付
</button>
</view>
<view class="card-actions-item" v-if="item.payStatus === 1">
<button class="mini-btn mx-10" size="mini" v-if="item.orderStatus === 4">
退款中
</button>
<button class="mini-btn mx-10" size="mini" v-if="item.orderStatus === 6">
{{ item.payType === 1 ? '退款成功' : '已取消' }}
</button>
<button class="mini-btn mx-10" size="mini"
v-if="item.orderStatus === 2 && item.canRefund"
@click="refund(item, index)" :disabled="item.disabled">
{{ item.payType === 1 ? '申请退款' : '取消订单' }}
</button>
<button class="mini-btn mx-10" size="mini" v-if="item.orderStatus === 2" @click="toDetail(item.id)">
核销码
</button>
<button class="mini-btn mx-10" size="mini" v-if="item.canInvoice" @click="onInvoice(item)">
申请开票
</button>
<button class="mini-btn mx-10" size="mini" v-else-if="item.isInvoice === 1"
@click="showInvoice(item.id)">
查看发票
</button>
</view>
</template>
<template v-else-if="orderType === 1">
<view class="card-actions-item" v-if="item.payStatus === 2">
<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 v-if="orderList.length === 0 && loadMore != 'no-more'">-->
<!-- <uni-card :border="false" :padding="'18px 6px'">-->
@@ -141,24 +186,34 @@
<script>
import * as OrderApi from '@/api/think/thinkOrder'
import {
pageThinkWechatDeposit
} from '@/api/think/thinkWechatDeposit'
import {
getWeek,
getKey
} 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 {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 {
computed: {
dayjs() {
return dayjs
}
},
components: {},
data() {
return {
isRefresh: false,
isLogin: false,
userId: 0,
userInfo: null,
where: {
page: 1
// sceneType: 'showOrderInfo' // 查询订单附加场地信息
@@ -214,6 +269,11 @@ export default {
],
orderStatusStr: '全部状态',
orderStatus: null,
hasMerchantRole: false,
hasMerchantClerkRole: false,
hasSuperAdminRole: false,
orderNo: '',
safeTop: 44,
}
},
// async onLoad(option) {
@@ -225,7 +285,16 @@ export default {
// // }
// },
async onShow(e) {
const sysInfo = uni.getSystemInfoSync()
this.safeTop = sysInfo.statusBarHeight
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()
},
// 触底函数
@@ -273,18 +342,63 @@ export default {
},
async getOrderList() {
let res
if (this.orderType === 0) res = await pageThinkOrder(this.where)
else if (this.orderType === 1) res = await pageThinkUsersVip(this.where)
else if (this.orderType === 2) res = await pageThinkDeposit(this.where)
if (this.orderType === 0) {
if (this.orderNo) {
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) {
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.loadMore = 'no-more'
} else {
this.canReset = false;
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) {
const app = this
@@ -353,26 +467,20 @@ export default {
})
},
closeOrder(item) {
const _this = this
uni.showModal({
title: '确定取消此订单?',
success(o) {
async success(o) {
if (o.confirm) {
OrderApi.updateOrder({
orderStatus: 2,
orderId: item.orderId
}).then(msg => {
uni.showToast({
title: msg,
icon: 'none'
})
item.orderStatus = 2;
}).catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
})
uni.hideLoading()
await updateThinkOrder({
orderStatus: 3,
id: item.id
})
uni.showToast({
title: '取消成功',
icon: 'none'
})
await _this.reload()
}
}
});
@@ -386,10 +494,10 @@ export default {
}
},
// 申请开票
onInvoice(id) {
uni.navigateTo({
url: '/package/user/invoice?id=' + id
})
onInvoice({id, orderNum, payPrice}) {
let url = `/package/user/invoice?id=${id}&orderNum=${orderNum}&itype=${this.orderType + 1}`
url += `&price=${payPrice}`
uni.navigateTo({url})
},
showInvoice(id) {
uni.navigateTo({
@@ -461,7 +569,7 @@ export default {
}
})
},
reset(){
reset() {
this.where = {
page: 1
}
@@ -471,6 +579,34 @@ export default {
this.orderStatus = null
this.orderStatusStr = '全部状态'
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>
<layout class="container" @done="onLayout">
<view>
<!-- 幻灯片广告 -->
<block v-if="shopInfo.files">
<view class="uv-demo-block" style="width: 750rpx; margin: auto">
@@ -9,109 +8,34 @@
radius="0" height="200" @click="onSlide"></uv-swiper>
</view>
</block>
<!-- search-->
<view class="search" style="padding: 0 10rpx; background-color: #FFFFFF">
<uni-search-bar radius="5" placeholder="搜索商品" v-model="keywords" clearButton="auto" cancelButton="none" @confirm="search"/>
<view class="flex flex-wrap justify-start items-start card m-20">
<view v-for="(item, index) in list" :key="index" class="m-15" @click="selectCate(item)">
<uv-icon size="60rpx" :name="item.image" :label="item.catname"
label-pos="bottom" label-size="25rpx" space="8"></uv-icon>
</view>
</view>
<!-- <uv-gap height="8"></uv-gap>-->
<uv-vtabs
:chain="chain"
:list="list"
keyName="title"
: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 class="flex flex-wrap justify-start items-start">
<view class="w-50p" v-for="(item, index) in goodsList" :key="index" @click="navTo(`/package/goods/detail?id=${item.goodsId}`)">
<view class="card m-20">
<uv-image :src="item.image" width="300rpx" height="300rpx"></uv-image>
<view class="mt-20 flex justify-between items-center">
<text class="text-25">{{ item.title }}</text>
</view>
<view class="item"
v-for="(item,index2) in item.goods"
:key="index2">
<view class="flex">
<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>
<text class="text-red text-25 mt-10">¥{{ item.minPrice }}</text>
</view>
</view>
</view>
<!-- 购物车 -->
<view class="cart-icon">
<view class="icon" style="position: relative" @click="navTo(`/package/cart/index`)">
<uv-badge type="error" max="40" :value="cart.totalNums"
style="position: absolute; top: -1px; right: -1px; z-index: 9;"></uv-badge>
<view style="position: absolute; top: -1px; right: -1px; z-index: 9;">
<uv-badge type="error" max="40" :value="cart.length"></uv-badge>
</view>
<uv-icon name="shopping-cart" size="30" color="#0c9d04"></uv-icon>
</view>
</view>
<!-- 支付密码弹窗 -->
<uni-popup ref="specForm" type="center" border-radius="10px 10px 0 0">
<uni-card :title="goods.goodsName" :border="false" :is-shadow="false" :padding="0">
<view class="spec-card" style="width: 660rpx;">
@@ -159,22 +83,20 @@
</uni-popup>
<!-- 登录组件 -->
<ws-login ref="login" @done="reload"/>
</layout>
</view>
</template>
<script>
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 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 {useMpStore} from "@/store/modules/mp";
import UvGap from "@/uni_modules/uv-gap/components/uv-gap/uv-gap.vue";
import * as CartApi from "@/api/shop/cart";
import {ShoppingCartOutlined} from '@ant-design/icons-vue';
const mpStore = useMpStore();
import {listThinkGoodsCategory} from "@/api/think/thinkGoodsCategory";
import {listThinkGoods} from "@/api/think/thinkGoods";
export default {
components: {UvGap, UvButton, UvImage, UvAvatar, Layout, ShoppingCartOutlined},
@@ -184,9 +106,6 @@ export default {
goods: {},
cart: {},
isLogin: false,
// 配置信息
config: {},
mpMenus: [],
list: [],
children: [],
chain: false,
@@ -198,7 +117,9 @@ export default {
// 支付密码是否正确
isPayPasswordCorrect: false,
disabledPayPayPassword: false,
payPassword: ''
payPassword: '',
goodsList: [],
cateId: null
}
},
computed: {
@@ -206,70 +127,53 @@ export default {
return uni.getSystemInfoSync().windowHeight - uni.upx2px(108);
}
},
onLoad() {
async onLoad() {
await this.reload();
this.listCart();
},
onReady() {
// 模拟接口请求数据
uni.showLoading({
title: '加载中'
})
this.reload();
// setTimeout(() => {
// // this.list = getList;
// this.reload()
// }, 500)
await this.getGoodsList();
},
methods: {
async reload() {
const app = this;
// 获取小程序信息包
const info = await mpStore.fetchMpInfo();
// 配置信息
app.config = info.config
// 登录状态
if (uni.getStorageSync('user_id') && uni.getStorageSync('access_token')) {
app.isLogin = true;
this.isLogin = true;
}
// 查询店铺分类
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();
})
this.list = await listThinkGoodsCategory()
// console.log(this.list)
},
listCart() {
CartApi.listCart({type: 0, isNew: false}).then(data => {
CartApi.listCart({type: 0}).then(data => {
if (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) {
console.log('>>>>>url')
if (url === '/package/cart/index' && !this.isLogin) {
this.$refs.login.open('bottom');
return false;
}
uni.navigateTo({url})
},
change(index) {
const app = this
this.children = this.list[index].children;
const parentId = this.list[index].categoryId
listCategoryParentIdTree(parentId).then(children => {
app.children = children;
})
console.log('选项改变:', index)
},
// change(index) {
// const app = this
// this.children = this.list[index].children;
// const parentId = this.list[index].categoryId
// listCategoryParentIdTree(parentId).then(children => {
// app.children = children;
// })
// console.log('选项改变:', index)
// },
openSpecForm(goods) {
if (!this.isLogin) {
this.$refs.login.open('bottom');
@@ -286,6 +190,8 @@ export default {
}
CartApi.addCart({
...item,
goodsName: item.title,
price: item.minPrice,
spec: this.skuText,
cartNum: 1
}).then(() => {
@@ -327,7 +233,7 @@ export default {
onSlide() {
},
search(){
search() {
uni.navigateTo({
url: '/package/goods/index?keywords=' + this.keywords
})
@@ -337,12 +243,6 @@ export default {
uni.navigateTo({
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> -->
<!-- 其他功能 -->
<uni-card :border="false" :padding="0">
<!-- 场馆管理可见-->
<block v-if="hasMerchantRole || hasMerchantClerkRole">
<view class="server" style="min-height: 200px">
<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>
<uni-card :border="false" :padding="0">
<!-- 场馆管理可见-->
<block v-if="hasMerchantRole || hasMerchantClerkRole">
<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 v-else>
<!-- 普通会员菜单 -->
<view class="server" style="min-height: 200px">
<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>
</view>
</block>
<view class="flex justify-between items-center py-20 border-bottom" @click="scan">
<view class="flex justify-start items-center">
<uv-icon name="https://oss.wsdns.cn/20241126/92f728b3b4e146d6a916259bde11a209.png"/>
<text class="text-30 ml-20">扫码核销</text>
</view>
<uv-icon name="arrow-right" size="24rpx"/>
</view>
<!-- <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>
<!-- <view class="server" style="min-height: 200px">-->
<!-- <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>
</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-if="index === '1981'">-->
<!-- <uni-card :title="item[0].groupName" :border="false" :padding="0">-->
<!-- <uv-skeleton rows="1" rowsHeight="30" rowsWidth="100%" :loading="mpMenus.length === 0" :title="false">-->
<!-- <div class="flex space-around py-6 flex-wrap">-->
<!-- <block v-for="(item,index) in item" :key="index">-->
<!-- <div-->
<!-- class="service-item flex flex-col justify-center items-center web-cell-content web-text-center px-20"-->
<!-- @click="navTo(item)">-->
<!-- <uv-avatar :src="item.avatar" :size="24" mode="widthFix"></uv-avatar>-->
<!-- <text style="white-space: nowrap">{{ item.title }}</text>-->
<!-- </div>-->
<!-- </block>-->
<!-- </div>-->
<!-- <w-gap height="5"></w-gap>-->
<!-- </uv-skeleton>-->
<!-- </uni-card>-->
<!-- </block>-->
<!-- <block v-if="index === '1982' && (hasMerchantClerkRole || hasMerchantRole)">-->
<!-- <uni-card :title="item[0].groupName" :border="false" :padding="0">-->
<!-- <uv-skeleton rows="1" rowsHeight="30" rowsWidth="100%" :loading="mpMenus.length === 0" :title="false">-->
<!-- <div class="flex space-around py-6 flex-wrap">-->
<!-- <block v-for="(item,index) in item" :key="index">-->
<!-- <div-->
<!-- class="service-item flex flex-col justify-center items-center web-cell-content web-text-center px-20"-->
<!-- @click="navTo(item)">-->
<!-- <image :src="item.avatar" style="width: 30px; height: 30px;" mode="widthFix"></image>-->
<!-- <text style="white-space: nowrap">{{ item.title }}</text>-->
<!-- </div>-->
<!-- </block>-->
<!-- </div>-->
<!-- <w-gap height="5"></w-gap>-->
<!-- </uv-skeleton>-->
<!-- </uni-card>-->
<!-- </block>-->
<!-- </block>-->
<!-- <block v-for="(item, index) in mpMenus" :key="index">-->
<!-- <block v-if="index === '1981'">-->
<!-- <uni-card :title="item[0].groupName" :border="false" :padding="0">-->
<!-- <uv-skeleton rows="1" rowsHeight="30" rowsWidth="100%" :loading="mpMenus.length === 0" :title="false">-->
<!-- <div class="flex space-around py-6 flex-wrap">-->
<!-- <block v-for="(item,index) in item" :key="index">-->
<!-- <div-->
<!-- class="service-item flex flex-col justify-center items-center web-cell-content web-text-center px-20"-->
<!-- @click="navTo(item)">-->
<!-- <uv-avatar :src="item.avatar" :size="24" mode="widthFix"></uv-avatar>-->
<!-- <text style="white-space: nowrap">{{ item.title }}</text>-->
<!-- </div>-->
<!-- </block>-->
<!-- </div>-->
<!-- <w-gap height="5"></w-gap>-->
<!-- </uv-skeleton>-->
<!-- </uni-card>-->
<!-- </block>-->
<!-- <block v-if="index === '1982' && (hasMerchantClerkRole || hasMerchantRole)">-->
<!-- <uni-card :title="item[0].groupName" :border="false" :padding="0">-->
<!-- <uv-skeleton rows="1" rowsHeight="30" rowsWidth="100%" :loading="mpMenus.length === 0" :title="false">-->
<!-- <div class="flex space-around py-6 flex-wrap">-->
<!-- <block v-for="(item,index) in item" :key="index">-->
<!-- <div-->
<!-- class="service-item flex flex-col justify-center items-center web-cell-content web-text-center px-20"-->
<!-- @click="navTo(item)">-->
<!-- <image :src="item.avatar" style="width: 30px; height: 30px;" mode="widthFix"></image>-->
<!-- <text style="white-space: nowrap">{{ item.title }}</text>-->
<!-- </div>-->
<!-- </block>-->
<!-- </div>-->
<!-- <w-gap height="5"></w-gap>-->
<!-- </uv-skeleton>-->
<!-- </uni-card>-->
<!-- </block>-->
<!-- </block>-->
<!-- <ws-personal :form="users" ref="personal" @done="reload" />-->
<!-- 登录组件 -->
<ws-login ref="login" :logo="logo" @done="reload"/>
@@ -114,7 +177,7 @@
import {useUserStore} from '@/store/modules/user';
import * as MpMenuApi from '@/api/cms/mp-menu';
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 {useMpStore} from "@/store/modules/mp";
import {getWxOpenId, loginByOpenId} from '@/api/passport/login';
@@ -123,6 +186,7 @@ import Layout from "@/components/layout.vue";
import {useTenantStore} from '@/store/modules/tenant';
import {authUser} from "@/api/user";
import UvAvatar from "@/uni_modules/uv-avatar/components/uv-avatar/uv-avatar.vue";
import {getThinkOrderByCode} from "@/api/think/thinkOrder";
const tenantStore = useTenantStore();
const mpStore = useMpStore();
@@ -185,10 +249,10 @@ export default {
app.isLogin = true;
}
// 获取旧系统用户信息
if(uni.getStorageSync('uid')){
if (uni.getStorageSync('uid')) {
await getThinkUsers(uni.getStorageSync('uid')).then(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);
// 更新第三方系统的用户ID
if(!userInfo.uid && uni.getStorageSync('uid')){
if (!userInfo.uid && uni.getStorageSync('uid')) {
await authUser({uid: uni.getStorageSync('uid')}).then(res => {
console.log('更新第三方系统的用户ID')
})
@@ -267,31 +331,21 @@ export default {
}
// 菜单数据
MpMenuApi.pageMpMenu({type: 0, limit: 100})
.then((res) => {
app.order = res.list.filter((d) => d.rows == 0);
app.server = res.list.filter((d) => d.rows == 1);
// console.log('app.hasMerchantRole: ',app.hasMerchantRole);
// console.log('app.hasMerchantClerkRole: ',app.hasMerchantClerkRole);
// console.log('app.hasSuperAdminRole: ',app.hasSuperAdminRole);
if (!app.hasMerchantRole && !app.hasMerchantClerkRole) {
// console.log('11111: ',11111);
app.server = res.list.filter((d) => d.rows == 1 && d.adminShow == 0);
}
app.hideTools = false;
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
app.hideTools = false;
.then((res) => {
app.order = res.list.filter((d) => d.rows == 0);
app.server = res.list.filter((d) => d.rows == 1);
if (!app.hasMerchantRole && !app.hasMerchantClerkRole) {
app.server = res.list.filter((d) => d.rows == 1 && d.adminShow == 0);
}
app.hideTools = false;
})
.catch(() => {
uni.showToast({
title: '请检查您的网络.',
icon: 'none'
});
UserCardApi.pageUserCard({payStatus: 1, userId: uni.getStorageSync('user_id')}).then(res => {
console.log('res8888889: ', res);
app.userInfo.cards = res.count
app.userInfo.coupon = 1;
})
app.hideTools = false;
});
},
navTo(item) {
if (!this.isLogin) {
@@ -312,9 +366,28 @@ export default {
this.$refs.login.open('bottom');
return false;
}
if(text){
if (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;
}
.ml-5{
.ml-5 {
margin-left: 5rpx;
}
.ml-8 {
margin-left: 8rpx;
}
@@ -499,6 +500,7 @@ h6 {
.mt-5 {
margin-top: 5rpx;
}
.mt-6 {
margin-top: 6rpx;
}
@@ -611,6 +613,7 @@ h6 {
.ml-20 {
margin-left: 20rpx;
}
.mr-20 {
margin-right: 20rpx;
}
@@ -854,9 +857,12 @@ h6 {
background: none;
margin: 0;
padding: 0;
font-size: 30rpx;
font-weight: normal;
&::after {
border: none;
font-weight: normal;
}
}
@@ -77,7 +77,7 @@
</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>
</view>
</view>
@@ -133,6 +133,7 @@ export default {
phone: '',
code: ''
},
top: uni.getSystemInfoSync().safeAreaInsets.top
};
},
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 {
SERVER_API_URL,
TENANT_ID
SERVER_API_URL,
TENANT_ID
} from '@/config/setting';
const http = new Request();
@@ -10,56 +10,64 @@ const http = new Request();
* @param {Function}
*/
http.setConfig((config) => {
/* config 为默认全局配置*/
config.baseURL = SERVER_API_URL; /* 根域名 */
/* config 为默认全局配置*/
config.baseURL = SERVER_API_URL; /* 根域名 */
return config
return config
})
// 拦截器(请求之前拦截)
http.interceptors.request.use((config) => { // 可使用async await 做异步操作
const token = uni.getStorageSync('access_token')
config.header = {
...config.header,
TenantId: TENANT_ID
}
if (token) {
config.header.Authorization = token
}
if (config.data) {
config.data.tenantId = TENANT_ID
}
if (!token) {
// 如果token不存在,需要加签
// config.params.tenantId = TENANT_ID
// config.params.sign = getSign(config.params, appSecret);
}
return config
const token = uni.getStorageSync('access_token')
config.header = {
...config.header,
TenantId: TENANT_ID
}
if (token) {
config.header.Authorization = token
}
if (config.data) {
config.data.tenantId = TENANT_ID
}
if (!token) {
// 如果token不存在,需要加签
// config.params.tenantId = TENANT_ID
// config.params.sign = getSign(config.params, appSecret);
}
return config
}, config => { // 可使用async await 做异步操作
return Promise.reject(config)
return Promise.reject(config)
})
// 拦截器(请求之后拦截)
http.interceptors.response.use((response) => {
/* 对响应成功做点什么 可使用async await 做异步操作*/
// if (response.data.code !== 200) { // 服务端返回的状态码不等于200,则reject()
// return Promise.reject(response) // return Promise.reject 可使promise状态进入catch
// if (response.config.custom.verification) { // 演示自定义参数的作用
// return response.data
// }
/* 对响应成功做点什么 可使用async await 做异步操作*/
// if (response.data.code !== 200) { // 服务端返回的状态码不等于200,则reject()
// return Promise.reject(response) // return Promise.reject 可使promise状态进入catch
// if (response.config.custom.verification) { // 演示自定义参数的作用
// return response.data
// }
// token过期
if (response.data.code == 401) {
}
if (response.data.code == 1) {
return Promise.reject(response.data)
}
return response
// token过期
if (response.data.code == 401) {
uni.removeStorageSync('access_token')
uni.removeStorageSync('user_id')
uni.removeStorageSync('phone')
}
if (response.data.code == 1) {
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) => {
/* 对响应错误做点什么 (statusCode !== 200)*/
console.log(response)
return Promise.reject(response)
/* 对响应错误做点什么 (statusCode !== 200)*/
console.log(response)
return Promise.reject(response)
})
export default http