Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 907ba4f9d5 | |||
| 63981c9452 | |||
| 854ea15071 | |||
| c185dcc3be | |||
| e17d36bc88 | |||
| a8d482edb1 | |||
| 735afd564c | |||
| fb2ac1f7c1 | |||
| 23546c7b27 | |||
| 0f2563af2d | |||
| 38eec83e83 | |||
|
|
c9ce807a17 | ||
|
|
3440dc9d8d | ||
|
|
8d37679bac | ||
|
|
bcb058e136 | ||
|
|
7877bdcfe1 | ||
|
|
6f38c95892 | ||
|
|
ef5f3e1fe5 | ||
|
|
9f91ea0c27 | ||
| 7e994f84f0 | |||
| d8738f4e74 | |||
| 3c5d89ab99 | |||
| 4751d695ea | |||
| 27d641e06e | |||
| 3935ec7960 | |||
| 704fee1e2d | |||
|
|
e0aa83c8d1 |
25
commons/utils/debounce.js
Normal file
25
commons/utils/debounce.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @desc 函数防抖
|
||||
* @param func 目标函数
|
||||
* @param wait 延迟执行毫秒数
|
||||
* @param immediate true - 立即执行, false - 延迟执行
|
||||
*/
|
||||
export const debounce = function(func, wait = 1000, immediate = true) {
|
||||
let timer;
|
||||
return function() {
|
||||
let context = this,
|
||||
args = arguments;
|
||||
if (timer) clearTimeout(timer);
|
||||
if (immediate) {
|
||||
let callNow = !timer;
|
||||
timer = setTimeout(() => {
|
||||
timer = null;
|
||||
}, wait);
|
||||
if (callNow) func.apply(context, args);
|
||||
} else {
|
||||
timer = setTimeout(() => {
|
||||
func.apply(context, args);
|
||||
}, wait)
|
||||
}
|
||||
}
|
||||
}
|
||||
29
commons/utils/throttle.js
Normal file
29
commons/utils/throttle.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @desc 函数节流
|
||||
* @param func 函数
|
||||
* @param wait 延迟执行毫秒数
|
||||
* @param type 1 使用表时间戳,在时间段开始的时候触发 2 使用表定时器,在时间段结束的时候触发
|
||||
*/
|
||||
export const throttle = (func, wait = 1000, type = 1) => {
|
||||
let previous = 0;
|
||||
let timeout;
|
||||
return function() {
|
||||
let context = this;
|
||||
let args = arguments;
|
||||
if (type === 1) {
|
||||
let now = Date.now();
|
||||
|
||||
if (now - previous > wait) {
|
||||
func.apply(context, args);
|
||||
previous = now;
|
||||
}
|
||||
} else if (type === 2) {
|
||||
if (!timeout) {
|
||||
timeout = setTimeout(() => {
|
||||
timeout = null;
|
||||
func.apply(context, args)
|
||||
}, wait)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
268
components/my-components/my-popup-table.vue
Normal file
268
components/my-components/my-popup-table.vue
Normal file
@@ -0,0 +1,268 @@
|
||||
<template>
|
||||
<view class="mask u-fixed position-all u-flex u-col-bottom u-font-28" v-if="show" @tap="close">
|
||||
<view class="bg-fff w-full " @tap.stop="nullFunction">
|
||||
<view class="u-p-30">
|
||||
<view class="font-bold u-text-center">选择商品</view>
|
||||
<view class="u-m-t-32 u-flex">
|
||||
<view class=" ">
|
||||
<uni-data-picker :clear-icon="false" :map="{text:'name',value:'id'}" placeholder="请选择分类"
|
||||
popup-title="请选择分类" :localdata="category" v-model="goods.query.categoryId">
|
||||
<view class="u-flex u-font-28" >
|
||||
<text class=" u-line-1"
|
||||
style="max-width: 100rpx;">{{goods.query.categoryId||'分类' }}</text>
|
||||
<up-icon name="arrow-down" size="16"></up-icon>
|
||||
</view>
|
||||
</uni-data-picker>
|
||||
</view>
|
||||
<view class="u-flex-1 u-p-l-16">
|
||||
<up-search @custom="getGoods" v-model="goods.query.name" placeholder="请输入商品名称" @search="getGoods" @clear="getGoods"></up-search>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<scroll-view :scroll-x="false" scroll-y="true" :style="computedStyle()">
|
||||
<view class="u-p-l-30 u-p-r-30 table">
|
||||
<view class="u-flex u-row-between no-wrap title">
|
||||
<view>
|
||||
<my-radio @change="radioAllChange" v-model="goods.allChecked" shape="square"
|
||||
:size="20"></my-radio>
|
||||
</view>
|
||||
<view>商品信息</view>
|
||||
<view>规格</view>
|
||||
<!-- <view>是否售尽</view> -->
|
||||
<!-- <view>是否分销</view> -->
|
||||
<view>售价</view>
|
||||
<view>销量/库存</view>
|
||||
<view>分类名称</view>
|
||||
</view>
|
||||
<view @click="changeChecked(item)" class="u-m-t-12 u-flex u-p-24 u-row-between row" v-for="(item,index) in goods.list" :key="index">
|
||||
<view class="">
|
||||
<my-radio @change="radioChange($event,item)" v-model="item.checked" shape="square" :size="20"></my-radio>
|
||||
</view>
|
||||
<view class="u-text-left u-flex-1 u-p-l-20">
|
||||
<!-- <view class="u-flex">
|
||||
<image lazy-load class="coverImg" :src="item.coverImg" mode=""></image>
|
||||
</view> -->
|
||||
<view class="">{{item.name}}</view>
|
||||
</view>
|
||||
<view class="u-flex-1 u-p-l-4 u-p-r-4 box-size-border">
|
||||
{{item.typeEnum}}
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
¥{{ item.lowPrice }}
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<!-- {{ item.realSalesNumber }}/{{ item.stockNumber }} -->
|
||||
{{ item.stockNumber }}
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
{{item.categoryName}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="u-p-30">
|
||||
<my-pagination :totalElements="goods.totalElements" :size="goods.query.size"
|
||||
@change="pageChange"></my-pagination>
|
||||
<view class="u-m-t-20 u-flex">
|
||||
<view class="u-flex-1 u-p-r-16">
|
||||
<my-button type="cancel" plain @tap="close">取消</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1 u-p-l-16">
|
||||
<my-button @tap="confrim">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
$tbProductList
|
||||
} from '@/http/yskApi/goods.js';
|
||||
import {
|
||||
reactive,
|
||||
onMounted,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
height: {
|
||||
type: [Number, String],
|
||||
default: '50vh'
|
||||
},
|
||||
category: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
}
|
||||
})
|
||||
function changeChecked(item){
|
||||
item.checked=!item.checked
|
||||
if(!item.checked&&$selGoodsMap[item.id]){
|
||||
delete $selGoodsMap[item.id]
|
||||
}else{
|
||||
$selGoodsMap[item.id]=item
|
||||
}
|
||||
goods.allChecked = goods.list.filter(v => v.checked).length != 0
|
||||
}
|
||||
function nullFunction() {
|
||||
|
||||
}
|
||||
|
||||
const show = ref(props.modelValue)
|
||||
|
||||
let selArr=[]
|
||||
|
||||
let $selGoodsMap={}
|
||||
async function open(arr) {
|
||||
show.value = true
|
||||
selArr=arr
|
||||
console.log(arr);
|
||||
for(let i in arr){
|
||||
$selGoodsMap[arr[i].proId
|
||||
]=arr[i]
|
||||
}
|
||||
getGoods()
|
||||
}
|
||||
|
||||
function close() {
|
||||
show.value = false
|
||||
resetQuery()
|
||||
$selGoodsMap={}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function resetQuery() {
|
||||
Object.assign(goods.query, $quey)
|
||||
}
|
||||
|
||||
function computedStyle() {
|
||||
return `height:${typeof props.height==='string'?props.height:props.height+'rpx'};`
|
||||
}
|
||||
|
||||
const emits = defineEmits(['update:modelValue', 'confirm'])
|
||||
|
||||
const $quey = {
|
||||
categoryId: "",
|
||||
createdAt: [],
|
||||
id: "",
|
||||
name: "",
|
||||
sort: "createdAt,desc",
|
||||
type: "",
|
||||
page: 0,
|
||||
size: 10,
|
||||
}
|
||||
const query = reactive({
|
||||
...$quey
|
||||
})
|
||||
const goods = reactive({
|
||||
list: [],
|
||||
allChecked: false,
|
||||
totalElements: 0,
|
||||
query: {
|
||||
...$quey
|
||||
}
|
||||
})
|
||||
getGoods()
|
||||
function getGoods() {
|
||||
const arr=selArr
|
||||
$tbProductList(goods.query).then(res => {
|
||||
let selLen=0;
|
||||
goods.list = res.content.map(v => {
|
||||
const checked=$selGoodsMap[v.id]?true:false
|
||||
selLen+=(checked?1:0)
|
||||
return {
|
||||
...v,
|
||||
checked
|
||||
}
|
||||
})
|
||||
goods.allChecked = selLen==res.content.length?true:false
|
||||
goods.totalElements = res.totalElements
|
||||
})
|
||||
}
|
||||
|
||||
function pageChange(page) {
|
||||
goods.query.page = page - 1
|
||||
getGoods()
|
||||
}
|
||||
|
||||
function radioChange(newval,item) {
|
||||
if(!newval&&$selGoodsMap[item.id]){
|
||||
delete $selGoodsMap[item.id]
|
||||
}else{
|
||||
$selGoodsMap[item.id]=item
|
||||
}
|
||||
goods.allChecked = goods.list.filter(v => v.checked).length != 0
|
||||
}
|
||||
|
||||
function radioAllChange(newval) {
|
||||
goods.list.forEach(i => {
|
||||
i.checked = newval
|
||||
if($selGoodsMap[i.id]&&!newval){
|
||||
delete $selGoodsMap[i.id]
|
||||
}else{
|
||||
$selGoodsMap[i.id]=i
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function confrim() {
|
||||
for(let i in goods.list){
|
||||
const item=goods.list[i]
|
||||
if($selGoodsMap[item.id]&&!item.checked){
|
||||
delete $selGoodsMap[item.id]
|
||||
}
|
||||
}
|
||||
console.log($selGoodsMap);
|
||||
const arr = Object.values($selGoodsMap)
|
||||
emits('confirm', arr)
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
close
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.bg-fff{
|
||||
border-radius: 24rpx 24rpx 0 0 ;
|
||||
}
|
||||
.mask {
|
||||
background: rgba(51, 51, 51, 0.5);
|
||||
z-index: 900;
|
||||
}
|
||||
.box-size-border{
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.coverImg {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.table {
|
||||
background: #F9F9F9;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.title {
|
||||
padding: 12rpx 24rpx 12rpx 24rpx;
|
||||
background: #AEBAD2;
|
||||
border-radius: 8rpx 8rpx 0rpx 0rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.row:nth-of-type(2n+1) {
|
||||
background: #F0F0F0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
8
components/my-components/my-table-col.vue
Normal file
8
components/my-components/my-table-col.vue
Normal file
@@ -0,0 +1,8 @@
|
||||
<template>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
76
components/my-components/my-table.vue
Normal file
76
components/my-components/my-table.vue
Normal file
@@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<view class=" table u-font-28">
|
||||
<view class="u-flex u-row-between no-wrap title">
|
||||
<slot name="title">
|
||||
<view>
|
||||
<my-radio @change="radioAllChange" v-model="allChecked" shape="square" :size="20"></my-radio>
|
||||
</view>
|
||||
<view>商品信息</view>
|
||||
<view>规格</view>
|
||||
<view>售价</view>
|
||||
<view>销量/库存</view>
|
||||
<view>分类名称</view>
|
||||
</slot>
|
||||
</view>
|
||||
<view @click="changeChecked(item)" class="u-m-t-12 u-flex u-p-24 u-row-between row"
|
||||
v-for="(item,index) in list" :key="index">
|
||||
<view class="">
|
||||
<my-radio @change="radioChange($event,item)" v-model="item.checked" shape="square"
|
||||
:size="20"></my-radio>
|
||||
</view>
|
||||
<view class="u-text-left u-flex-1 u-p-l-20">
|
||||
<view class="">{{item.name}}</view>
|
||||
</view>
|
||||
<view class="u-flex-1 u-p-l-4 u-p-r-4 box-size-border">
|
||||
{{item.typeEnum}}
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
¥{{ item.lowPrice }}
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<!-- {{ item.realSalesNumber }}/{{ item.stockNumber }} -->
|
||||
{{ item.stockNumber }}
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
{{item.categoryName}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive, ref
|
||||
} from 'vue';
|
||||
const props=defineProps({
|
||||
list:{
|
||||
type:Array,
|
||||
default:()=>[]
|
||||
}
|
||||
})
|
||||
let allChecked=ref(false)
|
||||
const emits=defineEmits(['selectAllChange'])
|
||||
function radioAllChange(e){
|
||||
emits('selectAllChange')
|
||||
console.log('selectAllChange');
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.table {
|
||||
background: #F9F9F9;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.title {
|
||||
padding: 12rpx 24rpx 12rpx 24rpx;
|
||||
background: #AEBAD2;
|
||||
border-radius: 8rpx 8rpx 0rpx 0rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.row:nth-of-type(2n+1) {
|
||||
background: #F0F0F0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -389,4 +389,27 @@ export function $calcDeDuctionPoints(data) {
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//购物车-临时菜添加
|
||||
export function $temporaryDishes(data) {
|
||||
return request({
|
||||
url: '/api/place/temporaryDishes',
|
||||
method: "post",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
//单品改价
|
||||
export function $updatePrice(data) {
|
||||
return request({
|
||||
url: '/api/place/updatePrice',
|
||||
method: "put",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
113
http/yskApi/credit.js
Normal file
113
http/yskApi/credit.js
Normal file
@@ -0,0 +1,113 @@
|
||||
import http from './http.js'
|
||||
const request=http.request
|
||||
|
||||
|
||||
/**
|
||||
* 获取挂账人列表
|
||||
* @returns
|
||||
*/
|
||||
export function getCreditBuyerList(data) {
|
||||
return request({
|
||||
url: `/api/credit/buyer/page`,
|
||||
method: 'get',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加挂账人
|
||||
* @returns
|
||||
*/
|
||||
export function addCreditBuyer(data) {
|
||||
return request({
|
||||
url: '/api/credit/buyer',
|
||||
method: 'post',
|
||||
params: {
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑挂账人
|
||||
* @returns
|
||||
*/
|
||||
export function editCreditBuyer(data) {
|
||||
return request({
|
||||
url: '/api/credit/buyer',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除挂账人
|
||||
* @returns
|
||||
*/
|
||||
export function delCreditBuyer(id) {
|
||||
return request({
|
||||
url: `/api/credit/buyer/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 还款
|
||||
* @returns
|
||||
*/
|
||||
export function creditRePayment(data) {
|
||||
return request({
|
||||
url: '/api/credit/buyer/repayment',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取还款记录
|
||||
* @returns
|
||||
*/
|
||||
export function creditRePaymentRecord(params) {
|
||||
return request({
|
||||
url: '/api/credit/payment-record/page',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 挂账人-查看明细
|
||||
* @returns
|
||||
*/
|
||||
export function creditBuyerOrderList(params) {
|
||||
return request({
|
||||
url: '/api/credit/buyer-order/page',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 挂账人-查看明细-统计
|
||||
* @returns
|
||||
*/
|
||||
export function creditBuyerOrderSummary(params) {
|
||||
return request({
|
||||
url: '/api/credit/buyer-order/summary',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 挂账人-查看明细-付款
|
||||
* @returns
|
||||
*/
|
||||
export function creditPayment(data) {
|
||||
return request({
|
||||
url: '/api/credit/buyer-order/pay',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
@@ -119,7 +119,10 @@ export const $productSpec=new $API('/api/tbProductSpec',http.req)
|
||||
|
||||
|
||||
// v2 api start
|
||||
|
||||
// 商品列表 后台查询
|
||||
export function $tbProductList(data) {
|
||||
return http.req('/api/tbProduct/list', {...data,shopId:uni.getStorageSync('shopId')}, 'GET')
|
||||
}
|
||||
/* 商品列表 V2 */
|
||||
export function $tbProductV2(data) {
|
||||
return http.req('/api/tbProduct/list/v2', {...data,shopId:uni.getStorageSync('shopId')}, 'post')
|
||||
|
||||
@@ -17,13 +17,13 @@ import infoBox from "@/commons/utils/infoBox.js"
|
||||
import go from '@/commons/utils/go.js';
|
||||
import { reject } from 'lodash';
|
||||
// 测试服
|
||||
// let baseUrl = 'https://admintestpapi.sxczgkj.cn'
|
||||
let baseUrl = 'https://admintestpapi.sxczgkj.cn'
|
||||
|
||||
//预发布
|
||||
// let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
|
||||
|
||||
//正式
|
||||
let baseUrl = 'https://cashieradmin.sxczgkj.cn'
|
||||
// let baseUrl = 'https://cashieradmin.sxczgkj.cn'
|
||||
|
||||
// 王伟本地测
|
||||
// let baseUrl = '/ww'
|
||||
|
||||
@@ -100,7 +100,7 @@ export function updateStatus(data) {
|
||||
// 编辑
|
||||
export function tbPlussShopStaffDetail(id) {
|
||||
return request({
|
||||
url: `/api/tbPlussShopStaff/${id}`,
|
||||
url: `/api/tbPlussShopStaff/` + id,
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<view> 领券后{{ item.validDays }}天过期 </view>
|
||||
</view>
|
||||
<view class="JQclass">
|
||||
<image :src="'/static/coupon/qrcode.svg'" mode="scaleToFill" />
|
||||
<image :src="'/static/coupon/qrcode.svg'" mode="scaleToFill" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="couponContentListcontent2">
|
||||
@@ -81,6 +81,7 @@
|
||||
<view class="bottomPop">
|
||||
<button @click="addCoupon">+添加{{pageData.status.tagName}}</button>
|
||||
</view>
|
||||
<up-modal :show="pageData.delShow" title="确认是否删除当前优惠券" @confirm="delConfirm" @cancel="pageData.delShow=false" showCancelButton></up-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -96,6 +97,8 @@
|
||||
onPullDownRefresh,
|
||||
onReachBottom, } from '@dcloudio/uni-app';
|
||||
const pageData = reactive({
|
||||
delShow: false,
|
||||
delItem: null,
|
||||
status: {
|
||||
list: [
|
||||
{name: '优惠券', type: 1},
|
||||
@@ -175,7 +178,12 @@
|
||||
* 删除
|
||||
*/
|
||||
let delCoupon = (item) => {
|
||||
delTbShopCoupon([item.id]).then((res) => {
|
||||
pageData.delShow = true;
|
||||
pageData.delItem = item;
|
||||
}
|
||||
let delConfirm = () => {
|
||||
pageData.delShow = false;
|
||||
delTbShopCoupon([pageData.delItem.id]).then((res) => {
|
||||
getCoupon();
|
||||
})
|
||||
}
|
||||
|
||||
203
pageCreditBuyer/addDebtor.vue
Normal file
203
pageCreditBuyer/addDebtor.vue
Normal file
@@ -0,0 +1,203 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<up-form
|
||||
labelPosition="top"
|
||||
labelWidth="120"
|
||||
required
|
||||
:model="pageData.formData"
|
||||
:rules="pageData.rules"
|
||||
ref="uFormRef"
|
||||
>
|
||||
<view class="card">
|
||||
|
||||
<up-form-item label="挂账人" prop="debtor" borderBottom="true" >
|
||||
<up-input v-model="pageData.formData.debtor" placeholder="请输入挂账人" border="none" ></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="手机号" prop="mobile" borderBottom="true" >
|
||||
<up-input v-model="pageData.formData.mobile" type="number" maxlength="11" placeholder="请输入手机号" border="none" ></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="职位" prop="position" borderBottom="true" >
|
||||
<up-input v-model="pageData.formData.position" placeholder="请输入职位" border="none" ></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="挂账额度" prop="creditAmount" borderBottom="true" >
|
||||
<up-input v-model="pageData.formData.creditAmount" type="number" placeholder="请输入挂账额度" border="none" ></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="还款方式" borderBottom="true" >
|
||||
<view class="item-column">
|
||||
<up-radio-group v-model="pageData.formData.repaymentMethod" :disabled="pageData.formData.id" placement="row" >
|
||||
<up-radio
|
||||
:customStyle="{marginRight: '30px'}"
|
||||
v-for="(item, index) in pageData.repaymentMethodList"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
:name="item.value"
|
||||
@change="radioChange"
|
||||
></up-radio>
|
||||
</up-radio-group>
|
||||
<view class="tishi">一经创建无法更改还款方式</view>
|
||||
</view>
|
||||
|
||||
</up-form-item>
|
||||
</view>
|
||||
<view class="card">
|
||||
<up-form-item label="是否启用" labelPosition="left">
|
||||
<view style="width: 100%;display: flex;justify-content: flex-end;">
|
||||
<up-switch v-model="pageData.formData.status" @change="change" :activeValue="1" :inactiveValue="0"></up-switch>
|
||||
</view>
|
||||
</up-form-item>
|
||||
|
||||
</view>
|
||||
</up-form>
|
||||
|
||||
<view class="bottomPop">
|
||||
<button class="save" @click="save">保存</button>
|
||||
<view class="cancel" @click="cancel">取消</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import go from '@/commons/utils/go.js'
|
||||
import { debounce } from '@/commons/utils/debounce.js'
|
||||
import { addCreditBuyer, editCreditBuyer } from '@/http/yskApi/credit.js'
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
const pageData = reactive({
|
||||
id: null,
|
||||
title: "",
|
||||
repaymentMethodList: [
|
||||
{ label: '按总金额还款', value: 'total' },
|
||||
{ label: '按订单还款', value: 'order' }
|
||||
],
|
||||
formData: {
|
||||
id: null,
|
||||
status: 0,
|
||||
debtor: '',
|
||||
mobile: '',
|
||||
position: '',
|
||||
creditAmount: '',
|
||||
repaymentMethod: 'total'
|
||||
},
|
||||
rules: {
|
||||
'debtor': {
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请输入挂账人',
|
||||
trigger: ['blur'],
|
||||
},
|
||||
'mobile': {
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请输入手机号',
|
||||
trigger: ['blur'],
|
||||
},
|
||||
'position': {
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请输入职位',
|
||||
trigger: ['blur'],
|
||||
},
|
||||
'creditAmount': {
|
||||
type: 'number',
|
||||
required: true,
|
||||
message: '请输入挂账额度',
|
||||
trigger: ['blur'],
|
||||
},
|
||||
},
|
||||
})
|
||||
// 表单引用
|
||||
const uFormRef = ref(null);
|
||||
|
||||
onLoad((options) => {
|
||||
console.log(options)
|
||||
if ( options.item ) {
|
||||
pageData.formData = JSON.parse(options.item);
|
||||
console.log(pageData.formData)
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
|
||||
let save = debounce(() => {
|
||||
console.log(pageData.formData)
|
||||
uFormRef.value.validate().then(valid => {
|
||||
if (valid) {
|
||||
let params = {
|
||||
...pageData.formData
|
||||
}
|
||||
if (!pageData.formData.id) {
|
||||
addCreditBuyer(params).then((res) => {
|
||||
go.back(1)
|
||||
})
|
||||
} else {
|
||||
editCreditBuyer(params).then((res) => {
|
||||
go.back(1)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}).catch(() => {
|
||||
// 处理验证错误
|
||||
});
|
||||
|
||||
},1000)
|
||||
|
||||
let cancel = ()=>{
|
||||
go.back(1)
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
page{
|
||||
background: #F9F9F9;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss">
|
||||
|
||||
.content {
|
||||
background: #F9F9F9;
|
||||
padding: 32rpx 28rpx 150rpx 28rpx;
|
||||
|
||||
.card{
|
||||
padding: 32rpx 24rpx;
|
||||
background-color: #fff;
|
||||
margin-bottom: 32rpx;
|
||||
.item-column{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.tishi{
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
margin-top: 16rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
.bottomPop{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
>button {
|
||||
width: 530rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
margin: 0 auto;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
font-size: 32rpx;
|
||||
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
||||
}
|
||||
.save{
|
||||
color: #fff;
|
||||
background: #318AFE;
|
||||
}
|
||||
.cancel{
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
BIN
pageCreditBuyer/bg.png
Normal file
BIN
pageCreditBuyer/bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
108
pageCreditBuyer/components/my-action-sheet.vue
Normal file
108
pageCreditBuyer/components/my-action-sheet.vue
Normal file
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<view class="action-sheet" @tap="close" v-if="show">
|
||||
<view class="box">
|
||||
<slot name="title">
|
||||
|
||||
</slot>
|
||||
<view class="item" @tap.stop="itemClick(index)" v-for="(item,index) in props.list" :key="index">
|
||||
<button class="bg-fff btn" hover-class="btn-hover-class" :style="{color:index==0?'red':''}" :class="{'color-main':active==index}">{{item}}</button>
|
||||
</view>
|
||||
<view class="bock-gary"></view>
|
||||
<view class="cancel-btn" @tap="close">
|
||||
<button>取消</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
const props=defineProps({
|
||||
//那个按钮文字高亮
|
||||
active:{
|
||||
type:Number,
|
||||
default:-1
|
||||
},
|
||||
autoClose:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
},
|
||||
title:{
|
||||
type:String,
|
||||
default:'耗材报损'
|
||||
},
|
||||
list:{
|
||||
type:Array,
|
||||
default:['编辑','删除']
|
||||
},
|
||||
show:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
})
|
||||
const emits=defineEmits(['itemClick','close'])
|
||||
let show=ref(false)
|
||||
function open(){
|
||||
show.value=true
|
||||
}
|
||||
function close(){
|
||||
show.value=false
|
||||
emits('close')
|
||||
}
|
||||
function itemClick(index){
|
||||
if(props.autoClose){
|
||||
close()
|
||||
}
|
||||
emits('itemClick',index)
|
||||
}
|
||||
defineExpose({
|
||||
open,close
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
$bg:rgb(240, 240, 240);
|
||||
.action-sheet{
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
top: 0;
|
||||
background-color: rgba(51,51,51,.5);
|
||||
z-index: 999;
|
||||
.box{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
border-radius: 20rpx 20rpx 0rpx 0rpx;
|
||||
overflow: hidden;
|
||||
background-color: #fff;
|
||||
/* #ifndef H5 */
|
||||
padding-bottom: calc(24rpx + constant(safe-area-inset-bottom));
|
||||
padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
|
||||
/* #endif */
|
||||
|
||||
.item{
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
border-bottom: 1px solid $bg;
|
||||
.btn{
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.bock-gary{
|
||||
background-color: $bg;
|
||||
height: 20rpx;
|
||||
}
|
||||
.cancel-btn{
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.btn-hover-class{
|
||||
background-color: rgb(222, 222, 222);
|
||||
}
|
||||
</style>
|
||||
448
pageCreditBuyer/components/my-date-pickerview.vue
Normal file
448
pageCreditBuyer/components/my-date-pickerview.vue
Normal file
@@ -0,0 +1,448 @@
|
||||
<template>
|
||||
<view class="mask" v-if="show" @tap="close">
|
||||
<view class="box" @tap.stop="nullFunction">
|
||||
<view class="u-flex u-relative u-row-center u-p-30 top">
|
||||
<view class="font-bold u-font-32">筛选日期时间</view>
|
||||
<view class="close" @tap="close">
|
||||
<uni-icons type="closeempty" size="24"></uni-icons>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<!-- <view class="u-p-30 u-flex u-flex-wrap gap-20 fastTime">
|
||||
<view class="item" v-for="(item,index) in fastTime" :key="index" @tap="changeTime(item.key)">
|
||||
{{item.title}}
|
||||
</view>
|
||||
</view> -->
|
||||
<picker-view :immediate-change="true" @pickend="pickend" :value="value" @change="bindChange"
|
||||
class="picker-view">
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in years" :key="index">{{item}}年</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in months" :key="index">{{item}}月</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in days" :key="index">{{item}}日</view>
|
||||
</picker-view-column>
|
||||
<!-- <picker-view-column>
|
||||
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in minutes" :key="index">{{item}}分</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
||||
</picker-view-column> -->
|
||||
</picker-view>
|
||||
<view class="u-text-center color-999">至</view>
|
||||
<picker-view :immediate-change="true" :value="value1" @pickend="pickend1" @change="bindChange1"
|
||||
class="picker-view">
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in years" :key="index">{{item}}年</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in months" :key="index">{{item}}月</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in days1" :key="index">{{item}}日</view>
|
||||
</picker-view-column>
|
||||
<!-- <picker-view-column>
|
||||
<view class="item" v-for="(item,index) in hours" :key="index">{{item}}时</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in minutes" :key="index">{{item}}分</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<view class="item" v-for="(item,index) in seconds" :key="index">{{item}}秒</view>
|
||||
</picker-view-column> -->
|
||||
</picker-view>
|
||||
|
||||
<!-- 站位 -->
|
||||
<view style="height: 80px;"></view>
|
||||
<view class="fixed_b">
|
||||
<my-button shape="circle" @tap="confirm">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import myButton from "@/components/my-components/my-button.vue"
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
const $nowDate = new Date()
|
||||
const nowDate = {
|
||||
year: $nowDate.getFullYear(),
|
||||
month: $nowDate.getMonth() + 1,
|
||||
day: $nowDate.getDate(),
|
||||
hours: $nowDate.getHours(),
|
||||
minutes: $nowDate.getMinutes(),
|
||||
seconds: $nowDate.getSeconds()
|
||||
}
|
||||
const yearsLen = 30
|
||||
const years = new Array(yearsLen).fill(1).map((v, index) => {
|
||||
return nowDate.year - index
|
||||
}).reverse()
|
||||
const months = new Array(12).fill(1).map((v, index) => {
|
||||
return index + 1
|
||||
})
|
||||
const days = ref(new Array(getMonthArea($nowDate, 'end').getDate()).fill(1).map((v, index) => {
|
||||
return index + 1
|
||||
}))
|
||||
const days1 = ref(new Array(getMonthArea($nowDate, 'end').getDate()).fill(1).map((v, index) => {
|
||||
return index + 1
|
||||
}))
|
||||
const hours = new Array(24).fill(1).map((v, index) => {
|
||||
return index
|
||||
})
|
||||
const minutes = new Array(60).fill(1).map((v, index) => {
|
||||
return index
|
||||
})
|
||||
const seconds = new Array(60).fill(1).map((v, index) => {
|
||||
return index
|
||||
})
|
||||
const fastTime = reactive([{
|
||||
title: '今日',
|
||||
key: 'now'
|
||||
},
|
||||
{
|
||||
title: '昨日',
|
||||
key: 'prve'
|
||||
},
|
||||
{
|
||||
title: '本月',
|
||||
key: 'nowMonth'
|
||||
},
|
||||
{
|
||||
title: '上月',
|
||||
key: 'prveMonth'
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
|
||||
function setPrveDay() {
|
||||
|
||||
}
|
||||
|
||||
function setNowMoneth() {
|
||||
|
||||
}
|
||||
|
||||
function setprveMoneth() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function setDay(start, end) {
|
||||
value.value = [
|
||||
start.year,
|
||||
start.month,
|
||||
start.day,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
]
|
||||
value1.value = [
|
||||
end.year,
|
||||
end.month,
|
||||
end.day,
|
||||
23,
|
||||
59,
|
||||
59,
|
||||
]
|
||||
}
|
||||
|
||||
function changeTime(key) {
|
||||
const yearIndex = years.findIndex(v => v == nowDate.year)
|
||||
const prveyearIndex = years.findIndex(v => v == nowDate.year) - 1
|
||||
const nowMonthIndex = nowDate.month - 1
|
||||
const nowDayIndex = nowDate.day - 1
|
||||
const dataMap = {
|
||||
now: function() {
|
||||
return {
|
||||
start: {
|
||||
year: yearIndex,
|
||||
month: nowMonthIndex,
|
||||
day: nowDayIndex
|
||||
},
|
||||
end: {
|
||||
year: yearIndex,
|
||||
month: nowMonthIndex,
|
||||
day: nowDayIndex
|
||||
}
|
||||
}
|
||||
},
|
||||
prve: function() {
|
||||
const oneDay=1000*60*60*24
|
||||
const date=new Date(new Date(nowDate.year,nowDate.month,nowDate.day,0,0,0).getTime()-oneDay)
|
||||
return {
|
||||
start: {
|
||||
year:years.findIndex(v=>v==date.getFullYear()),
|
||||
month:date.getMonth()-1<0?11:date.getMonth()-1,
|
||||
day: date.getDate()-1
|
||||
},
|
||||
end: {
|
||||
year:years.findIndex(v=>v==date.getFullYear()),
|
||||
month:date.getMonth()-1<0?11:date.getMonth()-1,
|
||||
day: date.getDate()-1
|
||||
}
|
||||
}
|
||||
},
|
||||
nowMonth: function() {
|
||||
return {
|
||||
start: {
|
||||
year:yearIndex,
|
||||
month:nowMonthIndex,
|
||||
day: 0
|
||||
},
|
||||
end: {
|
||||
year:yearIndex,
|
||||
month:nowMonthIndex,
|
||||
day:new Date(nowDate.year, nowDate.month , 0).getDate() - 1
|
||||
}
|
||||
}
|
||||
},
|
||||
prveMonth: function() {
|
||||
const oneDay=1000*60*60*24
|
||||
const date=new Date(new Date(nowDate.year, nowDate.month-1,0,0,0).getTime()-oneDay)
|
||||
console.log(date.getMonth());
|
||||
return {
|
||||
start: {
|
||||
year:years.findIndex(v=>v==date.getFullYear()),
|
||||
month:date.getMonth(),
|
||||
day: 0
|
||||
},
|
||||
end: {
|
||||
year:years.findIndex(v=>v==date.getFullYear()),
|
||||
month:date.getMonth(),
|
||||
day: date.getDate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const data = dataMap[key]()
|
||||
setDay(data.start, data.end)
|
||||
changeDays(false,value.value)
|
||||
changeDays(true,value1.value)
|
||||
|
||||
console.log(value1.value);
|
||||
const start = returnDateString(value.value)
|
||||
const end = returnDateString(value1.value)
|
||||
|
||||
emits('confirm', {
|
||||
text: `${start}——${end}`,
|
||||
start,
|
||||
end
|
||||
})
|
||||
close()
|
||||
}
|
||||
let value = ref([
|
||||
years.length - 1,
|
||||
nowDate.month - 1,
|
||||
nowDate.day - 1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
])
|
||||
let value1 = ref([
|
||||
years.length - 1,
|
||||
nowDate.month - 1,
|
||||
nowDate.day - 1,
|
||||
23,
|
||||
59,
|
||||
59,
|
||||
])
|
||||
|
||||
let show = ref(false)
|
||||
const emits = defineEmits('close', 'open', 'confirm')
|
||||
|
||||
function toggle() {
|
||||
show.value = !show.value
|
||||
if (show.value) {
|
||||
emits('open', true)
|
||||
} else {
|
||||
emits('close', false)
|
||||
}
|
||||
}
|
||||
|
||||
function close() {
|
||||
show.value = false
|
||||
emits('close', false)
|
||||
}
|
||||
|
||||
function open() {
|
||||
show.value = true
|
||||
emits('open', true)
|
||||
}
|
||||
|
||||
function returnDateString(arr) {
|
||||
const year = years[arr[0]]
|
||||
const month = arr[1] + 1
|
||||
const day = arr[2] + 1
|
||||
const hour = ('0' + arr[3]).slice(-2)
|
||||
const min = ('0' + arr[4]).slice(-2)
|
||||
const sen = ('0' + arr[5]).slice(-2)
|
||||
return `${year}-${month}-${day} ${hour}:${min}:${sen}`
|
||||
}
|
||||
|
||||
|
||||
function confirm(e) {
|
||||
const start = returnDateString(value.value)
|
||||
const end = returnDateString(value1.value)
|
||||
console.log(start);
|
||||
console.log(end);
|
||||
emits('confirm', {
|
||||
text: `${start}——${end}`,
|
||||
start,
|
||||
end
|
||||
})
|
||||
close()
|
||||
}
|
||||
|
||||
function returnMonthStart(arr) {
|
||||
return new Date(years[arr[0]], months[arr[1]] - 1, 1).getDate();
|
||||
}
|
||||
|
||||
function returnMonthEnd(arr) {
|
||||
return new Date(years[arr[0]], months[arr[1]], 0).getDate();
|
||||
}
|
||||
|
||||
function changeDays(isDays1,arr){
|
||||
const end = returnMonthEnd(arr)
|
||||
if (end) {
|
||||
if(isDays1){
|
||||
days1.value= new Array(end).fill(1).map((v,
|
||||
index) => {
|
||||
return index + 1
|
||||
})
|
||||
}else{
|
||||
days.value= new Array(end).fill(1).map((v,
|
||||
index) => {
|
||||
return index + 1
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function bindChange(e) {
|
||||
value.value = e.detail.value
|
||||
changeDays(false, e.detail.value)
|
||||
}
|
||||
|
||||
function bindChange1(e) {
|
||||
value1.value = e.detail.value
|
||||
changeDays(true, e.detail.value)
|
||||
}
|
||||
|
||||
function getDayDate(date = new Date(), type) {
|
||||
const now = date
|
||||
if (type === 'start') {
|
||||
const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||
return startOfDay
|
||||
}
|
||||
if (type === 'end') {
|
||||
const endOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
|
||||
return endOfDay;
|
||||
}
|
||||
}
|
||||
|
||||
function getMonthArea(date = new Date(), type) {
|
||||
let now = date
|
||||
let currentMonthStart = new Date(now.getFullYear(), now.getMonth(), 1);
|
||||
let currentMonthEnd = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
||||
if (type === 'start') {
|
||||
return currentMonthStart
|
||||
}
|
||||
if (type === 'end') {
|
||||
return currentMonthEnd;
|
||||
}
|
||||
return {
|
||||
start: currentMonthStart,
|
||||
end: currentMonthEnd
|
||||
};
|
||||
}
|
||||
|
||||
function nullFunction() {
|
||||
|
||||
}
|
||||
|
||||
function pickend(e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
function pickend1(e) {
|
||||
console.log(e);
|
||||
}
|
||||
defineExpose({
|
||||
close,
|
||||
open,
|
||||
confirm,
|
||||
toggle
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.fastTime {
|
||||
.item {
|
||||
background-color: rgb(247, 247, 247);
|
||||
padding: 6rpx 40rpx;
|
||||
border-radius: 6rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.top {
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
right: 30rpx;
|
||||
}
|
||||
|
||||
.mask {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
top: 0;
|
||||
background-color: rgba(0, 0, 0, .7);
|
||||
|
||||
.box {
|
||||
position: absolute;
|
||||
background-color: #fff;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
border-radius: 16rpx 16rpx 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.fixed_b {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 30rpx;
|
||||
z-index: 100;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.picker-view {
|
||||
width: 750rpx;
|
||||
height: 300rpx;
|
||||
}
|
||||
|
||||
.item {
|
||||
line-height: 34px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
275
pageCreditBuyer/components/my-repayment.vue
Normal file
275
pageCreditBuyer/components/my-repayment.vue
Normal file
@@ -0,0 +1,275 @@
|
||||
<template>
|
||||
<up-popup :show="show" @close="close" round="20" mode="center" customStyle="width: 80%;">
|
||||
<view class="head">
|
||||
<text></text>
|
||||
<text class="title">{{pageData.formData.orderId?'挂账付款':'挂账还款'}}</text>
|
||||
<text></text>
|
||||
</view>
|
||||
<view class="content">
|
||||
<up-form
|
||||
labelPosition="top"
|
||||
labelWidth="120"
|
||||
required
|
||||
:model="pageData.formData"
|
||||
:rules="pageData.rules"
|
||||
ref="uFormRef"
|
||||
:labelStyle="{fontSize: '28rpx',color: '#333',fontWeight: 'bold'}"
|
||||
>
|
||||
<view class="card top" v-if="pageData.formData.repaymentMethod == 'total'">
|
||||
<view>
|
||||
<text class="label">挂账人</text>
|
||||
<text class="value">{{pageData.debtor.debtor}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="label">挂账金额</text>
|
||||
<text class="value">{{pageData.debtor.owedAmount || 0}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="label">账户余额</text>
|
||||
<text class="value">{{pageData.debtor.accountBalance || 0}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card">
|
||||
<up-form-item label="还款方式" labelPosition="left" v-if="pageData.formData.repaymentMethod == 'total'">
|
||||
<view style="width: 100%;display: flex;justify-content: flex-end;">
|
||||
<up-radio-group v-model="pageData.formData.repaymentMethod" placement="row" style="justify-content: flex-end;">
|
||||
<view v-for="(item, index) in pageData.repaymentMethodList" :key="index">
|
||||
<up-radio
|
||||
v-if="pageData.formData.repaymentMethod == item.value"
|
||||
:label="item.label"
|
||||
:name="item.value"
|
||||
></up-radio>
|
||||
</view>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
</up-form-item>
|
||||
<up-form-item label="还款金额(¥)" prop="repaymentAmount">
|
||||
<up-input v-model="pageData.formData.repaymentAmount" type="number" placeholder="请输入金额" customStyle="padding: 0!important;">
|
||||
<template #prefix>
|
||||
<up-button color="#e5e5e5" customStyle="font-size:32rpx;color: #999;width: 124rpx;margin-right: 10rpx;" :hairline="false">¥</up-button>
|
||||
</template>
|
||||
</up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="支付方式" prop="paymentMethod">
|
||||
<up-input v-model="pageData.formData.paymentMethod" placeholder="请输入支付方式"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="备注" prop="remark">
|
||||
<up-input v-model="pageData.formData.remark" placeholder="请输入备注"></up-input>
|
||||
</up-form-item>
|
||||
</view>
|
||||
|
||||
</up-form>
|
||||
<view class="bottomPop">
|
||||
<view class="save" @click="affirm">保存</view>
|
||||
<view class="cancel" @click="close">取消</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive,ref } from 'vue';
|
||||
import { debounce } from '@/commons/utils/debounce.js'
|
||||
import { creditRePayment, creditPayment } from '@/http/yskApi/credit.js'
|
||||
const props=defineProps({
|
||||
show:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
})
|
||||
const emits=defineEmits(['close', "affirm"])
|
||||
const pageData = reactive({
|
||||
id: null,
|
||||
title: "",
|
||||
debtor: {
|
||||
debtor: '',
|
||||
formData: 0,
|
||||
accountBalance: 0,
|
||||
},
|
||||
repaymentMethodList: [
|
||||
{ label: '按总金额还款', value: 'total' },
|
||||
{ label: '按订单还款', value: 'order' }
|
||||
],
|
||||
formData: {
|
||||
id: null,
|
||||
creditBuyerId: null,
|
||||
orderId: null,
|
||||
repaymentMethod: '',
|
||||
repaymentAmount: '',
|
||||
paymentMethod: '',
|
||||
remark: ''
|
||||
},
|
||||
rules: {
|
||||
'repaymentAmount': {
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请输入金额',
|
||||
trigger: ['blur'],
|
||||
},
|
||||
'paymentMethod': {
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请输入支付方式',
|
||||
trigger: ['blur'],
|
||||
},
|
||||
|
||||
},
|
||||
})
|
||||
// 表单引用
|
||||
const uFormRef = ref(null);
|
||||
let show=ref(false)
|
||||
|
||||
function open(options){
|
||||
show.value = true;
|
||||
console.log(options)
|
||||
if (options.creditBuyerId) {
|
||||
pageData.formData.creditBuyerId = options.creditBuyerId;
|
||||
pageData.formData.orderId = options.order.orderId;
|
||||
pageData.formData.repaymentMethod = options.repaymentMethod;
|
||||
|
||||
} else {
|
||||
pageData.formData.id = options.id;
|
||||
pageData.formData.repaymentMethod = options.repaymentMethod;
|
||||
pageData.debtor.debtor = options.debtor;
|
||||
pageData.debtor.owedAmount = options.owedAmount;
|
||||
pageData.debtor.accountBalance = options.accountBalance;
|
||||
}
|
||||
pageData.formData.repaymentAmount = "";
|
||||
pageData.formData.paymentMethod = "";
|
||||
pageData.formData.remark = "";
|
||||
}
|
||||
|
||||
function close(){
|
||||
show.value = false;
|
||||
emits('close')
|
||||
}
|
||||
/**
|
||||
* 确认
|
||||
*/
|
||||
let affirm = debounce(() => {
|
||||
uFormRef.value.validate().then(valid => {
|
||||
if (valid) {
|
||||
console.log(pageData.formData)
|
||||
let params = {
|
||||
...pageData.formData
|
||||
}
|
||||
if ( !pageData.formData.orderId ) {
|
||||
creditRePayment(params).then((res) => {
|
||||
console.log(res.repaymentCount > 0)
|
||||
if (res.repaymentCount > 0) {
|
||||
uni.$u.toast('还款成功')
|
||||
emits('affirm')
|
||||
close();
|
||||
|
||||
} else {
|
||||
uni.$u.toast(res.repaymentMsg)
|
||||
setTimeout(()=>{
|
||||
emits('affirm')
|
||||
close();
|
||||
},2000)
|
||||
}
|
||||
|
||||
})
|
||||
} else {
|
||||
creditPayment(params).then((res) => {
|
||||
if (!res.repaymentMsg) {
|
||||
uni.$u.toast('付款成功')
|
||||
emits('affirm')
|
||||
close();
|
||||
|
||||
} else {
|
||||
uni.$u.toast(res.repaymentMsg)
|
||||
setTimeout(()=>{
|
||||
emits('affirm')
|
||||
close();
|
||||
},2000)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}).catch(() => {
|
||||
// 处理验证错误
|
||||
});
|
||||
|
||||
},1000)
|
||||
defineExpose({
|
||||
open,close,affirm
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.head{
|
||||
display: flex;
|
||||
padding: 32rpx 28rpx;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.title{
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
.content{
|
||||
padding: 0 32rpx 32rpx 32rpx;
|
||||
.card{
|
||||
background-color: #fff;
|
||||
margin-bottom: 42rpx;
|
||||
}
|
||||
.card.top{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
background: #F8F8FA;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 48rpx;
|
||||
padding: 16rpx 0 ;
|
||||
>view{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
.label{
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
.value{
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
.bottomPop{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
>view {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
font-size: 32rpx;
|
||||
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.save{
|
||||
color: #fff;
|
||||
background: #318AFE;
|
||||
}
|
||||
.cancel{
|
||||
font-weight: 400;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
474
pageCreditBuyer/creditDetail.vue
Normal file
474
pageCreditBuyer/creditDetail.vue
Normal file
@@ -0,0 +1,474 @@
|
||||
<template>
|
||||
<view class="credit_search">
|
||||
<view class="time-wrapper">
|
||||
<view v-for="(v, i) in pageData.timeList" :key="i" class="timelistbox">
|
||||
<view class="time-item" @tap="changeTime(v.value)" :class="{ 'time-selected':v.value == pageData.selected }">
|
||||
{{v.label}}
|
||||
</view>
|
||||
<view class="xian" v-if="v.value == pageData.selected "> </view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="search_status" @tap="pageData.showStatus = !pageData.showStatus" >
|
||||
<view class="title">{{pageData.statusTitle}}</view>
|
||||
<view class="select">
|
||||
<text style="margin-right: 12rpx;">筛选</text>
|
||||
<up-icon name="arrow-down-fill" color="#666" :size="14"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view :style="{height:pageData.showStatus?statusHeight:0}" class="tranistion statusList overflow-hide">
|
||||
<view @tap="changeNowStatusIndex(index,item)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between"
|
||||
v-for="(item,index) in pageData.statusList" :key="index">
|
||||
<view :class="{'color-main':pageData.statusIndex===index}">{{item.label}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="content">
|
||||
<view class="statistics">
|
||||
<view class="statistics_cell" v-for="(item,index) in pageData.payCountList" :key="index">
|
||||
<view class="statistics_cell_value"><text style="font-size: 24rpx;">¥</text>{{item.amount}}</view>
|
||||
<view class="statistics_cell_label" v-if="index == 0">{{item.label}}<text style="color: #318AFE;">{{item.count}}</text>笔</view>
|
||||
<text class="statistics_cell_label" v-else>{{item.label}}</text>
|
||||
<text class="statistics_cell_xian" v-if="index < 3"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content_list" v-if="pageData.list.length > 0">
|
||||
<view class="list_cell" v-for="(item,index) in pageData.list" :key="item.id">
|
||||
<view class="amount">
|
||||
<view><view class="payAmount"><text>¥</text>{{item.payAmount || '0'}}</view><text class="amount_label">应付金额</text></view>
|
||||
<view><view class="paidAmount"><text>¥</text>{{item.paidAmount || '0'}}</view><text class="amount_label">已付款金额</text></view>
|
||||
<view><view class="unpaidAmount"><text>¥</text>{{item.unpaidAmount || '0'}}</view><text class="amount_label">待付款金额</text></view>
|
||||
</view>
|
||||
<view class="cell_list">
|
||||
<view><text class="cell_label">创建日期</text><text class="cell_value">{{item.createTime || '-'}}</text></view>
|
||||
<view><text class="cell_label">订单号</text><text class="cell_value">{{item.orderId || '-'}}</text></view>
|
||||
<view><text class="cell_label">备注</text><text class="cell_value">{{item.remark || '-'}}</text></view>
|
||||
<view><text class="cell_label">付款时间</text><text class="cell_value">{{item.lastPaymentTime || '-'}}</text></view>
|
||||
</view>
|
||||
<view class="bottomBox">
|
||||
<view class="btn record" @tap="toUrl('PAGES_CREDIT_BUYER_REPAYMENTRECORD',{id: pageData.query.creditBuyerId, orderId: item.id})">账单付款记录</view>
|
||||
<view class="btn payment" @tap="repaymentOpen(item)" :style="{ backgroundColor: pageData.repaymentMethod == 'total' ? '#999' :''}">付款</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else style="display: flex;flex-direction: column;align-items: center;justify-content: center;margin-top: 300rpx;">
|
||||
<image src="./bg.png" style="width: 325rpx;height: 335rpx;" mode=""></image>
|
||||
<view style="font-size: 28rpx;color: #999;margin-top: 20rpx;">暂无数据</view>
|
||||
</view>
|
||||
</view>
|
||||
<datePickerview @confirm="datePickerConfirm" ref="datePicker"></datePickerview>
|
||||
<my-repayment ref="repayment" @affirm="affirm"></my-repayment>
|
||||
<view class="shade" v-show="pageData.showStatus" @tap="pageData.showStatus=false"></view>
|
||||
</template>
|
||||
<script setup>
|
||||
import go from '@/commons/utils/go.js';
|
||||
import myRepayment from './components/my-repayment';
|
||||
import datePickerview from './components/my-date-pickerview.vue'
|
||||
import dayjs from 'dayjs' //时间格式库
|
||||
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
|
||||
import { creditBuyerOrderList, creditBuyerOrderSummary } from '@/http/yskApi/credit.js'
|
||||
import { reactive, ref, computed, getCurrentInstance } from 'vue';
|
||||
const pageData = reactive({
|
||||
showStatus: false,
|
||||
statusList:[
|
||||
{ label: '全部状态', value: '' },
|
||||
{ label: '未付款', value: 'unpaid' },
|
||||
{ label: '部分支付', value: 'partial' },
|
||||
{ label: '已付款', value: 'paid' }
|
||||
],
|
||||
payCountList: [
|
||||
{ label: '总交易', amount: 0, count: 0 },
|
||||
{ label: '已支付金额', amount: 0 },
|
||||
{ label: '待支付金额', amount: 0 },
|
||||
{ label: '待支付笔数', amount: 0 }
|
||||
],
|
||||
timeList: [
|
||||
{ label: '今天', value: 'today' },
|
||||
{ label: '昨天', value: 'yesterday' },
|
||||
{ label: '本周', value: 'circumference' },
|
||||
{ label: '本月', value: 'moon' },
|
||||
{ label: '自定义', value: 'custom' }
|
||||
],
|
||||
statusIndex: 0,
|
||||
statusTitle: '全部状态',
|
||||
selected: '',
|
||||
query: {
|
||||
page: 1,
|
||||
size: 10,
|
||||
creditBuyerId: null,
|
||||
orderId: null,
|
||||
status: ''
|
||||
},
|
||||
start: "",
|
||||
end: "",
|
||||
repaymentMethod: 'order',
|
||||
list: []
|
||||
})
|
||||
let statusHeight = computed(() => {
|
||||
return 30 * pageData.statusList.length + 40 + 'px'
|
||||
})
|
||||
const currentInstance = getCurrentInstance()
|
||||
let repayment = ref(null)
|
||||
|
||||
onLoad((options) => {
|
||||
if ( options.id ) {
|
||||
pageData.query.creditBuyerId = options.id;
|
||||
}
|
||||
if ( options.repaymentMethod ) {
|
||||
pageData.repaymentMethod = options.repaymentMethod;
|
||||
}
|
||||
|
||||
getList()
|
||||
})
|
||||
// 监听,触底事件。 查询下一页
|
||||
onReachBottom(() => {
|
||||
console.log(pageData.query.page)
|
||||
if( pageData.query.page * pageData.query.size < pageData.totalElements) {
|
||||
pageData.query.page++
|
||||
getList();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 获取还款记录列表
|
||||
*/
|
||||
async function getList() {
|
||||
let beginDate, endDate;
|
||||
if (pageData.selected == 'today') {
|
||||
beginDate = dayjs().format('YYYY-MM-DD') + ' 00:00:00'
|
||||
endDate = dayjs().format('YYYY-MM-DD') + ' 23:59:59'
|
||||
} else if (pageData.selected == 'yesterday') {
|
||||
beginDate = formatTime() + ' 00:00:00'
|
||||
endDate = formatTime() + ' 23:59:59'
|
||||
} else if (pageData.selected == 'circumference') {
|
||||
var now = new Date();
|
||||
var nowTime = now.getTime();
|
||||
var day = now.getDay();
|
||||
var oneDayTime = 24 * 60 * 60 * 1000;
|
||||
//显示周一
|
||||
var MondayTime = nowTime - (day - 1) * oneDayTime;
|
||||
//显示周日
|
||||
var SundayTime = nowTime + (7 - day) * oneDayTime;
|
||||
beginDate = dayjs(MondayTime).format('YYYY-MM-DD 00:00:00')
|
||||
endDate = dayjs(SundayTime).format('YYYY-MM-DD 23:59:59')
|
||||
} else if (pageData.selected == 'moon') {
|
||||
beginDate = dayjs().startOf('month').format('YYYY-MM-DD') + ' 00:00:00'
|
||||
endDate = dayjs().endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
|
||||
} else if (pageData.selected == 'custom') {
|
||||
let s = pageData.start.substring(0, pageData.start.indexOf(' '))
|
||||
let e = pageData.end.substring(0, pageData.end.indexOf(' '))
|
||||
beginDate = s + ' 00:00:00'
|
||||
endDate = e + ' 23:59:59'
|
||||
}
|
||||
|
||||
let params = {
|
||||
creditBuyerId: pageData.query.creditBuyerId,
|
||||
status: pageData.query.status,
|
||||
size: pageData.query.size,
|
||||
page: pageData.query.page
|
||||
}
|
||||
if ( beginDate && endDate) {
|
||||
params.beginDate = beginDate.substring(0, 10);
|
||||
params.endDate = endDate.substring(0, 10);
|
||||
}
|
||||
creditBuyerOrderList(params).then(res => {
|
||||
pageData.list = [...pageData.list,...res.content]
|
||||
pageData.totalElements = res.totalElements
|
||||
})
|
||||
creditBuyerOrderSummary(params).then(res => {
|
||||
pageData.payCountList[0].amount = res.payAmountTotal
|
||||
pageData.payCountList[0].count = res.count
|
||||
pageData.payCountList[1].amount = res.paidAmountTotal
|
||||
pageData.payCountList[2].amount = res.unpaidAmountTotal
|
||||
pageData.payCountList[3].amount = res.unpaidCount
|
||||
})
|
||||
}
|
||||
function changeTime(e) {
|
||||
pageData.selected = e
|
||||
console.log(e)
|
||||
if (e == 'custom') {
|
||||
currentInstance.ctx.$refs.datePicker.toggle()
|
||||
} else {
|
||||
pageData.query.page = 1;
|
||||
pageData.list = [];
|
||||
getList()
|
||||
}
|
||||
}
|
||||
function datePickerConfirm(e) {
|
||||
pageData.start = e.start
|
||||
pageData.end = e.end
|
||||
getList()
|
||||
// gettableData() day如日期不能是1 7 30 就回报错
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态选择
|
||||
*/
|
||||
function changeNowStatusIndex(i,item) {
|
||||
pageData.statusIndex = i
|
||||
pageData.showStatus = false
|
||||
pageData.statusTitle = item.label
|
||||
pageData.query.status = item.value
|
||||
getList()
|
||||
}
|
||||
let repaymentOpen = (item) => {
|
||||
if ( item.repaymentMethod == 'total' ) {
|
||||
return;
|
||||
}
|
||||
repayment.value.open({creditBuyerId:pageData.query.creditBuyerId,order:item});
|
||||
}
|
||||
let affirm = (item) => {
|
||||
pageData.query.page = 1;
|
||||
pageData.list = [];
|
||||
getList()
|
||||
}
|
||||
let toUrl = (url, d) => {
|
||||
go.to(url, d)
|
||||
}
|
||||
// 获取当前时间
|
||||
function getdate() {
|
||||
const dt = new Date();
|
||||
const y = dt.getFullYear();
|
||||
const m = (dt.getMonth() + 1 + "").padStart(2, "0");
|
||||
const d = (dt.getDate() + "").padStart(2, "0");
|
||||
const hh = (dt.getHours() + "").padStart(2, "0");
|
||||
const mm = (dt.getMinutes() + "").padStart(2, "0");
|
||||
const ss = (dt.getSeconds() + "").padStart(2, "0");
|
||||
return `${y}-${m}-${d}`;
|
||||
}
|
||||
// 获取昨天时间
|
||||
const formatTime = () => {
|
||||
let strDate = getdate()
|
||||
let dateFormat = new Date(strDate);
|
||||
dateFormat = dateFormat.setDate(dateFormat.getDate() - 1);
|
||||
dateFormat = new Date(dateFormat);
|
||||
let y = dateFormat.getFullYear()
|
||||
let m = (dateFormat.getMonth() + 1).toString().padStart(2, '0')
|
||||
let d = dateFormat.getDate().toString().padStart(2, '0')
|
||||
return `${y}-${m}-${d}`
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
page{
|
||||
background: #F9F9F9;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.credit_search {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fff;
|
||||
padding: 32rpx 0 12rpx 0;
|
||||
position: fixed;
|
||||
top: 0rpx;
|
||||
left: 0;
|
||||
z-index: 9;
|
||||
.search_status{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 24rpx;
|
||||
padding: 0 28rpx;
|
||||
.title{
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.select{
|
||||
width: 116rpx;
|
||||
text-align: center;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.time-wrapper {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 32rpx;
|
||||
padding: 16rpx 28rpx 0 28rpx;
|
||||
background-color: #fff;
|
||||
border-bottom: 2rpx solid #F0F0F0;
|
||||
.timelistbox {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.time-item {
|
||||
font-size: 28rpx;
|
||||
text-align: center;
|
||||
padding-bottom: 22rpx;
|
||||
font-weight: 400;
|
||||
|
||||
}
|
||||
|
||||
.xian {
|
||||
width: 40rpx;
|
||||
height: 4rpx;
|
||||
background-color: #318AFE;
|
||||
// position: absolute;
|
||||
// left: 16rpx;
|
||||
// bottom: 0;
|
||||
}
|
||||
.time-selected {
|
||||
color: #318afe;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
.statusList {
|
||||
position: fixed;
|
||||
top: 212rpx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
background-color: #fff;
|
||||
>view{
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
}
|
||||
.shade{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
margin: auto;
|
||||
z-index: 1;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.content {
|
||||
padding: 245rpx 28rpx 32rpx 28rpx;
|
||||
.statistics{
|
||||
padding: 38rpx 0;
|
||||
background-color: #fff;
|
||||
border-radius: 18rpx;
|
||||
margin-bottom: 32rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.statistics_cell{
|
||||
width: 25%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
.statistics_cell_value{
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
.statistics_cell_label{
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
.statistics_cell_xian{
|
||||
width: 0rpx;
|
||||
height: 38rpx;
|
||||
border: 1rpx solid #E5E5E5;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
.content_list{
|
||||
.list_cell{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 18rpx;
|
||||
padding: 32rpx 24rpx;
|
||||
.amount{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
background: #F9F9F9;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
margin-bottom: 32rpx;
|
||||
padding: 32rpx 0;
|
||||
>view{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
.payAmount{
|
||||
color: #333333;
|
||||
}
|
||||
.paidAmount{
|
||||
color: #318AFE;
|
||||
}
|
||||
.unpaidAmount{
|
||||
color: #F02C45;
|
||||
}
|
||||
>view>text{
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.amount_label{
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
margin-top: 5rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.cell_list{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
>view{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
}
|
||||
.bottomBox{
|
||||
padding-top: 24rpx;
|
||||
border-top: 1rpx solid #E5E5E5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
.btn{
|
||||
padding: 8rpx 32rpx;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.record{
|
||||
border-radius: 28rpx 28rpx 28rpx 28rpx;
|
||||
border: 2rpx solid #3189FD;
|
||||
color: #3189FD;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
.payment{
|
||||
color: #FFFFFF;
|
||||
background: #3189FD;
|
||||
border-radius: 28rpx 28rpx 28rpx 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
362
pageCreditBuyer/index.vue
Normal file
362
pageCreditBuyer/index.vue
Normal file
@@ -0,0 +1,362 @@
|
||||
<template>
|
||||
<view class="credit_search">
|
||||
<view class="select" @tap="pageData.showStatus = !pageData.showStatus" style="display: flex;align-items: center;width: 140rpx;">
|
||||
<text>{{pageData.title}}</text>
|
||||
<up-icon name="arrow-down-fill" size="12" style="margin-left: 12rpx;"></up-icon>
|
||||
</view>
|
||||
<!-- <view class="input">
|
||||
<input v-model="pageData.query.keywords" @input="inputEvent" type="text" placeholder="搜索挂账人或者手机号" />
|
||||
</view> -->
|
||||
<view class="input">
|
||||
<up-input
|
||||
shape='circle'
|
||||
border="none"
|
||||
v-model="pageData.query.keywords"
|
||||
@change="inputEvent"
|
||||
type="text"
|
||||
placeholder="搜索挂账人或者手机号"
|
||||
prefixIcon="search"
|
||||
prefixIconStyle="font-size: 26px;color: #666"
|
||||
style='width: 100%;padding: 24rpx;'
|
||||
></up-input>
|
||||
</view>
|
||||
<view class="icon">
|
||||
<up-icon @tap="pageData.sheetShow = true" name="list" color="#318AFE" :size="32"></up-icon>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view :style="{height:pageData.showStatus?statusHeight:0}" class="tranistion statusList overflow-hide">
|
||||
<view @tap="changeNowStatusIndex(index,item)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between"
|
||||
v-for="(item,index) in pageData.statusList" :key="index">
|
||||
<view :class="{'color-main':pageData.statusIndex===index}">{{item.label}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="debtor" v-if="pageData.list.length">
|
||||
<view class="debtorItem" v-for="(item,index) in pageData.list" :key="index">
|
||||
<view class="head">
|
||||
<text> {{item.id}} </text>
|
||||
<view class="headStatus"><text style="margin-right: 16rpx;">是否启用</text> <up-switch v-model="item.status" @change="statusChange(item)" :activeValue="1" :inactiveValue="0"></up-switch> </view>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="cell">
|
||||
<view class="cell_item"><text>挂账人:</text><text class="val">{{item.debtor}}</text></view>
|
||||
<view class="cell_item"><text>已挂账金额:</text><text class="val">{{item.owedAmount}}</text></view>
|
||||
</view>
|
||||
<view class="cell">
|
||||
<view class="cell_item"><text>挂账额度:</text><text class="val">{{item.creditAmount}}</text></view>
|
||||
<view class="cell_item"><text>剩余挂账额度:</text><text class="val">{{item.remainingAmount}}</text></view>
|
||||
</view>
|
||||
<view class="cell">
|
||||
<view class="cell_item"><text>账户余额:</text><text class="val">{{item.accountBalance}}</text></view>
|
||||
<view class="cell_item"><text>通用门店:</text><text class="val">{{item.shopName}}</text></view>
|
||||
</view>
|
||||
<view class="cell">
|
||||
<view class="cell_item"><text>手机号:</text><text class="val">{{item.mobile}}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="handle">
|
||||
<view class="handle_btn" @tap="toUrl('PAGES_CREDIT_BUYER_REPAYMENTRECORD',{id:item.id})">还款记录</view>
|
||||
<view class="handle_btn" @tap="toUrl('PAGES_CREDIT_BUYER_DETAIL',{id:item.id,repaymentMethod:item.repaymentMethod})">查看明细</view>
|
||||
<view class="handle_btn" :style="{ color: item.repaymentMethod == 'order' ? '#999' :'',borderColor: item.repaymentMethod == 'order' ? '#999' :''}" @tap="repaymentOpen(item)">还款</view>
|
||||
<view class="handle_btn" @tap="toUrl('PAGES_CREDIT_BUYER_ADDDEBTOR',{item:JSON.stringify(item)})">编辑</view>
|
||||
<view class="handle_btn" @tap="delDebtor(item)">删除</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="pageData.list.length">
|
||||
<my-pagination :page="pageData.query.page" :totalElements="pageData.totalElements" :size="pageData.query.size"
|
||||
@change="pageChange"></my-pagination>
|
||||
</template>
|
||||
</view>
|
||||
<view v-else style="display: flex;flex-direction: column;align-items: center;justify-content: center;margin-top: 500rpx;">
|
||||
<image src="./bg.png" style="width: 325rpx;height: 335rpx;" mode=""></image>
|
||||
<view style="font-size: 28rpx;color: #999;margin-top: 20rpx;">暂无数据</view>
|
||||
</view>
|
||||
<my-repayment ref="repayment" @affirm="affirm"></my-repayment>
|
||||
|
||||
<up-action-sheet :actions="pageData.sheetList" @select="selectClick" :show="pageData.sheetShow" round="20" cancelText="取消" @close="pageData.sheetShow=false"></up-action-sheet>
|
||||
<up-modal :show="pageData.delShow" title="确认是否删除当前挂账人" @confirm="delConfirm" @cancel="pageData.delShow=false" showCancelButton></up-modal>
|
||||
<view class="shade" v-show="pageData.showStatus" @tap="pageData.showStatus=false"></view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import myRepayment from './components/my-repayment';
|
||||
import color from '@/commons/color.js';
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
computed
|
||||
} from 'vue';
|
||||
import {
|
||||
onShow
|
||||
} from '@dcloudio/uni-app'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js';
|
||||
import {
|
||||
getCreditBuyerList,
|
||||
editCreditBuyer,
|
||||
delCreditBuyer
|
||||
} from '@/http/yskApi/credit.js';
|
||||
|
||||
let pageData = reactive({
|
||||
showStatus: false,
|
||||
sheetShow: false,
|
||||
sheetList: [
|
||||
{name: '创建挂账人', value: 'add'}
|
||||
],
|
||||
delShow: false,
|
||||
delItem: null,
|
||||
list: [],
|
||||
statusList: [
|
||||
{ label: '全部状态', value: '' },
|
||||
{ label: '未付款', value: 'unpaid' },
|
||||
{ label: '部分支付', value: 'partial' },
|
||||
{ label: '已付款', value: 'paid' }
|
||||
],
|
||||
query: {
|
||||
page: 1,
|
||||
size: 10,
|
||||
repaymentStatus: '',
|
||||
keywords: ''
|
||||
},
|
||||
statusIndex: 0,
|
||||
title: '全部状态',
|
||||
totalElements: 0,
|
||||
})
|
||||
let repayment = ref(null)
|
||||
|
||||
let statusHeight = computed(() => {
|
||||
return 30 * pageData.statusList.length + 40 + 'px'
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取挂账人列表
|
||||
*/
|
||||
async function getList() {
|
||||
getCreditBuyerList({
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
repaymentStatus: pageData.query.repaymentStatus,
|
||||
keywords: pageData.query.keywords,
|
||||
size: pageData.query.size,
|
||||
page: pageData.query.page
|
||||
}).then(res => {
|
||||
pageData.list = res.content
|
||||
pageData.totalElements = res.totalElements
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 挂账人/手机号筛选
|
||||
*/
|
||||
function inputEvent(d) {
|
||||
pageData.query.keywords = d.replace(/\s*/g, "");
|
||||
getList()
|
||||
}
|
||||
|
||||
function changeNowStatusIndex(i,item) {
|
||||
pageData.statusIndex = i
|
||||
pageData.showStatus = false
|
||||
pageData.title = item.label
|
||||
pageData.query.repaymentStatus = item.value
|
||||
getList()
|
||||
}
|
||||
// 页数改变事件
|
||||
function pageChange(page) {
|
||||
console.log(page)
|
||||
pageData.query.page = page
|
||||
getList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
*/
|
||||
let statusChange = (item) => {
|
||||
editCreditBuyer(item).then((res) => {})
|
||||
}
|
||||
|
||||
/*
|
||||
* 操作
|
||||
*/
|
||||
let selectClick = (e) => {
|
||||
if(e.value == 'add') {
|
||||
toUrl('PAGES_CREDIT_BUYER_ADDDEBTOR')
|
||||
}
|
||||
};
|
||||
let repaymentOpen = (item) => {
|
||||
if ( item.repaymentMethod == 'order' ) {
|
||||
return;
|
||||
}
|
||||
repayment.value.open(item);
|
||||
}
|
||||
let affirm = (item) => {
|
||||
getList()
|
||||
}
|
||||
/**
|
||||
* 删除挂账人
|
||||
*/
|
||||
let delDebtor = (item) => {
|
||||
pageData.delShow = true;
|
||||
pageData.delItem = item;
|
||||
|
||||
}
|
||||
let delConfirm = () => {
|
||||
pageData.delShow = false;
|
||||
delCreditBuyer(pageData.delItem.id).then(res => {
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转
|
||||
*/
|
||||
let toUrl = (url, d) => {
|
||||
|
||||
go.to(url, d)
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
page {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
</style>
|
||||
<style scoped lang="less">
|
||||
.shade{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
margin: auto;
|
||||
z-index: 1;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.credit_search {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
padding: 32rpx 28rpx;
|
||||
background-color: #fff;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
z-index: 9;
|
||||
>view:first-child,
|
||||
>view:last-child {
|
||||
font-size: 24rpx;
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
>view:last-child {
|
||||
color: #318AFE;
|
||||
}
|
||||
.select{
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 100%;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
background: #F9F9F9;
|
||||
border-radius: 32rpx 32rpx 32rpx 32rpx;
|
||||
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
|
||||
}
|
||||
.icon{
|
||||
width: 90rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.statusList {
|
||||
position: fixed;
|
||||
top: 124rpx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
background-color: #fff;
|
||||
>view{
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
}
|
||||
.debtor{
|
||||
padding: 152rpx 28rpx 32rpx 28rpx;
|
||||
.debtorItem{
|
||||
padding: 24rpx 16rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 10rpx;
|
||||
margin-bottom: 32rpx;
|
||||
.head{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 24rpx;
|
||||
font-weight: 500;
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
.headStatus{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
.content{
|
||||
background-color: #f9f9f9;
|
||||
border-radius: 12rpx;
|
||||
padding: 24rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 32rpx;
|
||||
.cell{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16rpx;
|
||||
.cell_item{
|
||||
flex-shrink: 0;
|
||||
font-weight: bold;
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
.val{
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.handle{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
.handle_btn{
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #318AFE;
|
||||
padding: 10rpx 18rpx;
|
||||
border-radius: 28rpx 28rpx 28rpx 28rpx;
|
||||
border: 2rpx solid #318AFE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
149
pageCreditBuyer/rePaymentRecord.vue
Normal file
149
pageCreditBuyer/rePaymentRecord.vue
Normal file
@@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<view class="credit_search">
|
||||
<up-input
|
||||
shape='circle'
|
||||
border="none"
|
||||
v-model="pageData.query.paymentMethod"
|
||||
type="text"
|
||||
placeholder="支付方式"
|
||||
prefixIcon="search"
|
||||
prefixIconStyle="font-size: 26px;color: #666"
|
||||
style='width: 100%;padding: 24rpx;'
|
||||
></up-input>
|
||||
<view class="search" @tap="inputEvent">搜索</view>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="content_list" v-if="pageData.list.length > 0">
|
||||
<view class="list_cell" v-for="(item,index) in pageData.list" :key="item.id">
|
||||
<view><text class="paymentMethod">{{item.paymentMethod}}</text><text class="repaymentAmount">¥{{item.repaymentAmount}}</text></view>
|
||||
<view><text class="remark">{{item.remark||'-'}}</text><text class="createTime">{{item.createTime}}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else style="display: flex;flex-direction: column;align-items: center;justify-content: center;margin-top: 300rpx;">
|
||||
<image src="./bg.png" style="width: 325rpx;height: 335rpx;" mode=""></image>
|
||||
<view style="font-size: 28rpx;color: #999;margin-top: 20rpx;">暂无数据</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
<script setup>
|
||||
import { creditRePaymentRecord } from '@/http/yskApi/credit.js'
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
const pageData = reactive({
|
||||
query: {
|
||||
page: 1,
|
||||
size: 10,
|
||||
creditBuyerId: null,
|
||||
orderId: null,
|
||||
paymentMethod: ''
|
||||
},
|
||||
list: []
|
||||
})
|
||||
|
||||
onLoad((options) => {
|
||||
console.log(options)
|
||||
if ( options.id ) {
|
||||
pageData.query.creditBuyerId = options.id;
|
||||
}
|
||||
if ( options.orderId ) {
|
||||
pageData.query.orderId = options.orderId;
|
||||
}
|
||||
getList()
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取还款记录列表
|
||||
*/
|
||||
async function getList() {
|
||||
let params = {
|
||||
creditBuyerId: pageData.query.creditBuyerId,
|
||||
paymentMethod: pageData.query.paymentMethod,
|
||||
size: pageData.query.size,
|
||||
page: pageData.query.page
|
||||
}
|
||||
if ( pageData.query.orderId ) {
|
||||
params.orderId = pageData.query.orderId
|
||||
}
|
||||
creditRePaymentRecord(params).then(res => {
|
||||
pageData.list = res.content
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 挂账人/手机号筛选
|
||||
*/
|
||||
function inputEvent(d) {
|
||||
pageData.query.paymentMethod = pageData.query.paymentMethod.replace(/\s*/g, "");
|
||||
console.log(pageData.query)
|
||||
getList()
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
page{
|
||||
background: #F9F9F9;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.credit_search {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
padding: 32rpx 28rpx;
|
||||
>view:nth-child(1) {
|
||||
width: 100%;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
background: #F9F9F9;
|
||||
border-radius: 32rpx 32rpx 32rpx 32rpx;
|
||||
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
|
||||
}
|
||||
.search{
|
||||
width: 116rpx;
|
||||
text-align: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
.content {
|
||||
padding: 32rpx 28rpx 150rpx 28rpx;
|
||||
.content_list{
|
||||
padding: 40rpx 24rpx 8rpx 24rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 18rpx;
|
||||
.list_cell{
|
||||
border-bottom: 1rpx solid #E5E5E5;
|
||||
padding-bottom: 24rpx;
|
||||
margin-bottom: 24rpx;
|
||||
>view{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.paymentMethod,.repaymentAmount{
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.remark,.createTime{
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
}
|
||||
.list_cell:last-child{
|
||||
border-bottom: none;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,36 +1,33 @@
|
||||
<template>
|
||||
<view class="mask u-fixed position-all u-flex u-col-bottom" v-if="show" @tap="close">
|
||||
<view class="bg-fff w-full" @tap.stop="nullFunction">
|
||||
<view class="mask u-fixed position-all u-flex u-col-bottom u-font-28" v-if="show" @tap="close">
|
||||
<view class="bg-fff w-full " @tap.stop="nullFunction">
|
||||
<view class="u-p-30">
|
||||
<view class="font-bold u-text-center">选择商品</view>
|
||||
<view class="u-m-t-32 u-flex">
|
||||
<view class="u-flex-1 u-p-r-16">
|
||||
<view class="u-m-b-12">商品名称</view>
|
||||
<uni-easyinput v-model="goods.query.name" placeholder="请输入商品名称" />
|
||||
</view>
|
||||
<view class="u-flex-1 u-p-l-16">
|
||||
<view class="u-m-b-12">商品分类</view>
|
||||
<view class=" ">
|
||||
<uni-data-picker :clear-icon="false" :map="{text:'name',value:'id'}" placeholder="请选择分类"
|
||||
popup-title="请选择分类" :localdata="category" v-model="goods.query.categoryId">
|
||||
<view class="u-flex u-font-28" >
|
||||
<text class=" u-line-1"
|
||||
style="max-width: 100rpx;">{{goods.query.categoryId||'分类' }}</text>
|
||||
<up-icon name="arrow-down" size="16"></up-icon>
|
||||
</view>
|
||||
</uni-data-picker>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-32 u-flex u-row-right">
|
||||
<view class="u-flex-1 u-p-r-16">
|
||||
<my-button type="cancel" plain @tap="resetQuery">重置</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1 u-p-l-16">
|
||||
<my-button @tap="getGoods">查询</my-button>
|
||||
<up-search @custom="getGoods" v-model="goods.query.name" placeholder="请输入商品名称" @search="getGoods" @clear="getGoods"></up-search>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<scroll-view :scroll-x="false" scroll-y="true" :style="computedStyle()">
|
||||
<view class="u-p-l-30 u-p-r-30">
|
||||
<view class="u-flex u-row-between no-wrap">
|
||||
<view class="u-p-l-30 u-p-r-30 table">
|
||||
<view class="u-flex u-row-between no-wrap title">
|
||||
<view>
|
||||
<my-radio @change="radioAllChange" v-model="goods.allChecked" shape="square" :size="20"></my-radio>
|
||||
<my-radio @change="radioAllChange" v-model="goods.allChecked" shape="square"
|
||||
:size="20"></my-radio>
|
||||
</view>
|
||||
<view>商品信息</view>
|
||||
<view>规格</view>
|
||||
@@ -40,29 +37,35 @@
|
||||
<view>销量/库存</view>
|
||||
<view>分类名称</view>
|
||||
</view>
|
||||
<view class="u-m-t-12 u-flex u-row-between" v-for="(item,index) in goods.list" :key="index">
|
||||
<my-radio @change="radioChange" v-model="item.checked" shape="square" :size="20"></my-radio>
|
||||
<view class="u-flex u-flex-col u-row-center u-col-center">
|
||||
<image lazy-load class="coverImg" :src="item.coverImg" mode=""></image>
|
||||
<view class="u-m-t-10">{{item.name}}</view>
|
||||
<view @click="changeChecked(item)" class="u-m-t-12 u-flex u-p-24 u-row-between row" v-for="(item,index) in goods.list" :key="index">
|
||||
<view class="">
|
||||
<my-radio @change="radioChange($event,item)" v-model="item.checked" shape="square" :size="20"></my-radio>
|
||||
</view>
|
||||
<view>
|
||||
<view class="u-text-left u-flex-1 u-p-l-20">
|
||||
<!-- <view class="u-flex">
|
||||
<image lazy-load class="coverImg" :src="item.coverImg" mode=""></image>
|
||||
</view> -->
|
||||
<view class="">{{item.name}}</view>
|
||||
</view>
|
||||
<view class="u-flex-1 u-p-l-4 u-p-r-4 box-size-border">
|
||||
{{item.typeEnum}}
|
||||
</view>
|
||||
<view>
|
||||
<view class="u-flex-1">
|
||||
¥{{ item.lowPrice }}
|
||||
</view>
|
||||
<view>
|
||||
{{ item.realSalesNumber }}/{{ item.stockNumber }}
|
||||
<view class="u-flex-1">
|
||||
<!-- {{ item.realSalesNumber }}/{{ item.stockNumber }} -->
|
||||
{{ item.stockNumber }}
|
||||
</view>
|
||||
<view>
|
||||
{{item.categoryName}}
|
||||
<view class="u-flex-1">
|
||||
{{item.categoryName}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="u-p-30">
|
||||
<my-pagination :totalElements="goods.totalElements" :size="goods.query.size" @change="pageChange"></my-pagination>
|
||||
<my-pagination :totalElements="goods.totalElements" :size="goods.query.size"
|
||||
@change="pageChange"></my-pagination>
|
||||
<view class="u-m-t-20 u-flex">
|
||||
<view class="u-flex-1 u-p-r-16">
|
||||
<my-button type="cancel" plain @tap="close">取消</my-button>
|
||||
@@ -77,11 +80,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import myButton from '@/components/my-components/my-button';
|
||||
import myRadio from '@/components/my-components/my-radio';
|
||||
import myPagination from '@/components/my-components/my-pagination'
|
||||
import {
|
||||
$tbProduct
|
||||
$tbProductList
|
||||
} from '@/http/yskApi/goods.js';
|
||||
import {
|
||||
reactive,
|
||||
@@ -96,7 +96,7 @@
|
||||
},
|
||||
height: {
|
||||
type: [Number, String],
|
||||
default: '40vh'
|
||||
default: '50vh'
|
||||
},
|
||||
category: {
|
||||
type: Array,
|
||||
@@ -105,29 +105,42 @@
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function changeChecked(item){
|
||||
item.checked=!item.checked
|
||||
if(!item.checked&&$selGoodsMap[item.id]){
|
||||
delete $selGoodsMap[item.id]
|
||||
}else{
|
||||
$selGoodsMap[item.id]=item
|
||||
}
|
||||
goods.allChecked = goods.list.filter(v => v.checked).length != 0
|
||||
}
|
||||
function nullFunction() {
|
||||
|
||||
}
|
||||
|
||||
const show = ref(props.modelValue)
|
||||
|
||||
function open(arr) {
|
||||
|
||||
let selArr=[]
|
||||
|
||||
let $selGoodsMap={}
|
||||
async function open(arr) {
|
||||
show.value = true
|
||||
if(arr){
|
||||
for(let i in goods.list){
|
||||
console.log(arr.includes(goods.list[i].id));
|
||||
goods.list[i].checked=arr.includes(goods.list[i].id)
|
||||
}
|
||||
selArr=arr
|
||||
console.log(arr);
|
||||
for(let i in arr){
|
||||
$selGoodsMap[arr[i].proId
|
||||
]=arr[i]
|
||||
}
|
||||
|
||||
getGoods()
|
||||
}
|
||||
|
||||
function close() {
|
||||
show.value = false
|
||||
resetQuery()
|
||||
$selGoodsMap={}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function resetQuery() {
|
||||
Object.assign(goods.query, $quey)
|
||||
@@ -137,61 +150,119 @@
|
||||
return `height:${typeof props.height==='string'?props.height:props.height+'rpx'};`
|
||||
}
|
||||
|
||||
const emits = defineEmits(['update:modelValue','confirm'])
|
||||
|
||||
const emits = defineEmits(['update:modelValue', 'confirm'])
|
||||
|
||||
const $quey = {
|
||||
categoryId: '',
|
||||
name: '',
|
||||
categoryId: "",
|
||||
createdAt: [],
|
||||
id: "",
|
||||
name: "",
|
||||
sort: "createdAt,desc",
|
||||
type: "",
|
||||
page: 0,
|
||||
size: 10,
|
||||
}
|
||||
const query = reactive({
|
||||
...$quey
|
||||
})
|
||||
const goods=reactive({
|
||||
list:[],
|
||||
allChecked:false,
|
||||
totalElements:0,
|
||||
query:{
|
||||
const goods = reactive({
|
||||
list: [],
|
||||
allChecked: false,
|
||||
totalElements: 0,
|
||||
query: {
|
||||
...$quey
|
||||
}
|
||||
})
|
||||
getGoods()
|
||||
function getGoods() {
|
||||
$tbProduct(goods.query).then(res=>{
|
||||
goods.list=res.content.map(v=>{
|
||||
return {...v,checked:false}
|
||||
const arr=selArr
|
||||
$tbProductList(goods.query).then(res => {
|
||||
let selLen=0;
|
||||
goods.list = res.content.map(v => {
|
||||
const checked=$selGoodsMap[v.id]?true:false
|
||||
selLen+=(checked?1:0)
|
||||
return {
|
||||
...v,
|
||||
checked
|
||||
}
|
||||
})
|
||||
goods.allChecked=false
|
||||
goods.totalElements=res.totalElements
|
||||
goods.allChecked = selLen==res.content.length?true:false
|
||||
goods.totalElements = res.totalElements
|
||||
})
|
||||
}
|
||||
getGoods()
|
||||
|
||||
function pageChange(page){
|
||||
goods.query.page=page-1
|
||||
|
||||
function pageChange(page) {
|
||||
goods.query.page = page - 1
|
||||
getGoods()
|
||||
}
|
||||
function radioChange(newval){
|
||||
goods.allChecked=goods.list.filter(v=>v.checked).length!=0
|
||||
|
||||
function radioChange(newval,item) {
|
||||
if(!newval&&$selGoodsMap[item.id]){
|
||||
delete $selGoodsMap[item.id]
|
||||
}else{
|
||||
$selGoodsMap[item.id]=item
|
||||
}
|
||||
goods.allChecked = goods.list.filter(v => v.checked).length != 0
|
||||
}
|
||||
function radioAllChange(newval){
|
||||
goods.list.forEach(i=>{i.checked=newval})
|
||||
|
||||
function radioAllChange(newval) {
|
||||
goods.list.forEach(i => {
|
||||
i.checked = newval
|
||||
if($selGoodsMap[i.id]&&!newval){
|
||||
delete $selGoodsMap[i.id]
|
||||
}else{
|
||||
$selGoodsMap[i.id]=i
|
||||
}
|
||||
})
|
||||
}
|
||||
function confrim(){
|
||||
const arr= goods.list.filter(v=>v.checked)
|
||||
emits('confirm',arr)
|
||||
|
||||
function confrim() {
|
||||
for(let i in goods.list){
|
||||
const item=goods.list[i]
|
||||
if($selGoodsMap[item.id]&&!item.checked){
|
||||
delete $selGoodsMap[item.id]
|
||||
}
|
||||
}
|
||||
console.log($selGoodsMap);
|
||||
const arr = Object.values($selGoodsMap)
|
||||
emits('confirm', arr)
|
||||
}
|
||||
defineExpose({open,close})
|
||||
defineExpose({
|
||||
open,
|
||||
close
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.bg-fff{
|
||||
border-radius: 24rpx 24rpx 0 0 ;
|
||||
}
|
||||
.mask {
|
||||
background: rgba(51, 51, 51, 0.5);
|
||||
z-index: 900;
|
||||
}
|
||||
.coverImg{
|
||||
.box-size-border{
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.coverImg {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.table {
|
||||
background: #F9F9F9;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.title {
|
||||
padding: 12rpx 24rpx 12rpx 24rpx;
|
||||
background: #AEBAD2;
|
||||
border-radius: 8rpx 8rpx 0rpx 0rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.row:nth-of-type(2n+1) {
|
||||
background: #F0F0F0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
164
pageProduct/add-Product/components/choose-guige.vue
Normal file
164
pageProduct/add-Product/components/choose-guige.vue
Normal file
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<view class="mask u-fixed position-all u-flex u-col-bottom u-font-28" v-if="show" @tap="close">
|
||||
<view class="bg-fff w-full " @tap.stop="nullFunction">
|
||||
<view class="u-p-30">
|
||||
<view class="font-bold u-text-center">选择规格</view>
|
||||
</view>
|
||||
|
||||
<scroll-view :scroll-x="false" scroll-y="true" :style="computedStyle()">
|
||||
<view class="u-p-l-30 u-p-r-30 ">
|
||||
<view class="u-flex u-flex-wrap w-full gap-10 u-col-top">
|
||||
<view class="skd" v-for="(item,index) in skuList" :key="index"
|
||||
:class="{active:sel.id==item.id}"
|
||||
@click="guigeClick(item,index)">
|
||||
<text>{{item.specSnap||item.name}}</text>
|
||||
<view class="tag-primary tag" v-if="item.isGrounding">上架中</view>
|
||||
<view class="tag-gray tag" v-if="item.isPauseSale">已售罄</view>
|
||||
<view class="tag-gray tag" v-if="!item.isGrounding">已下架</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="u-p-30">
|
||||
<view class="u-m-t-20 u-flex">
|
||||
<view class="u-flex-1 u-p-r-16">
|
||||
<my-button type="cancel" plain @tap="close">取消</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1 u-p-l-16">
|
||||
<my-button @tap="confrim">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
$tbProduct
|
||||
} from '@/http/yskApi/goods.js';
|
||||
import {
|
||||
reactive,
|
||||
onMounted,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
let skuList=ref([])
|
||||
function nullFunction() {
|
||||
|
||||
}
|
||||
|
||||
const show = ref(props.modelValue)
|
||||
|
||||
|
||||
async function open(arr,sel) {
|
||||
show.value = true
|
||||
skuList.value=arr
|
||||
}
|
||||
|
||||
function close() {
|
||||
show.value = false
|
||||
sel.value={}
|
||||
}
|
||||
|
||||
let sel=ref({
|
||||
|
||||
})
|
||||
function guigeClick(item,index){
|
||||
if(sel.value.id==item.id){
|
||||
return sel.value={}
|
||||
}
|
||||
sel.value=item
|
||||
}
|
||||
|
||||
function computedStyle() {
|
||||
return `height:${typeof props.height==='string'?props.height:props.height+'rpx'};`
|
||||
}
|
||||
|
||||
const emits = defineEmits(['update:modelValue', 'confirm'])
|
||||
|
||||
function confrim() {
|
||||
if(!sel.value.id){
|
||||
return infoBox.showToast('请选择选择一个规格')
|
||||
}
|
||||
emits('confirm', sel.value)
|
||||
close()
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
close
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.bg-fff{
|
||||
border-radius: 24rpx 24rpx 0 0 ;
|
||||
}
|
||||
.mask {
|
||||
background: rgba(51, 51, 51, 0.5);
|
||||
z-index: 900;
|
||||
}
|
||||
.skd {
|
||||
padding: 10rpx 38rpx 8rpx 40rpx;
|
||||
background: #F0F2F5;
|
||||
border-radius: 4rpx;
|
||||
position: relative;
|
||||
color: #666;
|
||||
overflow: hidden;
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 24rpx;
|
||||
border: 1px solid transparent;
|
||||
&.active{
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
.tag {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
font-size: 12rpx;
|
||||
height: 18rpx;
|
||||
line-height: 18rpx;
|
||||
right: 0;
|
||||
border-radius: 0rpx 2rpx 2rpx 8rpx;
|
||||
}
|
||||
|
||||
.tag-primary {
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tag-gray {
|
||||
background-color: rgb(144, 147, 153);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.coverImg {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.table {
|
||||
background: #F9F9F9;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.title {
|
||||
padding: 12rpx 24rpx 12rpx 24rpx;
|
||||
background: #AEBAD2;
|
||||
border-radius: 8rpx 8rpx 0rpx 0rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.row:nth-of-type(2n+1) {
|
||||
background: #F0F0F0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
109
pageProduct/add-Product/components/price-number-box.vue
Normal file
109
pageProduct/add-Product/components/price-number-box.vue
Normal file
@@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<view class="u-flex number-box">
|
||||
<view class="u-flex u-flex-1">
|
||||
<up-input @blur="priceFormat" border="none" v-model="number" :type="inputType" :placeholder="placeholder"></up-input>
|
||||
</view>
|
||||
<view class="u-flex u-flex-col right">
|
||||
<view class="u-flex-1 u-p-l-8 u-p-r-8" @click="changeNumber('add')">
|
||||
<up-icon name="arrow-up" color="#E5E5E5"></up-icon>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="u-flex-1 u-p-l-8 u-p-r-8" @click="changeNumber('reduce')">
|
||||
<up-icon name="arrow-down" color="#E5E5E5"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
formatPrice
|
||||
} from "@/commons/utils/format.js";
|
||||
import {
|
||||
ref,
|
||||
watch,nextTick
|
||||
} from 'vue';
|
||||
const props = defineProps({
|
||||
inputType:{
|
||||
type:String,
|
||||
default:'digit'
|
||||
},
|
||||
modelValue: {
|
||||
type: [String, Number]
|
||||
},
|
||||
min: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
max: {
|
||||
type: Number,
|
||||
default: 999999999
|
||||
},
|
||||
step: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '请输入'
|
||||
}
|
||||
})
|
||||
let number = ref(props.modelValue)
|
||||
|
||||
function changeNumber(type) {
|
||||
const newval = number.value + props.step * (type == 'add' ? 1 : -1)
|
||||
if (newval < props.min) {
|
||||
number.value = props.min
|
||||
}
|
||||
if (newval > props.max) {
|
||||
number.value = props.max
|
||||
}
|
||||
priceFormat(newval)
|
||||
}
|
||||
|
||||
function priceFormat(e) {
|
||||
nextTick(() => {
|
||||
const min = props
|
||||
.min;
|
||||
const max = props.max;
|
||||
if (e === '') {
|
||||
return
|
||||
}
|
||||
const newval = formatPrice(e, min, max, true)
|
||||
if (typeof newval !== 'number') {
|
||||
number.value = newval.value
|
||||
uni.showToast({
|
||||
title: `请输入${min}到${max}范围内的数字`,
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
number.value = newval
|
||||
}
|
||||
})
|
||||
}
|
||||
watch(() => props.modelValue, (newval) => {
|
||||
number.value = newval
|
||||
})
|
||||
const emits = defineEmits(['update:modelValue'])
|
||||
watch(() => number.value, (newval) => {
|
||||
emits('update:modelValue', newval)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background-color: #E5E5E5;
|
||||
}
|
||||
|
||||
.number-box {
|
||||
border: 1px solid #E5E5E5;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
padding-left: 24rpx;
|
||||
|
||||
.right {
|
||||
border-left: 1px solid #E5E5E5;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
224
pageProduct/add-Product/timer - 副本.vue
Normal file
224
pageProduct/add-Product/timer - 副本.vue
Normal file
@@ -0,0 +1,224 @@
|
||||
<template>
|
||||
<view class="u-p-30 min-page u-font-28">
|
||||
<!-- <view class="u-flex">
|
||||
<view style="width: 210rpx;">
|
||||
<my-button shape="circle" @click="addTimer">添加定时器</my-button>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="list u-m-t-20" v-if="list.length">
|
||||
<view class="block" v-for="(item,index) in list" :key="index">
|
||||
<!-- <view class="u-flex u-row-between">
|
||||
<view>定时器{{index+1}}</view>
|
||||
<uni-icons @click="delTimer(index)" type="trash"></uni-icons>
|
||||
</view> -->
|
||||
<view class="u-flex u-row-between">
|
||||
<view>周期</view>
|
||||
<view class="color-main" @click="selectAllClick(index)">
|
||||
{{isAllChecked?'取消全选':'全选'}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-24">
|
||||
<uni-data-checkbox :selectedColor="color.ColorMain" multiple v-model="item.cycleChecked" :localdata="cycle"></uni-data-checkbox>
|
||||
</view>
|
||||
<view class="u-m-t-24">
|
||||
<view class="u-flex">
|
||||
<view>上架时间:</view>
|
||||
<view class="u-flex-1 u-m-l-10">
|
||||
<picker mode="multiSelector" @change="listingTimeChange($event,index)"
|
||||
:value="item.listingTime.index" :range="times">
|
||||
<view class="bg-gray u-p-l-20 u-p-t-6 u-p-b-6 u-p-r-20 ">
|
||||
{{item.listingTime.value}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-16">
|
||||
<view>下架时间:</view>
|
||||
<view class="u-flex-1 u-m-l-10">
|
||||
<picker mode="multiSelector" @change="offShelfChange($event,index)"
|
||||
:value="item.offShelf.index" :range="times">
|
||||
<view class="bg-gray u-p-l-20 u-p-t-6 u-p-b-6 u-p-r-20 ">
|
||||
{{item.offShelf.value}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-flex u-row-center u-m-t-60">
|
||||
<my-button width="580" shape="circle" @click="save">保存</my-button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,
|
||||
onReady
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
computed,
|
||||
ref
|
||||
} from 'vue';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import color from '@/commons/color.js'
|
||||
import {
|
||||
$getProductDetail,
|
||||
} from '@/http/yskApi/goods.js'
|
||||
//返回一天的时间 时分格式
|
||||
function returnDayTime() {
|
||||
return new Array(2).fill(1).map((v, index) => {
|
||||
if (index === 0) {
|
||||
return new Array(24).fill(1).map((hour, index) => {
|
||||
return `0${index}`.slice(-2)
|
||||
})
|
||||
}
|
||||
if (index === 1) {
|
||||
return new Array(60).fill(1).map((hour, index) => {
|
||||
return `0${index}`.slice(-2)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
const times = ref(returnDayTime())
|
||||
let defaultTimeIndex = ref(0)
|
||||
|
||||
function getTime(indexArr) {
|
||||
const hour = times.value[0][indexArr[0]]
|
||||
const month = times.value[1][indexArr[1]]
|
||||
return `${hour}:${month}`
|
||||
}
|
||||
//获取$event.detail.value
|
||||
function getEnentDetailValue(e) {
|
||||
return e.detail.value
|
||||
}
|
||||
|
||||
function setListTimeValue(index, key, time) {
|
||||
list.value[index][key].value = time
|
||||
}
|
||||
|
||||
function listingTimeChange(e, index) {
|
||||
const indexArr = getEnentDetailValue(e)
|
||||
const time = getTime(indexArr)
|
||||
setListTimeValue(index, 'listingTime', time)
|
||||
}
|
||||
|
||||
function offShelfChange(e, index) {
|
||||
const indexArr = getEnentDetailValue(e)
|
||||
const time = getTime(indexArr)
|
||||
setListTimeValue(index, 'offShelf', time)
|
||||
}
|
||||
|
||||
|
||||
|
||||
const cycle = [{
|
||||
value: 0,
|
||||
text: '星期一'
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
text: '星期二'
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
text: '星期三'
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
text: '星期四'
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
text: '星期五'
|
||||
},
|
||||
{
|
||||
value: 5,
|
||||
text: '星期六'
|
||||
},
|
||||
{
|
||||
value: 6,
|
||||
text: '星期日'
|
||||
}
|
||||
]
|
||||
const ListDataconstructor = {
|
||||
cycleChecked: [0, 1, 2, 3, 4, 5, 6],
|
||||
}
|
||||
|
||||
function returnBasicTimeConstructor() {
|
||||
return {
|
||||
listingTime: {
|
||||
value: '00:00',
|
||||
index: [0, 0]
|
||||
},
|
||||
offShelf: {
|
||||
value: '00:00',
|
||||
index: [0, 0]
|
||||
}
|
||||
}
|
||||
}
|
||||
const list = ref([returnBasicDataConstructor()])
|
||||
function returnBasicDataConstructor() {
|
||||
return {
|
||||
...ListDataconstructor,
|
||||
...returnBasicTimeConstructor()
|
||||
}
|
||||
}
|
||||
|
||||
function addTimer() {
|
||||
list.value.push(returnBasicDataConstructor())
|
||||
}
|
||||
function delTimer(index) {
|
||||
list.value.splice(index,1)
|
||||
}
|
||||
const isAllChecked=computed(()=>{
|
||||
return list.value[0].cycleChecked.length==cycle.length?true:false
|
||||
})
|
||||
function selectAllClick(index){
|
||||
if(isAllChecked.value){
|
||||
list.value[index].cycleChecked=[]
|
||||
}else{
|
||||
list.value[index].cycleChecked=ListDataconstructor.cycleChecked
|
||||
}
|
||||
}
|
||||
// 触发定时器保存事件将数据给到添加商品页面
|
||||
function emitTimerSave(){
|
||||
uni.$emit('timerSave',list.value)
|
||||
go.back()
|
||||
}
|
||||
function save(){
|
||||
console.log(list.value);
|
||||
emitTimerSave()
|
||||
}
|
||||
let goodsDetail=ref({})
|
||||
|
||||
function returnTimer(res){
|
||||
return []
|
||||
}
|
||||
onLoad(async(opt)=>{
|
||||
let res=null
|
||||
if(opt.productId){
|
||||
res=await $getProductDetail(opt.productId)
|
||||
goodsDetail.value=res
|
||||
}
|
||||
const arr=res?returnTimer(res):[]
|
||||
if(arr.length){
|
||||
list.value=arr
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.min-page {
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.block {
|
||||
background: #FFFFFF;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
padding: 32rpx 28rpx;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -1,42 +1,45 @@
|
||||
<template>
|
||||
<view class="u-p-30 min-page">
|
||||
<view class="u-flex">
|
||||
<view class="u-p-30 min-page u-font-28">
|
||||
<!-- <view class="u-flex">
|
||||
<view style="width: 210rpx;">
|
||||
<my-button shape="circle" @click="addTimer">添加定时器</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="list u-m-t-20" v-if="list.length">
|
||||
<view class="block" v-for="(item,index) in list" :key="index">
|
||||
<view class="u-flex u-row-between">
|
||||
<!-- <view class="u-flex u-row-between">
|
||||
<view>定时器{{index+1}}</view>
|
||||
<uni-icons @click="delTimer(index)" type="trash"></uni-icons>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-20 u-row-between">
|
||||
</view> -->
|
||||
<view class="u-flex u-row-between">
|
||||
<view>周期</view>
|
||||
<view @click="selectAllClick(index)">全选</view>
|
||||
<view class="color-main" @click="selectAllClick(index)">
|
||||
{{isAllChecked?'取消全选':'全选'}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-20">
|
||||
<uni-data-checkbox multiple v-model="item.cycleChecked" :localdata="cycle"></uni-data-checkbox>
|
||||
<view class="u-m-t-24">
|
||||
<uni-data-checkbox :selectedColor="color.ColorMain" multiple v-model="item.cycleChecked"
|
||||
:localdata="cycle"></uni-data-checkbox>
|
||||
</view>
|
||||
<view class="u-m-t-20">
|
||||
<view class="u-m-t-24">
|
||||
<view class="u-flex">
|
||||
<view>上架时间:</view>
|
||||
<view class="u-flex-1 u-m-l-10">
|
||||
<picker mode="multiSelector" @change="listingTimeChange($event,index)"
|
||||
:value="item.listingTime.index" :range="times">
|
||||
<picker mode="multiSelector" @change="startTimeChange($event,index)"
|
||||
:value="item.startTime.index" :range="times">
|
||||
<view class="bg-gray u-p-l-20 u-p-t-6 u-p-b-6 u-p-r-20 ">
|
||||
{{item.listingTime.value}}
|
||||
{{item.startTime.value}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-20">
|
||||
<view class="u-flex u-m-t-16">
|
||||
<view>下架时间:</view>
|
||||
<view class="u-flex-1 u-m-l-10">
|
||||
<picker mode="multiSelector" @change="offShelfChange($event,index)"
|
||||
:value="item.offShelf.index" :range="times">
|
||||
<picker mode="multiSelector" @change="endTimeChange($event,index)"
|
||||
:value="item.endTime.index" :range="times">
|
||||
<view class="bg-gray u-p-l-20 u-p-t-6 u-p-b-6 u-p-r-20 ">
|
||||
{{item.offShelf.value}}
|
||||
{{item.endTime.value}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
@@ -58,19 +61,23 @@
|
||||
onReady
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
computed,
|
||||
ref
|
||||
} from 'vue';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
import color from '@/commons/color.js'
|
||||
import {
|
||||
$getProductDetail,
|
||||
} from '@/http/yskApi/goods.js'
|
||||
//返回一天的时间 时分格式
|
||||
function returnDayTime() {
|
||||
return new Array(2).fill(1).map((v, index) => {
|
||||
return new Array(3).fill(1).map((v, index) => {
|
||||
if (index === 0) {
|
||||
return new Array(24).fill(1).map((hour, index) => {
|
||||
return `0${index}`.slice(-2)
|
||||
})
|
||||
}
|
||||
if (index === 1) {
|
||||
if (index === 1 || index === 2) {
|
||||
return new Array(60).fill(1).map((hour, index) => {
|
||||
return `0${index}`.slice(-2)
|
||||
})
|
||||
@@ -83,7 +90,8 @@
|
||||
function getTime(indexArr) {
|
||||
const hour = times.value[0][indexArr[0]]
|
||||
const month = times.value[1][indexArr[1]]
|
||||
return `${hour}:${month}`
|
||||
const s = times.value[2][indexArr[2]]
|
||||
return `${hour}:${month}:${s}`
|
||||
}
|
||||
//获取$event.detail.value
|
||||
function getEnentDetailValue(e) {
|
||||
@@ -94,66 +102,67 @@
|
||||
list.value[index][key].value = time
|
||||
}
|
||||
|
||||
function listingTimeChange(e, index) {
|
||||
function startTimeChange(e, index) {
|
||||
const indexArr = getEnentDetailValue(e)
|
||||
const time = getTime(indexArr)
|
||||
setListTimeValue(index, 'listingTime', time)
|
||||
setListTimeValue(index, 'startTime', time)
|
||||
}
|
||||
|
||||
function offShelfChange(e, index) {
|
||||
function endTimeChange(e, index) {
|
||||
const indexArr = getEnentDetailValue(e)
|
||||
const time = getTime(indexArr)
|
||||
setListTimeValue(index, 'offShelf', time)
|
||||
setListTimeValue(index, 'endTime', time)
|
||||
}
|
||||
|
||||
|
||||
|
||||
const cycle = [{
|
||||
value: 0,
|
||||
value: 'Monday',
|
||||
text: '星期一'
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
value: 'Tuesday',
|
||||
text: '星期二'
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
value: 'Wednesday',
|
||||
text: '星期三'
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
value: 'Thursday',
|
||||
text: '星期四'
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
value: 'Friday',
|
||||
text: '星期五'
|
||||
},
|
||||
{
|
||||
value: 5,
|
||||
value: 'Saturday',
|
||||
text: '星期六'
|
||||
},
|
||||
{
|
||||
value: 6,
|
||||
value: 'Sunday',
|
||||
text: '星期日'
|
||||
}
|
||||
]
|
||||
const ListDataconstructor = {
|
||||
cycleChecked: [0, 1, 2, 3, 4, 5, 6],
|
||||
cycleChecked: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
|
||||
}
|
||||
|
||||
function returnBasicTimeConstructor() {
|
||||
return {
|
||||
listingTime: {
|
||||
value: '09:00',
|
||||
index: [9, 0]
|
||||
startTime: {
|
||||
value: '00:00:00',
|
||||
index: [0, 0, 0]
|
||||
},
|
||||
offShelf: {
|
||||
value: '18:00',
|
||||
index: [18, 0]
|
||||
endTime: {
|
||||
value: '00:00:00',
|
||||
index: [0, 0, 0]
|
||||
}
|
||||
}
|
||||
}
|
||||
const list = ref([returnBasicDataConstructor()])
|
||||
|
||||
function returnBasicDataConstructor() {
|
||||
return {
|
||||
...ListDataconstructor,
|
||||
@@ -164,25 +173,68 @@
|
||||
function addTimer() {
|
||||
list.value.push(returnBasicDataConstructor())
|
||||
}
|
||||
|
||||
function delTimer(index) {
|
||||
list.value.splice(index,1)
|
||||
list.value.splice(index, 1)
|
||||
}
|
||||
function selectAllClick(index){
|
||||
list.value[index].cycleChecked=ListDataconstructor.cycleChecked
|
||||
const isAllChecked = computed(() => {
|
||||
return list.value[0].cycleChecked.length == cycle.length ? true : false
|
||||
})
|
||||
|
||||
function selectAllClick(index) {
|
||||
if (isAllChecked.value) {
|
||||
list.value[index].cycleChecked = []
|
||||
} else {
|
||||
list.value[index].cycleChecked = ListDataconstructor.cycleChecked
|
||||
}
|
||||
}
|
||||
// 触发定时器保存事件将数据给到添加商品页面
|
||||
function emitTimerSave(){
|
||||
uni.$emit('timerSave',list.value)
|
||||
function emitTimerSave() {
|
||||
const par={
|
||||
days:list.value[0].cycleChecked.join(','),
|
||||
startTime:list.value[0].startTime.value,
|
||||
endTime:list.value[0].endTime.value
|
||||
}
|
||||
console.log(par);
|
||||
uni.$emit('timerSave',par)
|
||||
go.back()
|
||||
}
|
||||
function save(){
|
||||
console.log(list.value);
|
||||
|
||||
function save() {
|
||||
emitTimerSave()
|
||||
}
|
||||
onLoad(()=>{
|
||||
const arr=uni.getStorageSync('timer')
|
||||
if(arr.length){
|
||||
list.value=arr
|
||||
let goodsDetail = ref({})
|
||||
|
||||
function returnTimeIndex(time) {
|
||||
console.log(time);
|
||||
return time.split(':').map(v=>{
|
||||
return v*1
|
||||
})
|
||||
}
|
||||
|
||||
function returnTimer(res) {
|
||||
return [{
|
||||
cycleChecked: res.days ? res.days.split(',').filter(v=>v) : [],
|
||||
startTime: res.startTime ? {
|
||||
value: res.startTime,
|
||||
index: returnTimeIndex(res.startTime)
|
||||
} : returnBasicTimeConstructor.startTime,
|
||||
endTime: res.endTime ? {
|
||||
value: res.endTime,
|
||||
index: returnTimeIndex(res.endTime)
|
||||
} : returnBasicTimeConstructor.endTime
|
||||
}]
|
||||
}
|
||||
onLoad(async (opt) => {
|
||||
let res = null
|
||||
if (opt.productId) {
|
||||
res = await $getProductDetail(opt.productId)
|
||||
goodsDetail.value = res
|
||||
}
|
||||
const arr = res ? returnTimer(res) : [];
|
||||
console.log(arr);
|
||||
if (arr.length) {
|
||||
list.value = arr
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -195,7 +247,7 @@
|
||||
.block {
|
||||
background: #FFFFFF;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
padding: 32rpx 28rpx;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -89,7 +89,7 @@
|
||||
<script setup>
|
||||
import {
|
||||
getCurrentInstance,
|
||||
|
||||
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
@@ -116,7 +116,7 @@
|
||||
formData: {
|
||||
permissions: [],
|
||||
maxDiscountAmount: 0,
|
||||
discountType:0
|
||||
discountType: 0
|
||||
},
|
||||
rolesList: [],
|
||||
columns: [],
|
||||
@@ -129,24 +129,17 @@
|
||||
onShow(() => {
|
||||
// 获取角色信息
|
||||
getrolesEvent()
|
||||
if (props.type == 'add') {
|
||||
getList()
|
||||
} else {
|
||||
// 调用id查询接口和编辑接口
|
||||
gettbPlussShopStaffDetail(props.id)
|
||||
uni.setNavigationBarTitle({
|
||||
title: '编辑员工'
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
function gettbPlussShopStaffDetail(id) {
|
||||
tbPlussShopStaffDetail(id).then(res => {
|
||||
console.log(res,'编辑员工后的提示')
|
||||
datas.formData = res
|
||||
if (datas.rolesList) {
|
||||
let rolefilter = datas.rolesList.filter(ele => ele.id == res.roleId)
|
||||
datas.rolesdata = rolefilter[0].name
|
||||
|
||||
console.log(res, '编辑员工后的提示')
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -192,8 +185,8 @@
|
||||
let num = d.detail.value * 1
|
||||
if (num >= 1) {
|
||||
datas.formData.maxDiscountAmount = 0.99
|
||||
}else{
|
||||
datas.formData.maxDiscountAmount = d.detail.value.substring(0,4)
|
||||
} else {
|
||||
datas.formData.maxDiscountAmount = d.detail.value.substring(0, 4)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,6 +196,15 @@
|
||||
res.content.forEach(ele => {
|
||||
columns[0].push(ele.name)
|
||||
})
|
||||
if (props.type == 'add') {
|
||||
getList()
|
||||
} else {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '编辑员工'
|
||||
})
|
||||
// 调用id查询接口和编辑接口
|
||||
gettbPlussShopStaffDetail(props.id)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
29
pages.json
29
pages.json
@@ -1101,6 +1101,35 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pageCreditBuyer",
|
||||
"pages": [{
|
||||
"pageId": "PAGES_CREDIT_BUYER_INDEX",
|
||||
"path": "index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "挂账管理"
|
||||
}
|
||||
},{
|
||||
"pageId": "PAGES_CREDIT_BUYER_ADDDEBTOR",
|
||||
"path": "addDebtor",
|
||||
"style": {
|
||||
"navigationBarTitleText": "挂账人"
|
||||
}
|
||||
},{
|
||||
"pageId": "PAGES_CREDIT_BUYER_REPAYMENTRECORD",
|
||||
"path": "rePaymentRecord",
|
||||
"style": {
|
||||
"navigationBarTitleText": "账单付款记录"
|
||||
}
|
||||
},{
|
||||
"pageId": "PAGES_CREDIT_BUYER_DETAIL",
|
||||
"path": "creditDetail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "查看明细"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
],
|
||||
|
||||
@@ -194,6 +194,11 @@
|
||||
icon: '/static/indexImg/icon-notification.svg',
|
||||
pageUrl: 'PAGES_NOTIFICATION_INDEX',
|
||||
},
|
||||
{
|
||||
title: '挂账管理',
|
||||
icon: '/static/indexImg/icon_credit.svg',
|
||||
pageUrl: 'PAGES_CREDIT_BUYER_INDEX',
|
||||
},
|
||||
// // // {
|
||||
// // // title: '进销存',
|
||||
// // // icon: '/static/indexImg/icon-invoicing.svg',
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
<view class="member_bg"><up-image v-if="'member_bg' == vdata.extendInfo.autokey" :src="vdata.extendInfo.value"></up-image></view>
|
||||
<view class="shopinfo_bg"><up-image v-if="'shopinfo_bg' == vdata.extendInfo.autokey" :src="vdata.extendInfo.value"></up-image></view>
|
||||
<view class="shopinfo_bg_f" v-if="'shopinfo_bg' == vdata.extendInfo.autokey"></view>
|
||||
<view class="bg"><up-image :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/cashier_admin_app_shopSet/'+vdata.extendInfo.autokey+'.png'" ></up-image></view>
|
||||
<view class="bg"><up-image v-if="vdata.extendInfo.autokey" :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/cashier_admin_app_shopSet/'+vdata.extendInfo.autokey+'.png'" ></up-image></view>
|
||||
</view>
|
||||
<view class="extend_img">
|
||||
<view class="extend_title">{{vdata.extendInfo.title}}背景图片</view>
|
||||
@@ -145,7 +145,6 @@ const vdata = reactive({
|
||||
})
|
||||
onMounted(() => {
|
||||
shopExtend();
|
||||
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
@@ -153,7 +152,7 @@ onShow(() => {
|
||||
uni.$on('refreshPreviousPage', (params) => {
|
||||
// 这里执行刷新数据的操作,例如重新调用API获取数据
|
||||
refreshData(params);
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="min-page bg-gray u-p-30">
|
||||
<view class="min-page bg-gray u-p-30 u-font-28">
|
||||
<view class="u-font-24">
|
||||
<text class="color-red">*</text>
|
||||
<text class="color-999">将临时菜添加至购物车,不会影响总商品库</text>
|
||||
@@ -14,20 +14,20 @@
|
||||
<text class="color-red">*</text>
|
||||
</view>
|
||||
</template>
|
||||
<view class="border-bottom u-p-t-10 u-p-b-10">
|
||||
<view class="border-bottom ">
|
||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.name"
|
||||
placeholder="填写菜品名称"></uni-easyinput>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item required label="" name="category">
|
||||
<template #label>
|
||||
<view class="u-text-left u-m-t-24">
|
||||
<view class="u-text-left ">
|
||||
<text class="color-333">菜品分类</text>
|
||||
<text class="color-red">*</text>
|
||||
</view>
|
||||
</template>
|
||||
<picker @change="categoryChange" :value="categoryCurrent" range-key="name" :range="category">
|
||||
<view class="u-m-t-14 u-p-t-10 u-flex u-row-between border-bottom u-p-b-10 u-relative ">
|
||||
<view class=" u-flex u-row-between border-bottom u-relative ">
|
||||
<view class="zhezhao u-absolute position-all" style="z-index: 1;"></view>
|
||||
<!-- <view>
|
||||
<text class="" v-if="form.category!==''">{{category[form.category].name}}</text>
|
||||
@@ -46,25 +46,25 @@
|
||||
|
||||
<uni-forms-item required label="" name="price">
|
||||
<template #label>
|
||||
<view class="u-m-t-24 u-text-left">
|
||||
<view class=" u-text-left">
|
||||
<text class="color-333">价格(元)</text>
|
||||
<text class="color-red">*</text>
|
||||
</view>
|
||||
</template>
|
||||
<view class="border-bottom u-p-t-10 u-p-b-10">
|
||||
<view class="border-bottom ">
|
||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.price" placeholder="输入价格"
|
||||
type="digit"></uni-easyinput>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item required label="" name="unit">
|
||||
<template #label>
|
||||
<view class="u-text-left u-m-t-24">
|
||||
<view class="u-text-left ">
|
||||
<text class="color-333">单位</text>
|
||||
<text class="color-red">*</text>
|
||||
</view>
|
||||
</template>
|
||||
<picker @change="unitChange" :value="units.current" range-key="name" :range="units.list">
|
||||
<view class="u-m-t-14 u-p-t-10 u-flex u-row-between border-bottom u-p-b-10 u-relative ">
|
||||
<view class=" u-flex u-row-between border-bottom u-relative ">
|
||||
<view class="zhezhao u-absolute position-all" style="z-index: 1;"></view>
|
||||
<view class="u-flex-1">
|
||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.unit"
|
||||
@@ -76,21 +76,33 @@
|
||||
</picker>
|
||||
|
||||
</uni-forms-item>
|
||||
<uni-forms-item required label="" name="price">
|
||||
<uni-forms-item required label="" name="num">
|
||||
<template #label>
|
||||
<view class="u-m-t-24 u-text-left">
|
||||
<view class=" u-text-left">
|
||||
<text class="color-333">下单数量</text>
|
||||
<text class="color-red">*</text>
|
||||
</view>
|
||||
</template>
|
||||
<view class="border-bottom u-p-t-10 u-p-b-10">
|
||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.number" placeholder="填写数量"
|
||||
<view class="border-bottom ">
|
||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.num" placeholder="填写数量"
|
||||
type="digit"></uni-easyinput>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item required label="" name="note">
|
||||
<template #label>
|
||||
<view class=" u-text-left">
|
||||
<text class="color-333">备注</text>
|
||||
</view>
|
||||
</template>
|
||||
<view class="border u-m-t-16">
|
||||
<uni-easyinput :inputBorder="false" paddingNone v-model="form.note" placeholder="请输入自定义备注"
|
||||
type="textarea"></uni-easyinput>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
|
||||
<view style="height: 200rpx;"></view>
|
||||
</view>
|
||||
|
||||
<view class="fixed-b">
|
||||
@@ -99,40 +111,28 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import myButton from '../../components/my-components/my-button';
|
||||
import {
|
||||
returnAllCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import {
|
||||
$tbShopCategory,
|
||||
$tbShopUnit
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import {
|
||||
$temporaryDishes
|
||||
} from '@/http/yskApi/Instead.js'
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
onMounted,
|
||||
ref,
|
||||
onBeforeMount
|
||||
} from 'vue';
|
||||
import {onLoad} from '@dcloudio/uni-app'
|
||||
const units = reactive({
|
||||
list: [{
|
||||
name: '件',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
name: '杯',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
name: '个',
|
||||
value: 3
|
||||
}
|
||||
],
|
||||
current:''
|
||||
list: [],
|
||||
current: ''
|
||||
})
|
||||
const category = reactive([{
|
||||
name: '分类1',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
name: '分类2',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
name: '分类3',
|
||||
value: 3
|
||||
}
|
||||
])
|
||||
let category = reactive([])
|
||||
let categoryCurrent = ref('')
|
||||
|
||||
function categoryChange(e) {
|
||||
@@ -140,7 +140,8 @@
|
||||
categoryCurrent.value = e.detail.value
|
||||
form.category = category[e.detail.value].name
|
||||
}
|
||||
function unitChange(e){
|
||||
|
||||
function unitChange(e) {
|
||||
units.current = e.detail.value
|
||||
form.unit = units.list[e.detail.value].name
|
||||
}
|
||||
@@ -149,9 +150,9 @@
|
||||
const form = reactive({
|
||||
name: '',
|
||||
category: '',
|
||||
price: 0,
|
||||
unit:'',
|
||||
number:0
|
||||
price: '',
|
||||
unit: '',
|
||||
num: ''
|
||||
})
|
||||
// 校验规则
|
||||
const rules = {
|
||||
@@ -167,7 +168,7 @@
|
||||
errorMessage: '请选择菜品分类'
|
||||
}]
|
||||
},
|
||||
price: {
|
||||
num: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入价格'
|
||||
@@ -186,17 +187,86 @@
|
||||
}]
|
||||
},
|
||||
}
|
||||
|
||||
let timer=null
|
||||
function submit() {
|
||||
refform.value.validate(res => {
|
||||
console.log(res)
|
||||
if(!res){
|
||||
$temporaryDishes({
|
||||
"useType": option.useType,
|
||||
"masterId": option.masterId,
|
||||
"tableId": option.tableId,
|
||||
"name": form.name,
|
||||
"categoryId": category[categoryCurrent.value].id,
|
||||
"price": form.price,
|
||||
"num": form.num,
|
||||
unit:units.list[units.current].id,
|
||||
"note": form.note,
|
||||
"vipUserId": option.vipUserId
|
||||
}).then(r=>{
|
||||
uni.$emit('add:cashCai')
|
||||
clearInterval(timer)
|
||||
timer=setTimeout(()=>{
|
||||
uni.navigateBack()
|
||||
},500)
|
||||
})
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
})
|
||||
}
|
||||
//获取单位数据
|
||||
async function getTbShopUnit() {
|
||||
const res = await $tbShopUnit({
|
||||
page: 0,
|
||||
size: 200,
|
||||
sort: "id"
|
||||
})
|
||||
units.list = res.content.map(v => {
|
||||
return {
|
||||
...v,
|
||||
value: v.id
|
||||
}
|
||||
})
|
||||
}
|
||||
async function getCategory() {
|
||||
const res = await $tbShopCategory({
|
||||
page: 0,
|
||||
size: 600
|
||||
})
|
||||
const arr = returnAllCategory(res.content).map(v => {
|
||||
return {
|
||||
...v,
|
||||
value: v.id
|
||||
}
|
||||
})
|
||||
category.length = arr.length
|
||||
for (let i in arr) {
|
||||
category[i] = arr[i]
|
||||
}
|
||||
console.log(category);
|
||||
}
|
||||
async function init() {
|
||||
getTbShopUnit()
|
||||
getCategory()
|
||||
}
|
||||
onMounted(() => {
|
||||
init()
|
||||
})
|
||||
onBeforeMount(()=>{
|
||||
clearInterval(timer)
|
||||
})
|
||||
const option=reactive({
|
||||
|
||||
})
|
||||
onLoad((opt)=>{
|
||||
Object.assign(option,opt)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.u-text-left {}
|
||||
|
||||
.form {
|
||||
margin-top: 32rpx;
|
||||
background-color: #fff;
|
||||
@@ -205,6 +275,13 @@
|
||||
// background-color: transparent;
|
||||
}
|
||||
|
||||
.border {
|
||||
border: 1px solid #F4F4F4;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
padding-left: 24rpx;
|
||||
}
|
||||
|
||||
::v-deep.uni-forms-item {
|
||||
align-items: inherit;
|
||||
}
|
||||
@@ -213,6 +290,16 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
::v-deep .uni-easyinput__content-input {
|
||||
height: inherit;
|
||||
padding-top: 16rpx;
|
||||
padding-bottom: 24rpx;
|
||||
}
|
||||
|
||||
::v-deep .uni-forms-item:not(:first-child) {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.fixed-b {
|
||||
position: fixed;
|
||||
left: 100rpx;
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<view class="page-view u-p-l-24">
|
||||
<view class="list-tight-top">
|
||||
<template v-if="lingshi.show">
|
||||
<view id="lingshi" class="lingshi" @tap="toLinshi">
|
||||
<view id="lingshi" class="lingshi u-m-b-32" @tap="toLinshi">
|
||||
<uni-icons type="plus-filled" size="24" :color="color.ColorMain"></uni-icons>
|
||||
<view class="u-m-t-24 color-main">临时菜</view>
|
||||
</view>
|
||||
@@ -224,7 +224,7 @@
|
||||
xiadanClick()
|
||||
//临时菜
|
||||
const lingshi = reactive({
|
||||
show: false
|
||||
show: true
|
||||
})
|
||||
//附加费
|
||||
const extraFee = reactive({
|
||||
@@ -671,7 +671,12 @@
|
||||
}
|
||||
|
||||
function toLinshi() {
|
||||
go.to('PAGES_ADD_TEMP_CUISINE')
|
||||
go.to('PAGES_ADD_TEMP_CUISINE',{
|
||||
masterId:data.masterId,
|
||||
tableId:data.table.tableId,
|
||||
vipUserId:option.vipUserId?option.vipUserId:'',
|
||||
useType:uni.getStorageSync('useType')
|
||||
})
|
||||
}
|
||||
|
||||
const chooseGuigeModel = ref(null)
|
||||
@@ -897,10 +902,13 @@
|
||||
categoryId,
|
||||
skuId
|
||||
} = goods
|
||||
|
||||
const cartId = goods.id
|
||||
const tabbarIndex = data.tabbar.findIndex(v => v.id == categoryId)
|
||||
const $goods = data.tabbar[tabbarIndex].foods.find(v => v.id == productId)
|
||||
const $sku = $goods.specList.find(v => v.id == skuId)
|
||||
//临时菜没有对应商品数据
|
||||
const $goods =!productId?undefined:data.tabbar[tabbarIndex].foods.find(v => v.id == productId)
|
||||
//临时菜没有skuList
|
||||
const $sku =!productId?{suit:1}:$goods.specList.find(v => v.id == skuId)
|
||||
|
||||
if (num === 0 || num < $sku.suit) {
|
||||
//移除
|
||||
@@ -1129,7 +1137,7 @@
|
||||
}
|
||||
if (e.detail.scrollTop == 0) {
|
||||
isTabClickOver = true
|
||||
return swichMenu(0)
|
||||
// return swichMenu(0)
|
||||
}
|
||||
setTimeout(() => { // 节流
|
||||
data.timer = null;
|
||||
@@ -1180,10 +1188,11 @@
|
||||
setTabBar($category, $originGoods, cars)
|
||||
}
|
||||
onBeforeUnmount(() => {})
|
||||
|
||||
|
||||
function watchUpdate() {
|
||||
uni.$off('update:createOrderIndex')
|
||||
uni.$off('get:table')
|
||||
uni.$off('add:cashCai')
|
||||
uni.$on('update:createOrderIndex', () => {
|
||||
// data.table = {
|
||||
// tableId: ""
|
||||
@@ -1192,6 +1201,15 @@
|
||||
console.log('update:createOrderIndex');
|
||||
init()
|
||||
})
|
||||
uni.$on('add:cashCai', async() => {
|
||||
console.log('add:cashCai');
|
||||
const cartRes = await getCart()
|
||||
cars.length = 0
|
||||
const cartArr = getNowCart(cartRes.records)
|
||||
for (let i in cartArr) {
|
||||
cars.push(cartArr[i])
|
||||
}
|
||||
})
|
||||
uni.$on('get:table', () => {
|
||||
console.log('get:table');
|
||||
if (data.table.tableId) {
|
||||
|
||||
@@ -9,7 +9,10 @@ export function getNowCart(records) {
|
||||
const arr = []
|
||||
for (let i in Cart) {
|
||||
const item=Cart[i]
|
||||
const key = item.productId + '_' + item.skuId
|
||||
const productId=item.productId
|
||||
const skuId=item.skuId
|
||||
const isLinShiCai=!productId&&!skuId?true:false
|
||||
const key =isLinShiCai?item.name: (item.productId + '_' + item.skuId)
|
||||
if (goodsMap.hasOwnProperty(key)) {
|
||||
const index = goodsMap[key]
|
||||
arr[index].number = arr[index].number * 1 + item.number
|
||||
|
||||
@@ -219,7 +219,8 @@
|
||||
tableId: options.tableId || orderDetail.info.tableId,
|
||||
name: options.name || orderDetail.info.tableName,
|
||||
masterId:orderDetail.info.masterId,
|
||||
type: 'add'
|
||||
type: 'add',
|
||||
vipUserId:orderDetail.memberId?orderDetail.memberId:''
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
1
static/indexImg/icon_credit.svg
Normal file
1
static/indexImg/icon_credit.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" viewBox="0 0 32 32"><defs><style>.a{fill:#80bcff;}.b{clip-path:url(#a);}.c{fill:#4c99fe;}</style><clipPath id="a"><rect class="a" width="32" height="32" transform="translate(65 1066)"/></clipPath></defs><g class="b" transform="translate(-65 -1066)"><g transform="translate(-53.919 1004.659)"><path class="c" d="M320.239,62H303.619a1.917,1.917,0,0,0-1.919,1.919v1.916h14.7a1.917,1.917,0,0,1,1.919,1.919V87.568h1.916a1.917,1.917,0,0,0,1.919-1.919V63.919A1.917,1.917,0,0,0,320.239,62Z" transform="translate(-173.381)"/><path class="c" d="M141.966,212H124.119a1.917,1.917,0,0,0-1.919,1.919v21.733a1.914,1.914,0,0,0,1.919,1.916h17.846a1.916,1.916,0,0,0,1.919-1.916V213.919A1.919,1.919,0,0,0,141.966,212Zm-3.944,14.945a1.065,1.065,0,0,1,1.06,1.077A1.08,1.08,0,0,1,138,229.1h-3.77v2.189a1.166,1.166,0,1,1-2.332,0V229.1h-3.839a1.077,1.077,0,1,1,0-2.155H131.9V225.7h-3.839a1.077,1.077,0,0,1,0-2.155h2.908l-3.3-4.739a1.078,1.078,0,1,1,1.769-1.231l3.607,5.168,3.6-5.165a1.078,1.078,0,1,1,1.769,1.231l-3.3,4.739h2.908a1.077,1.077,0,1,1,0,2.155h-3.767v1.248h3.767Z" transform="translate(0 -144.886)"/></g></g></svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
Reference in New Issue
Block a user