合并代码

This commit is contained in:
sx 2025-01-23 00:57:47 +08:00
parent 204261ac3c
commit ec7d686245
8 changed files with 322 additions and 182 deletions

View File

@ -5,7 +5,8 @@ const config = {
host: 'http://localhost:5173',
// #endif
// #ifndef H5
host: 'http://2h34ni.natappfree.cc',
// host: 'http://91f.xyz:8080',
host: 'http://ugcege.natappfree.cc',
// #endif
// 支付方式配置
payType: {

View File

@ -521,8 +521,8 @@
<!-- 操作台 -->
<view class="operate f1">
<!-- 留言 -->
<view class="item fmid" @click="handleData">
<!-- 数据中心 -->
<view class="item fmid" @click="handleData" v-if="0">
<view class="col">
<image class="wh50" src="/static/statistic.png" mode="aspectFit" />
</view>

View File

@ -1,5 +1,7 @@
<script setup>
//
/**
* 下单组件
*/
import {
ref,
reactive,
@ -8,11 +10,14 @@
defineEmits,
onMounted,
defineProps,
defineExpose
} from 'vue'
//
import util from '@/common/js/util.js'
//
import api from '@/api/index.js'
//
import JyCommodityAddress from '@/components/public/jy-commodity-address'
const {
proxy
@ -24,13 +29,24 @@
type: Object,
default: () => ({})
},
// detail collect
mode: {
type: String,
default: 'detail'
},
})
//
const emit = defineEmits(['confirm'])
//
const address = reactive({})
//
const spaceIndex = ref(0)
//
const spaceIndexLast = ref(0)
//
const payNum = ref(1)
//
const payNumLast = ref(1)
//
const currentSpec = computed(() => {
let spec = props.detail.specs || []
@ -45,7 +61,7 @@
onMounted(() => {
//
getDefaultAddress()
if (props.mode === 'detail') getDefaultAddress()
})
//
@ -79,13 +95,70 @@
function handleSpec(index) {
if (spaceIndex.value !== index) spaceIndex.value = index
}
/**
* 打开弹窗
* @param {Object} event 携带参数
*/
function open(event) {
//
if (event) {
spaceIndex.value = event.spaceIndex || 0
payNum.value = event.payNum || 1
}
//
proxy.$refs.payment.open()
}
//
function close() {
proxy.$refs.payment.close()
}
//
function handleConfirm() {
//
if (props.mode == 'detail' && !address.id) {
util.alert('请选择收货地址')
return
}
emit('confirm', {
spec: currentSpec.value,
spaceIndex: spaceIndex.value,
payNum: payNum.value,
})
//
spaceIndexLast.value = spaceIndex.value
payNumLast.value = payNum.value
//
close()
}
/**
* 弹窗状态改变
* @param {Object} ev
*/
function handlePopChange(ev) {
//
if (!ev.show) {
spaceIndex.value = spaceIndexLast.value
payNum.value = payNumLast.value
}
}
defineExpose({
open,
close,
})
</script>
<template>
<!-- 规格 -->
<uni-popup type="bottom" ref="payment">
<uni-popup type="bottom" ref="payment" @change="handlePopChange">
<view class="buy popBot plr20 bfff">
<view class="address mtb40">
<view class="address mtb40" v-if="mode === 'detail'">
<template v-if="address.id">
<JyCommodityAddress :address="address" />
</template>
@ -131,12 +204,50 @@
</view>
</view>
<view class="btn lg primary mtb30" @click="handlePay">
<text class="cfff">立即下单 {{total}}</text>
<view class="btn lg primary mtb30" @click="handleConfirm">
<text class="cfff" v-if="mode == 'detail'">立即下单 {{total}}</text>
<text class="cfff" v-if="mode == 'collect'">确定</text>
</view>
</view>
</uni-popup>
</template>
<style>
<style lang="scss" scoped>
//
.spec {
//
.option {
padding: 5rpx 15rpx;
background-color: #F7F7F7;
border-radius: 10rpx;
transition: .3s;
border: 2rpx solid #F7F7F7;
.txt {
color: #333;
font-size: 26rpx;
transition: .3s;
}
//
&.active {
background-color: #FFFBF8;
border-color: #FF9B27;
.txt {
color: #FF9B27;
}
}
//
&.disabled {
background-color: F7F7F7;
.txt {
color: #999;
}
}
}
}
</style>

View File

@ -69,7 +69,7 @@
<view class="userinfo rows">
<!-- 左头像 右昵称 收获地址 -->
<image class="avatar wh130 cir" :src="userinfo.userPortrait" mode="aspectFill" />
<image class="avatar wh130 cir" :src="userinfo.avatar" mode="aspectFill" />
<view class="info f1 mlr30">
<view class="nickname f34">{{ userinfo.userNickname }}</view>
<view class="address df aic mt15 f28 c666" @click="link('/pages/mine/address/index')">
@ -90,7 +90,7 @@
</view>
<!-- 我的钱包 -->
<view class="wallet rows mtb10 mlr20 ptb20 plr20 bfff br20" @click="link('/pages/index/wallet')">
<view class="wallet rows mtb10 mlr20 ptb20 plr20 bfff br20" @click="link('/pages/index/wallet/wallet')">
<!-- 左边 -->
<image class="wh80" src="@/static/mine-wallet.png" mode="aspectFill" />
<view class="mlr20 f1 f36 c333">我的钱包</view>

View File

@ -4,6 +4,8 @@
import {
ref,
reactive,
computed,
getCurrentInstance,
} from 'vue';
import apex from '@/components/header/apex'
import {
@ -17,12 +19,46 @@
import api from '@/api/index.js';
// util
import util from '@/common/js/util';
//
import makeOrder from '@/components/shop/detail/makeOrder.vue'
const {
proxy
} = getCurrentInstance()
//
const setting = ref(false)
//
const listCurrent = reactive([0, 0])
//
const list = reactive({
data: [],
})
//
const selectList = computed(() => {
let result = []
list.data.map(item => {
result.push(...item.shopifyProductInfos.filter(secItem => secItem.selected))
})
return result
})
//
const totalPrice = computed(() => {
return selectList.value.reduce((last, current) => {
return last + current.price * current.payNum
}, 0)
})
//
const productCurrent = computed({
get() {
let result = {}
if (list.data[listCurrent[0]]) result = list.data[listCurrent[0]].shopifyProductInfos[listCurrent[
1]]
return result
},
set(val) {
list.data[listCurrent[0]].shopifyProductInfos[listCurrent[1]] = val
}
})
onLoad(() => {
//
@ -32,9 +68,25 @@
//
function getList() {
api.shop.getCollectList({}).then(res => {
console.log(res)
if (res.code == 200) {
list.data = res.data
//
list.data = res.data.map(item => {
//
item.shopifyProductInfos = item.shopifyProductInfos.map(secItem => {
//
secItem.formatSliderImage = secItem.sliderImage.split(',')[0]
//
secItem.payNum = 1
//
secItem.spaceIndex = 0
//
secItem.spec = secItem.specs[secItem.spaceIndex] || {}
//
secItem.selected = false
return secItem
})
return item
})
return
}
util.alert({
@ -46,10 +98,84 @@
/**
* 规格选择
* @param {Object} secItem
* @param {Object} index
* @param {Object} secIndex
*/
function handleSpec(secItem) {
//
function handleSpec(index, secIndex) {
Object.assign(listCurrent, [index, secIndex])
proxy.$refs.makeOrderRef.open({
spaceIndex: productCurrent.value.spaceIndex,
payNum: productCurrent.value.payNum,
})
}
/**
* 选择规格和数量
* @param {Object} event
*/
function handleMakeConfirm(event) {
productCurrent.value.payNum = event.payNum
productCurrent.value.spec = event.spec
productCurrent.value.spaceIndex = event.spaceIndex
}
/**
* 商品的选中
* @param {Object} index 商家下标
* @param {Object} secIndex 商品下标
*/
function handleSelect(index, secIndex) {
const item = list.data[index].shopifyProductInfos[secIndex]
item.selected = !item.selected
}
//
function handleCancelCollect() {
console.log('data', selectList.value, list.data)
}
//
function handleSubmit() {
console.log('data', selectList.value, list.data)
//
if (selectList.value.length == 0) {
util.alert('请选择商品')
return
}
let data = selectList.value.map(item => {
return {
// id
productId: item.id,
// id
attrValueId: item.spec.id,
//
payNum: item.payNum,
// 0-1-
orderType: 0,
}
})
console.log('request data', data)
//
api.shop.addOrder({
data,
}).then(rs => {
if (rs.code === 200) {
//
if (rs.data && rs.data[0]) uni.navigateTo({
url: util.setUrl('/pages/shop/commodity/payment', {
orderId: rs.data[0].orderId,
})
})
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
</script>
@ -65,36 +191,36 @@
</apex>
<view class="list">
<view class="item oh mb20 plr30 bfff" v-for="(item,index) in list.data" :key="index">
<view class="item oh mb20 plr30 bfff" v-for="(item,index) in list.data" :key="item.id">
<!-- 店铺 -->
<view class="store line df aic ptb20 thd f1 f28">
<image class="wh50 br10" :src="item.rectangleLogo"
mode="aspectFill" />
<image class="wh50 br10" :src="item.rectangleLogo" mode="aspectFill" />
<view class="name ml10 c333">{{item.name}}</view>
</view>
<!-- 商品信息 -->
<view class="product line df ptb20" v-for="(secItem,secIndex) in item.shopifyProductInfos" :key="secIndex">
<view class="fmid mr10">
<template v-if="index == 0">
<uni-icons type="circle" size="40rpx" color="#aaa" />
<view class="product line df ptb20" v-for="(secItem,secIndex) in item.shopifyProductInfos"
:key="secItem.id">
<view class="fmid mr10" @click="handleSelect(index,secIndex)">
<template v-if="secItem.selected">
<uni-icons type="checkbox-filled" size="40rpx" color="#F8BA4D" />
</template>
<template v-else>
<uni-icons type="checkbox-filled" size="40rpx" color="#F8BA4D" />
<uni-icons type="circle" size="40rpx" color="#aaa" />
</template>
</view>
<view class="poster wh160">
<image class="wh160 br10"
:src="secItem.sliderImage.split(',')[0]"
mode="aspectFill" />
<image class="wh160 br10" :src="secItem.formatSliderImage" mode="aspectFill" />
</view>
<view class="info oh df fdc jcsb f1 ml20">
<view class="name thd c333 f28">{{item.name}}</view>
<view class="spec line df thd mtb10 ptb10 plr10 df aic c666 f24 br10" @click="handleSpec(secItem)">
<text>已选规格 升级款/小熊</text>
<view class="spec line df aic thd mtb10 ptb10 plr10 df aic c666 f24 br10"
@click="handleSpec(index,secIndex)">
<view class="thd f1">已选规格 {{secItem.spec.sku}}</view>
<view class="">x{{secItem.payNum}}</view>
</view>
<view class="other df aic">
@ -112,17 +238,22 @@
<view class="fill" style="height: 180rpx;"></view>
<view class="footer rows plr30 bfff shadow">
<view class="c999 f26">已选择9</view>
<view class="col df aic">
<view class="total mr20" v-if="!setting">
<view class="c999 f26">已选择{{selectList.length}}</view>
<view class="col df aic" v-if="!setting">
<view class="total mr20">
<text class="c333 f20">合计</text>
<text class="cFF9B27 f20"></text>
<text class="cFF9B27 f46">98</text>
<text class="cFF9B27 f46">{{totalPrice}}</text>
</view>
<view class="btn primary w200">去结算</view>
<view class="btn primary w200" @click="handleSubmit">去结算</view>
</view>
<view class="btn primary w200" @click="handleCancelCollect" v-else>取消收藏</view>
</view>
</view>
<!-- 立即支付 -->
<makeOrder ref="makeOrderRef" mode="collect" :detail="productCurrent" @confirm="handleMakeConfirm" />
</template>
<style lang="scss" scoped>

View File

@ -12,13 +12,12 @@
import util from '@/common/js/util.js'
//
import api from '@/api/index.js'
//
import JyCommodityAddress from '@/components/public/jy-commodity-address'
//
import {
useStore
} from 'vuex'
//
import makeOrder from '@/components/shop/detail/makeOrder.vue'
const {
proxy
@ -33,8 +32,6 @@
default: () => ({})
},
})
//
const address = reactive({})
//
const emit = defineEmits(['update'])
//
@ -70,25 +67,6 @@
}
}
onMounted(() => {
//
getDefaultAddress()
})
//
function getDefaultAddress() {
api.shop.getDefaultAddress({}).then(res => {
if (res.code === 200) {
if (res.data) Object.assign(address, {}, res.data)
return
}
util.alert({
content: res.msg,
showCancel: false,
})
})
}
/**
* 跳转
* @param {Object} url 跳转路径
@ -99,14 +77,6 @@
})
}
/**
* 选择规格
* @param {Object} index 选择规格下标
*/
function handleSpec(index) {
if (spaceIndex.value !== index) spaceIndex.value = index
}
//
function handleCollect() {
//
@ -136,14 +106,10 @@
})
}
//
function handlePay() {
//
if (!address.id) {
util.alert('请选择收货地址')
return
}
/**
* 立即下单
*/
function handlePay(event) {
//
api.shop.addOrder({
data: [{
@ -152,9 +118,9 @@
// id
productId: props.detail.id,
// id
attrValueId: currentSpec.value.id,
attrValueId: event.spec.id,
//
payNum: payNum.value,
payNum: event.payNum,
// 0-1-
orderType: 0,
// id
@ -162,13 +128,12 @@
}],
}).then(rs => {
if (rs.code === 200) {
if (rs.data && rs.data[0])
//
uni.navigateTo({
url: util.setUrl('/pages/shop/commodity/payment', {
orderId: rs.data[0].orderId,
})
//
if (rs.data && rs.data[0]) uni.navigateTo({
url: util.setUrl('/pages/shop/commodity/payment', {
orderId: rs.data[0].orderId,
})
})
return
}
util.alert({
@ -209,65 +174,13 @@
</view>
<!-- 下单 -->
<view class="btn lg primary f1 ml30" @click="$refs.payment.open()">
<view class="btn lg primary f1 ml30" @click="$refs.makeOrderRef.open()">
<text>立即购买</text>
</view>
<!-- 立即支付 -->
<makeOrder ref="makeOrderRef" :detail="detail" @confirm="handlePay" />
</view>
<!-- 规格 -->
<uni-popup type="bottom" ref="payment">
<view class="buy popBot plr20 bfff">
<view class="address mtb40">
<template v-if="address.id">
<JyCommodityAddress :address="address" />
</template>
<template v-else>
<view class="fmid c999 f28" @click="link('/pages/mine/address/index?select=1')">
<view>暂无默认地址</view>
<uni-icons type="right" color="#999" size="30rpx" />
</view>
</template>
</view>
<!-- 商品图 价格 明细 数量 -->
<view class="jy-card-commodity-content df mtb40">
<!-- 商品图 -->
<image class="wh200 br10" :src="currentSpec.image" mode="aspectFill" />
<!-- 价格 明细 数量 -->
<view class="info f1 df fdc jcsb ml30">
<!-- 价格 -->
<view class="content-info-price">
<text class="cFF9B27 f28">单价</text>
<text class="cFF9B27 f24"></text>
<text class="cFF9B27 f50">{{detail.price}}</text>
</view>
<!-- 已选 -->
<view class="content-info-num">
<text class="f26 c333">已选 {{currentSpec.sku}}</text>
</view>
<!-- 计数器 -->
<view class="w200">
<uni-number-box v-model="payNum" :step="1" />
</view>
</view>
</view>
<!-- 规格 -->
<view class="spec">
<view class="selection df">
<!-- disabled 销量为零不能选 -->
<view class="option mtb20 mr20" :class="{'active': spaceIndex === index}"
v-for="(item,index) in detail.specs" :key="index" @click="handleSpec(index)">
<text class="txt">{{item.sku}}</text>
</view>
</view>
</view>
<view class="btn lg primary mtb30" @click="handlePay">
<text class="cfff">立即下单 {{total}}</text>
</view>
</view>
</uni-popup>
</template>
<style scoped lang="scss">
@ -279,42 +192,4 @@
width: 80rpx;
}
}
//
.spec {
//
.option {
padding: 5rpx 15rpx;
background-color: #F7F7F7;
border-radius: 10rpx;
transition: .3s;
border: 2rpx solid #F7F7F7;
.txt {
color: #333;
font-size: 26rpx;
transition: .3s;
}
//
&.active {
background-color: #FFFBF8;
border-color: #FF9B27;
.txt {
color: #FF9B27;
}
}
//
&.disabled {
background-color: F7F7F7;
.txt {
color: #999;
}
}
}
}
</style>

View File

@ -387,3 +387,25 @@ likeType
9已取消
收藏 改成只能查看列表
金额显示的状态和商家同步
买家进行付款之后 卖家显示是待结算
分润相关的人显示待结算
买家进行确认收货 这笔钱显示待入账
分润相关的人显示待入账
7天无理由结束后 这笔钱进入到了商家可提现的钱包中 分润相关人员入账
聊天界面的卡片展示fee
1. 会员确认收货、售后、商家进行售后
会员发起售后
会员没有收货 只能仅退款
商家确认收货 完成退货流程
已收货之后 只能退货退款
商家进行审核
会员填写物流信息 商家进行确认 完成退货退款
2. 收藏分享佣金
3. 钱包明细

View File

@ -4,8 +4,8 @@ import {
import uni from '@dcloudio/vite-plugin-uni';
//
// let target = 'http://101.35.80.139:8080'
let target = 'http://8ii5rt.natappfree.cc'
// let target = 'http://91f.xyz:8080'
let target = 'http://ugcege.natappfree.cc'
export default defineConfig({
plugins: [uni()],