合并代码
This commit is contained in:
parent
204261ac3c
commit
ec7d686245
|
@ -5,7 +5,8 @@ const config = {
|
||||||
host: 'http://localhost:5173',
|
host: 'http://localhost:5173',
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef H5
|
// #ifndef H5
|
||||||
host: 'http://2h34ni.natappfree.cc',
|
// host: 'http://91f.xyz:8080',
|
||||||
|
host: 'http://ugcege.natappfree.cc',
|
||||||
// #endif
|
// #endif
|
||||||
// 支付方式配置
|
// 支付方式配置
|
||||||
payType: {
|
payType: {
|
||||||
|
|
|
@ -521,8 +521,8 @@
|
||||||
|
|
||||||
<!-- 操作台 -->
|
<!-- 操作台 -->
|
||||||
<view class="operate f1">
|
<view class="operate f1">
|
||||||
<!-- 留言 -->
|
<!-- 数据中心 -->
|
||||||
<view class="item fmid" @click="handleData">
|
<view class="item fmid" @click="handleData" v-if="0">
|
||||||
<view class="col">
|
<view class="col">
|
||||||
<image class="wh50" src="/static/statistic.png" mode="aspectFit" />
|
<image class="wh50" src="/static/statistic.png" mode="aspectFit" />
|
||||||
</view>
|
</view>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
//
|
/**
|
||||||
|
* 下单组件
|
||||||
|
*/
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
reactive,
|
reactive,
|
||||||
|
@ -8,11 +10,14 @@
|
||||||
defineEmits,
|
defineEmits,
|
||||||
onMounted,
|
onMounted,
|
||||||
defineProps,
|
defineProps,
|
||||||
|
defineExpose
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
//
|
//
|
||||||
import util from '@/common/js/util.js'
|
import util from '@/common/js/util.js'
|
||||||
//
|
//
|
||||||
import api from '@/api/index.js'
|
import api from '@/api/index.js'
|
||||||
|
// 地址
|
||||||
|
import JyCommodityAddress from '@/components/public/jy-commodity-address'
|
||||||
|
|
||||||
const {
|
const {
|
||||||
proxy
|
proxy
|
||||||
|
@ -24,13 +29,24 @@
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({})
|
default: () => ({})
|
||||||
},
|
},
|
||||||
|
// 模式 detail详情 collect收藏列表
|
||||||
|
mode: {
|
||||||
|
type: String,
|
||||||
|
default: 'detail'
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
// 提交
|
||||||
|
const emit = defineEmits(['confirm'])
|
||||||
// 地址
|
// 地址
|
||||||
const address = reactive({})
|
const address = reactive({})
|
||||||
// 已选择的规格下标
|
// 已选择的规格下标
|
||||||
const spaceIndex = ref(0)
|
const spaceIndex = ref(0)
|
||||||
|
// 上次选择的规格下标
|
||||||
|
const spaceIndexLast = ref(0)
|
||||||
// 数量
|
// 数量
|
||||||
const payNum = ref(1)
|
const payNum = ref(1)
|
||||||
|
// 上次数量
|
||||||
|
const payNumLast = ref(1)
|
||||||
// 当前选择的规格
|
// 当前选择的规格
|
||||||
const currentSpec = computed(() => {
|
const currentSpec = computed(() => {
|
||||||
let spec = props.detail.specs || []
|
let spec = props.detail.specs || []
|
||||||
|
@ -45,7 +61,7 @@
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 获取默认收货地址
|
// 获取默认收货地址
|
||||||
getDefaultAddress()
|
if (props.mode === 'detail') getDefaultAddress()
|
||||||
})
|
})
|
||||||
|
|
||||||
// 获取默认收货地址
|
// 获取默认收货地址
|
||||||
|
@ -79,13 +95,70 @@
|
||||||
function handleSpec(index) {
|
function handleSpec(index) {
|
||||||
if (spaceIndex.value !== index) spaceIndex.value = 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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<!-- 规格 -->
|
<!-- 规格 -->
|
||||||
<uni-popup type="bottom" ref="payment">
|
<uni-popup type="bottom" ref="payment" @change="handlePopChange">
|
||||||
<view class="buy popBot plr20 bfff">
|
<view class="buy popBot plr20 bfff">
|
||||||
<view class="address mtb40">
|
<view class="address mtb40" v-if="mode === 'detail'">
|
||||||
<template v-if="address.id">
|
<template v-if="address.id">
|
||||||
<JyCommodityAddress :address="address" />
|
<JyCommodityAddress :address="address" />
|
||||||
</template>
|
</template>
|
||||||
|
@ -131,12 +204,50 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="btn lg primary mtb30" @click="handlePay">
|
<view class="btn lg primary mtb30" @click="handleConfirm">
|
||||||
<text class="cfff">立即下单 ¥{{total}}</text>
|
<text class="cfff" v-if="mode == 'detail'">立即下单 ¥{{total}}</text>
|
||||||
|
<text class="cfff" v-if="mode == 'collect'">确定</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
</template>
|
</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>
|
</style>
|
|
@ -69,7 +69,7 @@
|
||||||
|
|
||||||
<view class="userinfo rows">
|
<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="info f1 mlr30">
|
||||||
<view class="nickname f34">{{ userinfo.userNickname }}</view>
|
<view class="nickname f34">{{ userinfo.userNickname }}</view>
|
||||||
<view class="address df aic mt15 f28 c666" @click="link('/pages/mine/address/index')">
|
<view class="address df aic mt15 f28 c666" @click="link('/pages/mine/address/index')">
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
</view>
|
</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" />
|
<image class="wh80" src="@/static/mine-wallet.png" mode="aspectFill" />
|
||||||
<view class="mlr20 f1 f36 c333">我的钱包</view>
|
<view class="mlr20 f1 f36 c333">我的钱包</view>
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
reactive,
|
reactive,
|
||||||
|
computed,
|
||||||
|
getCurrentInstance,
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import apex from '@/components/header/apex'
|
import apex from '@/components/header/apex'
|
||||||
import {
|
import {
|
||||||
|
@ -17,12 +19,46 @@
|
||||||
import api from '@/api/index.js';
|
import api from '@/api/index.js';
|
||||||
// util
|
// util
|
||||||
import util from '@/common/js/util';
|
import util from '@/common/js/util';
|
||||||
|
// 生成订单
|
||||||
|
import makeOrder from '@/components/shop/detail/makeOrder.vue'
|
||||||
|
|
||||||
|
const {
|
||||||
|
proxy
|
||||||
|
} = getCurrentInstance()
|
||||||
//
|
//
|
||||||
const setting = ref(false)
|
const setting = ref(false)
|
||||||
|
// 当前操作的收藏下标
|
||||||
|
const listCurrent = reactive([0, 0])
|
||||||
// 收藏列表
|
// 收藏列表
|
||||||
const list = reactive({
|
const list = reactive({
|
||||||
data: [],
|
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(() => {
|
onLoad(() => {
|
||||||
// 获取列表
|
// 获取列表
|
||||||
|
@ -32,9 +68,25 @@
|
||||||
// 获取列表
|
// 获取列表
|
||||||
function getList() {
|
function getList() {
|
||||||
api.shop.getCollectList({}).then(res => {
|
api.shop.getCollectList({}).then(res => {
|
||||||
console.log(res)
|
|
||||||
if (res.code == 200) {
|
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
|
return
|
||||||
}
|
}
|
||||||
util.alert({
|
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>
|
</script>
|
||||||
|
|
||||||
|
@ -65,36 +191,36 @@
|
||||||
</apex>
|
</apex>
|
||||||
|
|
||||||
<view class="list">
|
<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">
|
<view class="store line df aic ptb20 thd f1 f28">
|
||||||
<image class="wh50 br10" :src="item.rectangleLogo"
|
<image class="wh50 br10" :src="item.rectangleLogo" mode="aspectFill" />
|
||||||
mode="aspectFill" />
|
|
||||||
<view class="name ml10 c333">{{item.name}}</view>
|
<view class="name ml10 c333">{{item.name}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 商品信息 -->
|
<!-- 商品信息 -->
|
||||||
<view class="product line df ptb20" v-for="(secItem,secIndex) in item.shopifyProductInfos" :key="secIndex">
|
<view class="product line df ptb20" v-for="(secItem,secIndex) in item.shopifyProductInfos"
|
||||||
<view class="fmid mr10">
|
:key="secItem.id">
|
||||||
<template v-if="index == 0">
|
<view class="fmid mr10" @click="handleSelect(index,secIndex)">
|
||||||
<uni-icons type="circle" size="40rpx" color="#aaa" />
|
<template v-if="secItem.selected">
|
||||||
|
<uni-icons type="checkbox-filled" size="40rpx" color="#F8BA4D" />
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<uni-icons type="checkbox-filled" size="40rpx" color="#F8BA4D" />
|
<uni-icons type="circle" size="40rpx" color="#aaa" />
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="poster wh160">
|
<view class="poster wh160">
|
||||||
<image class="wh160 br10"
|
<image class="wh160 br10" :src="secItem.formatSliderImage" mode="aspectFill" />
|
||||||
:src="secItem.sliderImage.split(',')[0]"
|
|
||||||
mode="aspectFill" />
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="info oh df fdc jcsb f1 ml20">
|
<view class="info oh df fdc jcsb f1 ml20">
|
||||||
<view class="name thd c333 f28">{{item.name}}</view>
|
<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)">
|
<view class="spec line df aic thd mtb10 ptb10 plr10 df aic c666 f24 br10"
|
||||||
<text>已选规格: 升级款/小熊</text>
|
@click="handleSpec(index,secIndex)">
|
||||||
|
<view class="thd f1">已选规格: {{secItem.spec.sku}}</view>
|
||||||
|
<view class="">x{{secItem.payNum}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="other df aic">
|
<view class="other df aic">
|
||||||
|
@ -112,17 +238,22 @@
|
||||||
<view class="fill" style="height: 180rpx;"></view>
|
<view class="fill" style="height: 180rpx;"></view>
|
||||||
|
|
||||||
<view class="footer rows plr30 bfff shadow">
|
<view class="footer rows plr30 bfff shadow">
|
||||||
<view class="c999 f26">已选择9款</view>
|
<view class="c999 f26">已选择{{selectList.length}}款</view>
|
||||||
<view class="col df aic">
|
<view class="col df aic" v-if="!setting">
|
||||||
<view class="total mr20" v-if="!setting">
|
<view class="total mr20">
|
||||||
<text class="c333 f20">合计</text>
|
<text class="c333 f20">合计</text>
|
||||||
<text class="cFF9B27 f20">¥</text>
|
<text class="cFF9B27 f20">¥</text>
|
||||||
<text class="cFF9B27 f46">98</text>
|
<text class="cFF9B27 f46">{{totalPrice}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn primary w200">去结算</view>
|
<view class="btn primary w200" @click="handleSubmit">去结算</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="btn primary w200" @click="handleCancelCollect" v-else>取消收藏</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 立即支付 -->
|
||||||
|
<makeOrder ref="makeOrderRef" mode="collect" :detail="productCurrent" @confirm="handleMakeConfirm" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -12,13 +12,12 @@
|
||||||
import util from '@/common/js/util.js'
|
import util from '@/common/js/util.js'
|
||||||
//
|
//
|
||||||
import api from '@/api/index.js'
|
import api from '@/api/index.js'
|
||||||
|
|
||||||
// 地址
|
|
||||||
import JyCommodityAddress from '@/components/public/jy-commodity-address'
|
|
||||||
//
|
//
|
||||||
import {
|
import {
|
||||||
useStore
|
useStore
|
||||||
} from 'vuex'
|
} from 'vuex'
|
||||||
|
// 生成订单
|
||||||
|
import makeOrder from '@/components/shop/detail/makeOrder.vue'
|
||||||
|
|
||||||
const {
|
const {
|
||||||
proxy
|
proxy
|
||||||
|
@ -33,8 +32,6 @@
|
||||||
default: () => ({})
|
default: () => ({})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// 地址
|
|
||||||
const address = reactive({})
|
|
||||||
//
|
//
|
||||||
const emit = defineEmits(['update'])
|
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 跳转路径
|
* @param {Object} url 跳转路径
|
||||||
|
@ -99,14 +77,6 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 选择规格
|
|
||||||
* @param {Object} index 选择规格下标
|
|
||||||
*/
|
|
||||||
function handleSpec(index) {
|
|
||||||
if (spaceIndex.value !== index) spaceIndex.value = index
|
|
||||||
}
|
|
||||||
|
|
||||||
// 切换收藏
|
// 切换收藏
|
||||||
function handleCollect() {
|
function handleCollect() {
|
||||||
//
|
//
|
||||||
|
@ -136,14 +106,10 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 立即下单
|
/**
|
||||||
function handlePay() {
|
* 立即下单
|
||||||
// 验证必填项
|
*/
|
||||||
if (!address.id) {
|
function handlePay(event) {
|
||||||
util.alert('请选择收货地址')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 产生待付款订单
|
// 产生待付款订单
|
||||||
api.shop.addOrder({
|
api.shop.addOrder({
|
||||||
data: [{
|
data: [{
|
||||||
|
@ -152,9 +118,9 @@
|
||||||
// 产品id
|
// 产品id
|
||||||
productId: props.detail.id,
|
productId: props.detail.id,
|
||||||
// 规格id
|
// 规格id
|
||||||
attrValueId: currentSpec.value.id,
|
attrValueId: event.spec.id,
|
||||||
// 数量
|
// 数量
|
||||||
payNum: payNum.value,
|
payNum: event.payNum,
|
||||||
// 0-普通订单,1-视频号订单
|
// 0-普通订单,1-视频号订单
|
||||||
orderType: 0,
|
orderType: 0,
|
||||||
// 分享人id
|
// 分享人id
|
||||||
|
@ -162,13 +128,12 @@
|
||||||
}],
|
}],
|
||||||
}).then(rs => {
|
}).then(rs => {
|
||||||
if (rs.code === 200) {
|
if (rs.code === 200) {
|
||||||
if (rs.data && rs.data[0])
|
// 跳转
|
||||||
// 跳转
|
if (rs.data && rs.data[0]) uni.navigateTo({
|
||||||
uni.navigateTo({
|
url: util.setUrl('/pages/shop/commodity/payment', {
|
||||||
url: util.setUrl('/pages/shop/commodity/payment', {
|
orderId: rs.data[0].orderId,
|
||||||
orderId: rs.data[0].orderId,
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
util.alert({
|
util.alert({
|
||||||
|
@ -209,65 +174,13 @@
|
||||||
</view>
|
</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>
|
<text>立即购买</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 立即支付 -->
|
||||||
|
<makeOrder ref="makeOrderRef" :detail="detail" @confirm="handlePay" />
|
||||||
</view>
|
</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>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
@ -279,42 +192,4 @@
|
||||||
width: 80rpx;
|
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>
|
</style>
|
|
@ -387,3 +387,25 @@ likeType
|
||||||
9:已取消
|
9:已取消
|
||||||
|
|
||||||
|
|
||||||
|
收藏 改成只能查看列表
|
||||||
|
|
||||||
|
金额显示的状态和商家同步
|
||||||
|
买家进行付款之后 卖家显示是待结算
|
||||||
|
分润相关的人显示待结算
|
||||||
|
买家进行确认收货 这笔钱显示待入账
|
||||||
|
分润相关的人显示待入账
|
||||||
|
7天无理由结束后 这笔钱进入到了商家可提现的钱包中 分润相关人员入账
|
||||||
|
|
||||||
|
聊天界面的卡片展示fee
|
||||||
|
|
||||||
|
|
||||||
|
1. 会员确认收货、售后、商家进行售后
|
||||||
|
会员发起售后
|
||||||
|
会员没有收货 只能仅退款
|
||||||
|
商家确认收货 完成退货流程
|
||||||
|
已收货之后 只能退货退款
|
||||||
|
商家进行审核
|
||||||
|
会员填写物流信息 商家进行确认 完成退货退款
|
||||||
|
2. 收藏分享佣金
|
||||||
|
3. 钱包明细
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ import {
|
||||||
import uni from '@dcloudio/vite-plugin-uni';
|
import uni from '@dcloudio/vite-plugin-uni';
|
||||||
|
|
||||||
//
|
//
|
||||||
// let target = 'http://101.35.80.139:8080'
|
// let target = 'http://91f.xyz:8080'
|
||||||
let target = 'http://8ii5rt.natappfree.cc'
|
let target = 'http://ugcege.natappfree.cc'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [uni()],
|
plugins: [uni()],
|
||||||
|
|
Loading…
Reference in New Issue