parent
b577f0730c
commit
860b5221a9
|
@ -20,13 +20,14 @@
|
||||||
<view class="remain flex justify-between align-center">
|
<view class="remain flex justify-between align-center">
|
||||||
<view class="left flex align-center">
|
<view class="left flex align-center">
|
||||||
<view class="unit self-start">¥</view>
|
<view class="unit self-start">¥</view>
|
||||||
<view class="sremain ss-font-60">{{ remain }}</view>
|
<view class="sremain ss-font-60">{{ fen2yuan(remain) }}</view>
|
||||||
</view>
|
</view>
|
||||||
<button @click="peach.$router.go('/pages/user/wallet/money')" class="right-btn ss-reset-button">
|
<button @click="peach.$router.go('/pages/user/wallet/money')" class="right-btn ss-reset-button">
|
||||||
查看详情
|
查看详情
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
<view class="cent ss-m-t-20"> 总获取积分 {{ userInfo.point }} </view>
|
<view class="cent ss-m-t-20"> 总获取积分 {{ userInfo.point }} </view>
|
||||||
|
<view class="cent ss-m-t-20"> 冻结金额¥ {{ fen2yuan(freezePrice || 0) }} </view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="menu ss-m-t-70">
|
<view class="menu ss-m-t-70">
|
||||||
|
@ -47,6 +48,7 @@
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
|
import { fen2yuan } from '@/peach/hooks/useGoods'
|
||||||
import { onShow } from '@dcloudio/uni-app'
|
import { onShow } from '@dcloudio/uni-app'
|
||||||
import AuthUtil from '@/peach/api/member/auth'
|
import AuthUtil from '@/peach/api/member/auth'
|
||||||
import peach from '@/peach'
|
import peach from '@/peach'
|
||||||
|
@ -88,6 +90,10 @@ const remain = computed(() => {
|
||||||
return userStore.userWallet?.balance
|
return userStore.userWallet?.balance
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const freezePrice = computed(() => {
|
||||||
|
return userStore.userWallet?.freezePrice
|
||||||
|
})
|
||||||
|
|
||||||
const userInfo = computed(() => {
|
const userInfo = computed(() => {
|
||||||
return userStore.userInfo
|
return userStore.userInfo
|
||||||
})
|
})
|
||||||
|
@ -137,7 +143,7 @@ onShow(() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.statistic {
|
.statistic {
|
||||||
height: 200rpx;
|
height: 230rpx;
|
||||||
background-color: #fffefe;
|
background-color: #fffefe;
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
border-radius: 26rpx;
|
border-radius: 26rpx;
|
||||||
|
|
|
@ -102,7 +102,6 @@ const specType = computed(() => peach.$store('trade').specType)
|
||||||
watch(
|
watch(
|
||||||
() => props.skus,
|
() => props.skus,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
console.log(newVal)
|
|
||||||
// 如果是单规格,取 sku 第一条数据
|
// 如果是单规格,取 sku 第一条数据
|
||||||
if (!specType.value) {
|
if (!specType.value) {
|
||||||
if (newVal) formData.value = newVal[0] ?? {}
|
if (newVal) formData.value = newVal[0] ?? {}
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
<view class="property-name-text">规格名</view>
|
<view class="property-name-text">规格名</view>
|
||||||
<view class="property-name-value">{{ item.name }}</view>
|
<view class="property-name-value">{{ item.name }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="property-value ss-flex ss-gap-40">
|
<view class="property-value ss-flex ss-gap-40" style="flex-wrap: wrap">
|
||||||
<view class="property-value-text">规格值</view>
|
<view class="property-value-text">规格值</view>
|
||||||
<view class="property-value-value ss-flex ss-gap-10">
|
<view v-if="item.propertyValues.length > 0" class="property-value-value ss-flex ss-gap-10">
|
||||||
<view
|
<view
|
||||||
v-for="sitem in item.propertyValues"
|
v-for="sitem in item.propertyValues"
|
||||||
@tap="chooseProperty(sitem)"
|
@tap="chooseProperty(sitem)"
|
||||||
|
|
|
@ -16,7 +16,11 @@
|
||||||
>
|
>
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</view>
|
</view>
|
||||||
<view v-if="canEdit" style="height: 60rpx" @click="addPropertyClick">
|
<view
|
||||||
|
v-if="canEdit"
|
||||||
|
style="height: 60rpx; position: relative; top: 5px; display: inline-block"
|
||||||
|
@click="addPropertyClick"
|
||||||
|
>
|
||||||
<text style="color: #ff3300; font-size: 30px" class="cicon-add-round-o"></text>
|
<text style="color: #ff3300; font-size: 30px" class="cicon-add-round-o"></text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -127,6 +131,7 @@ const inputFormdata = ref({
|
||||||
function addPropertyClick() {
|
function addPropertyClick() {
|
||||||
propertyTitle.value = '新增'
|
propertyTitle.value = '新增'
|
||||||
inputFormdata.value.name = ''
|
inputFormdata.value.name = ''
|
||||||
|
inputFormdata.value.id = ''
|
||||||
inputDialogRef.value.open()
|
inputDialogRef.value.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,12 +165,11 @@ defineExpose({
|
||||||
.popup-content {
|
.popup-content {
|
||||||
height: 500rpx;
|
height: 500rpx;
|
||||||
padding: 40rpx;
|
padding: 40rpx;
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 20rpx;
|
|
||||||
justify-content: flex-start;
|
|
||||||
|
|
||||||
.property-item {
|
.property-item {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 60rpx;
|
line-height: 60rpx;
|
||||||
height: 60rpx;
|
height: 60rpx;
|
||||||
|
|
|
@ -29,6 +29,6 @@ export const SKU_RULE_CONFIG = [
|
||||||
{
|
{
|
||||||
name: 'costPrice',
|
name: 'costPrice',
|
||||||
rule: (arg) => arg >= 0.01,
|
rule: (arg) => arg >= 0.01,
|
||||||
message: '商品成本价格必须大于等于 0.00 元!!!',
|
message: '商品成本价格必须大于等于 0.01 元!!!',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -29,11 +29,16 @@ async function showPropertyList() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRDPickerConfirm(e) {
|
function onRDPickerConfirm(e) {
|
||||||
|
if (formData.value.specType !== SPEC_TYPE[e.value[0]].value) {
|
||||||
|
peach.$store('trade').specType = SPEC_TYPE[e.value[0]].value
|
||||||
|
peach.$store('trade').selectedProperty = []
|
||||||
|
|
||||||
formData.value.specType = SPEC_TYPE[e.value[0]].value
|
formData.value.specType = SPEC_TYPE[e.value[0]].value
|
||||||
formData.value.specText = SPEC_TYPE[e.value[0]].label
|
formData.value.specText = SPEC_TYPE[e.value[0]].label
|
||||||
|
|
||||||
// 如果商品规格不一致,则需要重新初始化 sku 列表
|
// 如果商品规格不一致,则需要重新初始化 sku 列表
|
||||||
initSku()
|
initSku()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pickerProperty() {
|
function pickerProperty() {
|
||||||
|
@ -46,6 +51,7 @@ function pickerProperty() {
|
||||||
|
|
||||||
async function onPropertyConfirm(e) {
|
async function onPropertyConfirm(e) {
|
||||||
await getGoodsProperty()
|
await getGoodsProperty()
|
||||||
|
changeSubProperty()
|
||||||
}
|
}
|
||||||
|
|
||||||
function onConfirm() {
|
function onConfirm() {
|
||||||
|
@ -59,30 +65,32 @@ async function getGoodsProperty() {
|
||||||
// 把 propertyList 中 id 相同的属性合并,并去重
|
// 把 propertyList 中 id 相同的属性合并,并去重
|
||||||
propertyList.value = peach.$store('trade').selectedProperty || []
|
propertyList.value = peach.$store('trade').selectedProperty || []
|
||||||
|
|
||||||
|
let tempSkus = peach.$store('trade').skus || []
|
||||||
|
|
||||||
// 根据已经选择数据,设置默认选中
|
// 根据已经选择数据,设置默认选中
|
||||||
|
|
||||||
data.forEach((item) => {
|
data.forEach((item) => {
|
||||||
// 判断属性是否已经选中
|
// 判断属性是否已经选中
|
||||||
let propertyParent = propertyList.value.find((sitem) => sitem?.id === item.id)
|
let propertyParent = propertyList.value.find((sitem) => sitem?.id === item.id)
|
||||||
|
|
||||||
item.checked = propertyParent ? true : false
|
item.checked = propertyParent ? true : false
|
||||||
|
|
||||||
// 如果属性已经选中,查询子类中是否有选中
|
tempSkus.forEach((sitem) => {
|
||||||
if (item.checked) {
|
sitem.properties.forEach((titem) => {
|
||||||
item.propertyValues.forEach((child) => {
|
item.propertyValues.forEach((child) => {
|
||||||
let childResult = propertyParent?.children.some((schild) => schild === child.id)
|
if (!child.checked) {
|
||||||
child.checked = childResult ? true : false
|
child.checked = titem.valueId === child.id ? true : false
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
goodsPropertyList.value = data
|
goodsPropertyList.value = data
|
||||||
|
|
||||||
console.log(goodsPropertyList.value)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeSubProperty() {
|
function changeSubProperty() {
|
||||||
// 修改子属性状态,需要同步更新 skus 的显示
|
// 修改子属性状态,需要同步更新 skus 的显示
|
||||||
console.log(goodsPropertyList.value)
|
|
||||||
// 过滤父属性 checked 选项,深拷贝避免后面循环改变元数据内容
|
// 过滤父属性 checked 选项,深拷贝避免后面循环改变元数据内容
|
||||||
let temp = JSON.parse(JSON.stringify(goodsPropertyList.value.filter((item) => item.checked)))
|
let temp = JSON.parse(JSON.stringify(goodsPropertyList.value.filter((item) => item.checked)))
|
||||||
temp.forEach((item) => {
|
temp.forEach((item) => {
|
||||||
|
@ -115,7 +123,32 @@ function changeSubProperty() {
|
||||||
tempSkus.push(obj)
|
tempSkus.push(obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tempSkus.forEach((item) => {
|
||||||
|
skus.value.forEach((sitem) => {
|
||||||
|
if (sitem.properties.length === item.properties.length && item.properties.length > 0) {
|
||||||
|
let sitemIds = sitem.properties.map((child) => child.valueId)
|
||||||
|
let itemIds = item.properties.map((tchild) => tchild.valueId)
|
||||||
|
let isExist = sitemIds.every((schild) => itemIds.includes(schild))
|
||||||
|
|
||||||
|
if (isExist) {
|
||||||
|
item.picUrl = sitem.picUrl
|
||||||
|
item.barCode = sitem.barCode
|
||||||
|
item.price = sitem.price
|
||||||
|
item.marketPrice = sitem.marketPrice
|
||||||
|
item.costPrice = sitem.costPrice
|
||||||
|
item.stock = sitem.stock
|
||||||
|
item.weight = sitem.weight
|
||||||
|
item.volume = sitem.volume
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
skus.value = tempSkus
|
skus.value = tempSkus
|
||||||
|
|
||||||
|
peach.$store('trade').$patch({
|
||||||
|
skus: skus.value,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -168,6 +201,7 @@ function submitProperty() {
|
||||||
peach.$store('trade').$patch({
|
peach.$store('trade').$patch({
|
||||||
skus: skus.value,
|
skus: skus.value,
|
||||||
specType: formData.value.specType,
|
specType: formData.value.specType,
|
||||||
|
isSave: true,
|
||||||
})
|
})
|
||||||
peach.$router.back()
|
peach.$router.back()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -278,10 +312,10 @@ const inputPropertyValueFormdata = ref({
|
||||||
remark: '',
|
remark: '',
|
||||||
})
|
})
|
||||||
function addPropertyValueClick(item) {
|
function addPropertyValueClick(item) {
|
||||||
console.log(item)
|
|
||||||
propertyValueTitle.value = '新增'
|
propertyValueTitle.value = '新增'
|
||||||
inputPropertyValueFormdata.value.name = ''
|
inputPropertyValueFormdata.value.name = ''
|
||||||
inputPropertyValueFormdata.value.propertyId = item.id
|
inputPropertyValueFormdata.value.propertyId = item.id
|
||||||
|
inputPropertyValueFormdata.value.id = ''
|
||||||
inputPropertyValueDialogRef.value.open()
|
inputPropertyValueDialogRef.value.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,11 +330,12 @@ async function dialogInputPropertyValueConfirm(value) {
|
||||||
await GoodsApi.createPropertyValue(inputPropertyValueFormdata.value)
|
await GoodsApi.createPropertyValue(inputPropertyValueFormdata.value)
|
||||||
}
|
}
|
||||||
await getGoodsProperty()
|
await getGoodsProperty()
|
||||||
|
changeSubProperty()
|
||||||
|
|
||||||
inputPropertyValueDialogRef.value.close()
|
inputPropertyValueDialogRef.value.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
function longPropertyValuePress(item) {
|
function longPropertyValuePress(item) {
|
||||||
console.log(item)
|
|
||||||
if (canEdit.value) {
|
if (canEdit.value) {
|
||||||
// 震动提示
|
// 震动提示
|
||||||
uni.vibrateShort()
|
uni.vibrateShort()
|
||||||
|
@ -317,6 +352,7 @@ function longPropertyValuePress(item) {
|
||||||
if (res.tapIndex === 1) {
|
if (res.tapIndex === 1) {
|
||||||
await GoodsApi.delPropertyValue({ id: item.id })
|
await GoodsApi.delPropertyValue({ id: item.id })
|
||||||
await getGoodsProperty()
|
await getGoodsProperty()
|
||||||
|
changeSubProperty()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -153,7 +153,7 @@
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { onLoad, onPageScroll } from '@dcloudio/uni-app'
|
import { onLoad, onPageScroll, onShow } from '@dcloudio/uni-app'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import GoodsApi from '@/peach/api/trade/goods'
|
import GoodsApi from '@/peach/api/trade/goods'
|
||||||
import piaoyiEditor from '@/uni_modules/piaoyi-editor/components/piaoyi-editor/piaoyi-editor.vue'
|
import piaoyiEditor from '@/uni_modules/piaoyi-editor/components/piaoyi-editor/piaoyi-editor.vue'
|
||||||
|
@ -408,9 +408,6 @@ function saveContens(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
console.log('res', formData.value)
|
|
||||||
console.log('richtext', richValues.value)
|
|
||||||
|
|
||||||
formData.value.skus = peach.$store('trade').skus
|
formData.value.skus = peach.$store('trade').skus
|
||||||
|
|
||||||
formRef.value
|
formRef.value
|
||||||
|
@ -486,6 +483,21 @@ onLoad(async (options) => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
let isSave = peach.$store('trade').isSave
|
||||||
|
|
||||||
|
if (isSave) {
|
||||||
|
formData.value.skus = peach.$store('trade').skus
|
||||||
|
formData.value.specType = peach.$store('trade').specType
|
||||||
|
peach.$store('trade').isSave = false
|
||||||
|
} else {
|
||||||
|
peach.$store('trade').$patch({
|
||||||
|
skus: formData.value.skus || [],
|
||||||
|
specType: formData.value.specType,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
onPageScroll((e) => {
|
onPageScroll((e) => {
|
||||||
if (canEdit.value && e.scrollTop > 200) {
|
if (canEdit.value && e.scrollTop > 200) {
|
||||||
richReadOnly.value = false
|
richReadOnly.value = false
|
||||||
|
|
|
@ -22,11 +22,26 @@
|
||||||
|
|
||||||
<view class="money-num">{{ state.showMoney ? fen2yuan(userWallet.balance) : '*****' }}</view>
|
<view class="money-num">{{ state.showMoney ? fen2yuan(userWallet.balance) : '*****' }}</view>
|
||||||
</view>
|
</view>
|
||||||
<button class="ss-reset-button topup-btn" @tap="peach.$router.go('/pages/user/wallet/withdraw')">
|
<button class="ss-reset-button topup-btn" @tap="peach.$router.go('/pages/user/wallet/withdraw')">提现</button>
|
||||||
提现
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<pb-sticky>
|
||||||
|
<!-- 统计 -->
|
||||||
|
<view class="filter-box ss-p-x-30 ss-flex ss-col-center ss-row-between">
|
||||||
|
<uni-datetime-picker v-model="state.data" type="daterange" @change="onChangeTime" :end="state.today">
|
||||||
|
<button class="ss-reset-button date-btn">
|
||||||
|
<text>{{ dateFilterText }}</text>
|
||||||
|
<text class="cicon-drop-down ss-seldate-icon"></text>
|
||||||
</button>
|
</button>
|
||||||
|
</uni-datetime-picker>
|
||||||
|
<view class="total-box">
|
||||||
|
<view class="ss-m-b-10">总收入¥{{ fen2yuan(state.summary.totalIncome) }}</view>
|
||||||
|
<view>总支出¥{{ fen2yuan(state.summary.totalExpense) }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<pb-tabs :list="tabMaps" @change="onChange" :scrollable="false" :current="state.currentTab"></pb-tabs>
|
||||||
|
</pb-sticky>
|
||||||
|
|
||||||
<p-empty v-if="state.pagination.total === 0" :marginTop="40" text="暂无数据" icon="/static/data-empty.png" />
|
<p-empty v-if="state.pagination.total === 0" :marginTop="40" text="暂无数据" icon="/static/data-empty.png" />
|
||||||
|
|
||||||
|
@ -81,6 +96,7 @@ const bgStyle = {
|
||||||
// 数据
|
// 数据
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
showMoney: false,
|
showMoney: false,
|
||||||
|
currentTab: 0,
|
||||||
pagination: {
|
pagination: {
|
||||||
list: [],
|
list: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
|
@ -88,6 +104,35 @@ const state = reactive({
|
||||||
pageSize: 8,
|
pageSize: 8,
|
||||||
},
|
},
|
||||||
loadStatus: '',
|
loadStatus: '',
|
||||||
|
summary: {
|
||||||
|
totalIncome: 0,
|
||||||
|
totalExpense: 0,
|
||||||
|
},
|
||||||
|
today: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
const tabMaps = [
|
||||||
|
{
|
||||||
|
name: '全部',
|
||||||
|
value: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '收入',
|
||||||
|
value: '1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '支出',
|
||||||
|
value: '2',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
// 格式化时间段
|
||||||
|
const dateFilterText = computed(() => {
|
||||||
|
if (state.date[0] === state.date[1]) {
|
||||||
|
return state.date[0]
|
||||||
|
} else {
|
||||||
|
return state.date.join('~')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const userWallet = computed(() => peach.$store('user').userWallet)
|
const userWallet = computed(() => peach.$store('user').userWallet)
|
||||||
|
@ -95,19 +140,49 @@ const userWallet = computed(() => peach.$store('user').userWallet)
|
||||||
// 获得钱包记录分页
|
// 获得钱包记录分页
|
||||||
async function getLogList() {
|
async function getLogList() {
|
||||||
state.loadStatus = 'loading'
|
state.loadStatus = 'loading'
|
||||||
// const { data, code } = await PayWalletApi.getWalletTransactionPage({
|
const { data, code } = await PayWalletApi.flowList({
|
||||||
// pageNo: state.pagination.pageNo,
|
pageNo: state.pagination.pageNo,
|
||||||
// pageSize: state.pagination.pageSize,
|
pageSize: state.pagination.pageSize,
|
||||||
|
type: tabMaps[state.currentTab].value,
|
||||||
|
'createTime[0]': state.date[0] + ' 00:00:00',
|
||||||
|
'createTime[1]': state.date[1] + ' 23:59:59',
|
||||||
|
})
|
||||||
|
|
||||||
// })
|
if (code !== 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// state.pagination.list = _.concat(state.pagination.list, data.list)
|
state.pagination.list = _.concat(state.pagination.list, data.list)
|
||||||
// state.pagination.total = data.total
|
state.pagination.total = data.total
|
||||||
// state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore'
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 钱包统计
|
||||||
|
async function getStatistic() {
|
||||||
|
let res = await PayWalletApi.statistics({
|
||||||
|
createTime: [state.date[0] + ' 00:00:00', state.date[1] + ' 23:59:59'],
|
||||||
|
})
|
||||||
|
|
||||||
|
if (code !== 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
state.summary = data
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理 tab 切换
|
||||||
|
function onChange(e) {
|
||||||
|
state.currentTab = e.index
|
||||||
|
// 重新加载列表
|
||||||
|
resetPagination(state.pagination)
|
||||||
|
getLogList()
|
||||||
|
getStatistic()
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
|
state.today = dayjs().format('YYYY-MM-DD')
|
||||||
|
state.date = [state.today, state.today]
|
||||||
getLogList()
|
getLogList()
|
||||||
|
getStatistic()
|
||||||
// 刷新钱包的缓存
|
// 刷新钱包的缓存
|
||||||
// peach.$store('user').getWallet()
|
// peach.$store('user').getWallet()
|
||||||
})
|
})
|
||||||
|
@ -184,6 +259,7 @@ onReachBottom(() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.date-btn {
|
.date-btn {
|
||||||
|
width: fit-content;
|
||||||
background-color: $white;
|
background-color: $white;
|
||||||
line-height: 54rpx;
|
line-height: 54rpx;
|
||||||
border-radius: 27rpx;
|
border-radius: 27rpx;
|
||||||
|
|
|
@ -1,53 +1,97 @@
|
||||||
<template>
|
<template>
|
||||||
<pb-layout navbar="normal" class="withdraw-wrap" leftIcon="leftIcon" title="提现" :bgStyle="bgStyle">
|
<pb-layout navbar="normal" class="withdraw-wrap" leftIcon="leftIcon" title="提现" :bgStyle="bgStyle">
|
||||||
<view class="alert ss-m-x-40 ss-m-y-20">
|
<view class="alert ss-m-x-40 ss-m-y-20"> 提现至 </view>
|
||||||
提现至
|
|
||||||
</view>
|
|
||||||
<view class="method ss-m-x-40 ss-flex ss-col-center ss-row-between">
|
<view class="method ss-m-x-40 ss-flex ss-col-center ss-row-between">
|
||||||
<view class="left ss-flex ss-gap-20 ss-col-center">
|
<view class="left ss-flex ss-gap-20 ss-col-center">
|
||||||
<view class="cicon-weixin" style="color:#2f9326;font-size: 60rpx"></view>
|
<view class="cicon-weixin" style="color: #2f9326; font-size: 60rpx"></view>
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<view class="label">其选择提现方式</view>
|
<view class="label">微信</view>
|
||||||
<view class="note ss-m-t-10">立即到账</view>
|
<view class="note ss-m-t-10">极速到账</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cicon-angle m-t-40"></view>
|
<!-- <view class="cicon-angle m-t-40"></view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="detail ss-m-40 ss-p-30">
|
<view class="detail ss-m-40 ss-p-30">
|
||||||
<view class="label ss-m-b-50">提现金额</view>
|
<view class="label ss-m-b-50">提现金额</view>
|
||||||
<view class="account ss-m-t-135 ss-m-b-20 ss-flex ss-row-between">
|
<view class="account ss-m-t-15 ss-m-b-20 ss-flex ss-row-between">
|
||||||
<uni-easyinput :styles="{ backgroundColor: 'transparent' }" :clearable="false" :inputBorder="false"
|
<uni-easyinput
|
||||||
type="number" trim="all" placeholder="请输入提现金额" />
|
v-model="formData.amount"
|
||||||
<view class="all self-end">全部提现</view>
|
:styles="{ backgroundColor: 'transparent' }"
|
||||||
|
:clearable="false"
|
||||||
|
:inputBorder="false"
|
||||||
|
type="digit"
|
||||||
|
trim="all"
|
||||||
|
placeholder="请输入提现金额"
|
||||||
|
/>
|
||||||
|
<view class="all self-end" @click="allWithdraw">全部提现</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="note ss-flex ss-row-between">
|
<view class="note ss-flex ss-row-between">
|
||||||
|
<view class="last"> 最低提现金额¥{{ config?.takingRule }} </view>
|
||||||
|
<view class="can-use"> 余额¥{{ fen2yuan(remain) }} </view>
|
||||||
|
</view>
|
||||||
<view class="last">
|
<view class="last">
|
||||||
剩余额度¥{{ state.last }}
|
提现费率{{ config?.takingRate }} 即每提现 1000 元扣除手续费¥{{ 1000 * config?.takingRate }}
|
||||||
</view>
|
|
||||||
<view class="can-use">
|
|
||||||
可用额度¥{{ state.canUse }}
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="footer-box">
|
<view class="footer-box">
|
||||||
<button class="ss-reset-button draw-btn ui-Shadow-Main" @tap="onSubmit">提现</button>
|
<button class="ss-reset-button draw-btn ui-Shadow-Main" @tap="onSubmit">提现</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</pb-layout>
|
</pb-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { fen2yuan } from '@/peach/hooks/useGoods'
|
||||||
|
import peach from '@/peach'
|
||||||
|
import WalletApi from '@/peach/api/pay/wallet'
|
||||||
|
|
||||||
const bgStyle = {
|
const bgStyle = {
|
||||||
backgroundColor: '#fff',
|
backgroundColor: '#fff',
|
||||||
description: '',
|
description: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
const state = ref({
|
const config = ref(null)
|
||||||
last: 1000,
|
|
||||||
canUse: 10000
|
const userStore = peach.$store('user')
|
||||||
|
|
||||||
|
const remain = computed(() => {
|
||||||
|
return userStore.userWallet?.balance
|
||||||
|
})
|
||||||
|
|
||||||
|
const formData = ref({
|
||||||
|
amount: 0,
|
||||||
|
})
|
||||||
|
|
||||||
|
async function getWithdrawConfig() {
|
||||||
|
let res = await WalletApi.withdrawConfig()
|
||||||
|
config.value = res.data
|
||||||
|
}
|
||||||
|
|
||||||
|
function allWithdraw() {
|
||||||
|
formData.value.amount = fen2yuan(remain.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onSubmit() {
|
||||||
|
if (!formData.value.amount || formData.value.amount <= 0) {
|
||||||
|
peach.$helper.toast('请输入正确的金额')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await WalletApi.withdraw({
|
||||||
|
amount: formData.value.amount * 100,
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
peach.$router.back()
|
||||||
|
}, 1000)
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoad(() => {
|
||||||
|
getWithdrawConfig()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -63,14 +107,14 @@ const state = ref({
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
|
|
||||||
.note {
|
.note {
|
||||||
color: #b5b5b5
|
color: #b5b5b5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail {
|
.detail {
|
||||||
background-color: rgba(236, 236, 236, .3);
|
background-color: rgba(236, 236, 236, 0.3);
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
|
@ -79,7 +123,6 @@ const state = ref({
|
||||||
}
|
}
|
||||||
|
|
||||||
.account {
|
.account {
|
||||||
|
|
||||||
:deep(.uni-easyinput__content-input) {
|
:deep(.uni-easyinput__content-input) {
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +138,7 @@ const state = ref({
|
||||||
.account::before {
|
.account::before {
|
||||||
content: '¥';
|
content: '¥';
|
||||||
font-size: 48rpx;
|
font-size: 48rpx;
|
||||||
color: #333
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.note {
|
.note {
|
||||||
|
@ -103,7 +146,16 @@ const state = ref({
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.last {
|
||||||
|
color: #a3a3a3;
|
||||||
|
font-size: 26rpx;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.can-use {
|
||||||
|
color: #333;
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer-box {
|
.footer-box {
|
||||||
|
|
|
@ -1,7 +1,46 @@
|
||||||
import request from "@/peach/request";
|
import request from '@/peach/request'
|
||||||
|
|
||||||
const PayWalletApi = {
|
const PayWalletApi = {
|
||||||
getWalletTransactionPage: () => {},
|
// 提现余额
|
||||||
};
|
withdraw: (data) => {
|
||||||
|
return request({
|
||||||
|
url: '/pay/wallet/withdraw',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
custom: {
|
||||||
|
showSuccess: true,
|
||||||
|
successMsg: '提现成功',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
export default PayWalletApi;
|
// 提现配置信息
|
||||||
|
withdrawConfig: () => {
|
||||||
|
return request({
|
||||||
|
url: '/shop/particulars-config/get',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 钱包流水记录
|
||||||
|
flowList: (params) => {
|
||||||
|
const queryString = Object.keys(params)
|
||||||
|
.map((key) => encodeURIComponent(key) + '=' + params[key])
|
||||||
|
.join('&')
|
||||||
|
return request({
|
||||||
|
url: `/pay/wallet-transaction/page?${queryString}`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 钱包统计
|
||||||
|
statistics: (params) => {
|
||||||
|
const queryString = `createTime=${params.createTime[0]}&createTime=${params.createTime[1]}`
|
||||||
|
return request({
|
||||||
|
url: `/pay/wallet-transaction/get-summary?${queryString}`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PayWalletApi
|
||||||
|
|
|
@ -107,7 +107,7 @@ const GoodsApi = {
|
||||||
// 创建商品属性值
|
// 创建商品属性值
|
||||||
createPropertyValue: (data) => {
|
createPropertyValue: (data) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/property/value/create',
|
url: '/product/property/value/create',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data,
|
data,
|
||||||
custom: {
|
custom: {
|
||||||
|
@ -118,7 +118,7 @@ const GoodsApi = {
|
||||||
// 删除商品属性值
|
// 删除商品属性值
|
||||||
delPropertyValue: (data) => {
|
delPropertyValue: (data) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/property/value/delete',
|
url: '/product/property/value/delete',
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
params: data,
|
params: data,
|
||||||
custom: {
|
custom: {
|
||||||
|
@ -129,7 +129,7 @@ const GoodsApi = {
|
||||||
// 修改商品属性值
|
// 修改商品属性值
|
||||||
editPropertyValue: (data) => {
|
editPropertyValue: (data) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/property/value/update',
|
url: '/product/property/value/update',
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data,
|
data,
|
||||||
custom: {
|
custom: {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
v-if="goodsFields.subtitle?.show || goodsFields.introduction?.show"
|
v-if="goodsFields.subtitle?.show || goodsFields.introduction?.show"
|
||||||
class="lg-goods-subtitle ss-m-t-10 ss-line-1"
|
class="lg-goods-subtitle ss-m-t-10 ss-line-3"
|
||||||
:style="[{ color: subTitleColor, background: subTitleBackground }]"
|
:style="[{ color: subTitleColor, background: subTitleBackground }]"
|
||||||
>
|
>
|
||||||
{{ data.subtitle || data.introduction }}
|
{{ data.subtitle || data.introduction }}
|
||||||
|
|
|
@ -11,6 +11,9 @@ const useTradeStore = defineStore('trade', () => {
|
||||||
// 详情标记
|
// 详情标记
|
||||||
const detailTag = ref('edit')
|
const detailTag = ref('edit')
|
||||||
|
|
||||||
|
// 是否触发保存操作
|
||||||
|
const isSave = ref(false)
|
||||||
|
|
||||||
// 规格类型,默认单规格
|
// 规格类型,默认单规格
|
||||||
const specType = ref(false)
|
const specType = ref(false)
|
||||||
|
|
||||||
|
@ -27,6 +30,7 @@ const useTradeStore = defineStore('trade', () => {
|
||||||
canEdit,
|
canEdit,
|
||||||
detailTag,
|
detailTag,
|
||||||
specType,
|
specType,
|
||||||
|
isSave,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue