From 98d307ebd7f9ef3c3d4e448b53ab9d91197a5832 Mon Sep 17 00:00:00 2001 From: sx <2427911852@qq.com> Date: Wed, 15 Jan 2025 23:47:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jiuyi2/api/mine.js | 13 ++ jiuyi2/api/shop.js | 79 ++++++++++- jiuyi2/common/js/config.js | 3 +- jiuyi2/common/js/util.js | 1 - .../shop/productList/productList.vue | 2 +- jiuyi2/pages.json | 2 +- jiuyi2/pages/index/wallet/topUp.vue | 33 +++-- .../components/jy-commodity-foot/index.vue | 71 ++++++++-- jiuyi2/pages/shop/commodity/index.vue | 126 ++++++++++++++++-- jiuyi2/pages/shop/focusStore.vue | 73 +++++++++- jiuyi2/pages/shop/history.vue | 110 +++++++++++++-- jiuyi2/pages/shop/shop.vue | 2 +- jiuyi2/pages/shop/store/index.vue | 22 +++ jiuyi2/readme.md | 9 ++ jiuyi2/vite.config.js | 4 +- 15 files changed, 499 insertions(+), 51 deletions(-) diff --git a/jiuyi2/api/mine.js b/jiuyi2/api/mine.js index 92211808..5431498a 100644 --- a/jiuyi2/api/mine.js +++ b/jiuyi2/api/mine.js @@ -177,6 +177,19 @@ const mine = { method: 'POST', }) }, + + /** + * 支付 + * @param {Object} param + */ + recharge(param) { + return util.request({ + url: '/user/alipay/recharge', + query: param.query, + method: 'POST', + load: true, + }) + }, } export default mine \ No newline at end of file diff --git a/jiuyi2/api/shop.js b/jiuyi2/api/shop.js index 06d257ff..0bc6c30c 100644 --- a/jiuyi2/api/shop.js +++ b/jiuyi2/api/shop.js @@ -161,6 +161,7 @@ const shop = { url: `/shopify/appAddress/deleteById`, method: 'DELETE', query: param.query, + load: true, }) }, @@ -173,9 +174,85 @@ const shop = { url: `/shopify/webProduct/uploadProduct`, method: 'POST', data: param.data, + load: true, + }) + }, + + /** + * 商品收藏 + * @param {Object} param + */ + addProductCollect(param) { + return util.request({ + url: `/shopify/collect/addProductCollect`, + method: 'POST', + query: param.query, + load: true, + }) + }, + + /** + * 查看收藏记录 + * @param {Object} param + */ + addProductCollect(param) { + return util.request({ + url: `/shopify/collect`, + method: 'GET', + query: param.query, + load: true, + }) + }, + + /** + * 取消 / 关注店铺 + * @param {Object} param + */ + followShop(param) { + return util.request({ + url: `/shopify/shopifyFollow/followShop`, + method: 'POST', + data: param.data, + load: true, + }) + }, + + /** + * 获取商户详细信息 + * @param {Object} param + */ + merchant(param) { + return util.request({ + url: `/shopify/merchant`, + method: 'GET', + path: param.path, + load: true, + }) + }, + + /** + * 根据用户id查询所有的浏览记录 + * @param {Object} param + */ + getHistoryView(param) { + return util.request({ + url: `/shopify/system`, + method: 'GET', + load: true, + }) + }, + + /** + * 获取关注店铺列表 + * @param {Object} param + */ + getFollowShopList(param) { + return util.request({ + url: `/shopify/shopifyFollow/getFollowShopList`, + method: 'GET', + load: true, }) }, - } export default shop \ No newline at end of file diff --git a/jiuyi2/common/js/config.js b/jiuyi2/common/js/config.js index e50fef3e..2ab926a8 100644 --- a/jiuyi2/common/js/config.js +++ b/jiuyi2/common/js/config.js @@ -6,7 +6,8 @@ const config = { // #endif // #ifndef H5 // host: 'http://1641c8e0.r22.cpolar.top', - host: 'http://192.168.0.189:8080', + // host: 'http://192.168.0.189:8080', + host: 'http://192.168.0.102:8080', // #endif // 上传文件二级路径 uploadFilePath: "/homecommon/file/preview?fileName=", diff --git a/jiuyi2/common/js/util.js b/jiuyi2/common/js/util.js index ac9341b4..c99a4831 100644 --- a/jiuyi2/common/js/util.js +++ b/jiuyi2/common/js/util.js @@ -1557,7 +1557,6 @@ const util = { // 验证登录 util.isLogin(() => { const userinfo = uni.$store.state.userinfo - console.log('userinfo.userIdCard', userinfo.userIdCard) if (userinfo.userIdCard) { param.success ? param.success(userinfo) : '' return diff --git a/jiuyi2/components/shop/productList/productList.vue b/jiuyi2/components/shop/productList/productList.vue index 6d5ba835..f34b130e 100644 --- a/jiuyi2/components/shop/productList/productList.vue +++ b/jiuyi2/components/shop/productList/productList.vue @@ -105,7 +105,7 @@ - + diff --git a/jiuyi2/pages.json b/jiuyi2/pages.json index 40baca21..6ec3ccdd 100644 --- a/jiuyi2/pages.json +++ b/jiuyi2/pages.json @@ -822,7 +822,7 @@ "current": 0, "list": [{ "name": "test", - "path": "pages/index/index" + "path": "pages/index/wallet/wallet" }] }, diff --git a/jiuyi2/pages/index/wallet/topUp.vue b/jiuyi2/pages/index/wallet/topUp.vue index 01ac33b4..06648b7f 100644 --- a/jiuyi2/pages/index/wallet/topUp.vue +++ b/jiuyi2/pages/index/wallet/topUp.vue @@ -8,10 +8,20 @@ } from 'vue'; import util from '@/common/js/util'; import api from '@/api/index.js'; + import { + onLoad, + onReady, + onReachBottom, + onPullDownRefresh + } from '@dcloudio/uni-app' // 表单 const form = reactive({ - amount: '', + totalAmount: '', + }) + + onLoad(() => { + // }) // 充值 @@ -25,29 +35,36 @@ }) } - // + // 调用支付 function payment() { const data = { ...form } - if (!data.amount) { + if (!data.totalAmount) { util.alert('金额不正确') return } + console.log('payment') - api.mine.pay({ - query: data, + api.mine.recharge({ + query: { + ...data, + }, }).then(rs => { - if (rs.code === 200) { + console.log('recharge rs', rs) + if (rs.code == 200) { uni.requestPayment({ provider: 'alipay', orderInfo: rs.data, success: rs => { console.log('requestPayment', rs) - util.getUserinfo() + util.getPurse() uni.navigateBack() }, + fail: err => { + console.log('fail err', err) + } }) return } @@ -69,7 +86,7 @@ - + diff --git a/jiuyi2/pages/shop/commodity/components/jy-commodity-foot/index.vue b/jiuyi2/pages/shop/commodity/components/jy-commodity-foot/index.vue index 9f396af2..b66e24ed 100644 --- a/jiuyi2/pages/shop/commodity/components/jy-commodity-foot/index.vue +++ b/jiuyi2/pages/shop/commodity/components/jy-commodity-foot/index.vue @@ -3,23 +3,28 @@ import { ref, reactive, - getCurrentInstance + getCurrentInstance, + computed, + defineEmits } from 'vue' // import util from '@/common/js/util.js' + // + import api from '@/api/index.js' import JyPopup from '@/components/public/jy-popup' // 地址 import JyCommodityAddress from '@/components/public/jy-commodity-address' + // import { useStore } from 'vuex' + const { proxy } = getCurrentInstance() - const { - userinfo - } = useStore().state + // + const store = useStore() // const props = defineProps({ // 商品信息 @@ -30,6 +35,10 @@ }) // 地址 const address = reactive({}) + // 用户信息 + const userinfo = computed(() => store.state.userinfo) + // + const emit = defineEmits(['update']) // 规格 const spec = reactive([{ @@ -61,7 +70,6 @@ ]) // 已选择的规格下标 const spaceIndex = reactive([]) - // const menuFn = { // 店铺 @@ -96,6 +104,35 @@ function handleSpec(index, secIndex) { spaceIndex.splice(index, 1, secIndex) } + + // 切换收藏 + function handleCollect() { + // + api.shop.addProductCollect({ + query: { + productId: props.detail.id, + type: { + 0: 1, + 1: 0, + } [props.detail.isCollect] + }, + }).then(res => { + if (res.code === 200) { + emit('update', { + ...props.detail, + isCollect: { + 0: 1, + 1: 0, + } [props.detail.isCollect] + }) + return + } + util.alert({ + content: res.msg, + showCancel: false, + }) + }) + }