wangfukang 1 month ago
parent
commit
d59da74cd1
  1. 120
      package2/group/groupBuySingle.vue
  2. 1
      package2/group/searchGroup.vue
  3. 56
      package2/login/login.vue
  4. 36
      package2/myCenter/wallet.vue

120
package2/group/groupBuySingle.vue

@ -386,7 +386,12 @@
<view class="goods-content-bottom">
<view class="popup-origin-price"
style="font-size: 28rpx;line-height: 54rpx;margin-right: 20rpx;">
<text v-if="isPintuan">
{{selectedGroupRule.groupPrice}}
</text>
<text v-if="!isPintuan">
{{currentItem.attributeListPrice | sliceMsg}}
</text>
<text class="package-fee-pill popup-package-fee" v-if="currentPackageFeeNumber > 0">
餐盒费{{currentPackageFee}}
</text>
@ -745,6 +750,7 @@
</template>
<script>
import { requireLoginToCurrentPage } from '@/utils/authRedirect.js'
export default {
data() {
return {
@ -887,23 +893,15 @@
onLoad(option) {
this.type = option.type;
this.orderScene = option.orderScene || '';
this.rememberShareTarget(option || {});
if (option.groupId) {
this.groupId = option.groupId;
}
if (option.isFaceToFace) {
this.isFaceToFaceGroup = option.isFaceToFace === '1' || option.isFaceToFace === 'true';
if (this.isFaceToFaceGroup) {
this.tui.request("/mall/order/selectMallOrderByGroupId/" + this.groupId, "GET", {}, false, true).then((
res) => {
if (res.code == 200) {
this.tuanzhangOrder = res.result;
} else {
that.tui.toast(res.message)
return
}
uni.hideLoading()
}).catch((res) => {})
}
if (this.isFaceToFaceGroup && this.groupId) {
this.loadGroupOrder();
}
if (option.targetMembers) {
this.targetMembers = parseInt(option.targetMembers);
@ -930,6 +928,10 @@
if (this.shopItem && this.shopItem.id) {
this.getCategory(this.shopItem.id);
this.getProduct('');
} else if (option.shopId) {
this.loadShopById(option.shopId);
} else if (this.groupId) {
this.loadShopByGroupId();
}
},
onShow() {
@ -966,6 +968,30 @@
this.detectCurrentCategory();
},
methods: {
rememberShareTarget(option) {
if (uni.getStorageSync('id')) return;
if (!option || !option.shopId || !option.groupId) return;
let targetPath = '/package2/group/groupBuySingle?type=shop' +
'&shopId=' + encodeURIComponent(option.shopId) +
'&groupId=' + encodeURIComponent(option.groupId) +
'&targetMembers=' + encodeURIComponent(option.targetMembers || 2) +
'&isFaceToFace=' + encodeURIComponent(option.isFaceToFace || 0);
if (option.orderScene) {
targetPath += '&orderScene=' + encodeURIComponent(option.orderScene);
}
uni.setStorageSync('authPendingTargetPath', targetPath);
uni.setStorageSync('pendingShareTargetPath', targetPath);
},
getCurrentRegionId() {
let area = uni.getStorageSync('area');
if (!area) return '';
try {
let areaInfo = typeof area === 'string' ? JSON.parse(area) : area;
return areaInfo && areaInfo.id ? areaInfo.id : '';
} catch (e) {
return '';
}
},
parseRouteItem(item) {
if (item == null || item === '') return null;
try {
@ -978,6 +1004,61 @@
}
}
},
loadShopByGroupId() {
if (!this.groupId) return;
this.tui.request("/mall/order/selectMallOrderByGroupId/" + this.groupId, "GET", {}, false, true).then((res) => {
if (res.code != 200 || !res.result) {
this.tui.toast(res.message || '拼团信息不存在');
return;
}
this.tuanzhangOrder = res.result;
let shopId = res.result.shopId;
if (!shopId) {
this.tui.toast('商家信息缺失,暂时无法参团');
return;
}
this.loadShopById(shopId);
}).catch(() => {});
},
loadGroupOrder() {
if (!this.groupId) return;
this.tui.request("/mall/order/selectMallOrderByGroupId/" + this.groupId, "GET", {}, false, true).then((res) => {
if (res.code == 200 && res.result) {
this.tuanzhangOrder = res.result;
}
}).catch(() => {});
},
loadShopById(shopId) {
if (!shopId) return;
let area = uni.getStorageSync('area');
let regionId = '';
try {
regionId = area ? JSON.parse(area).id : '';
} catch (e) {}
if (!regionId) {
this.tui.toast('请先选择校区');
return;
}
this.tui.request("/app/shop/getShopInfoById", "POST", {
id: shopId,
regionId: regionId
}, false, true).then((shopRes) => {
if (shopRes.code != 200 || !shopRes.result || !shopRes.result.shop) {
this.tui.toast(shopRes.message || '商家信息获取失败');
return;
}
this.shopItem = shopRes.result.shop;
if (this.shopItem.products) {
this.shopRecommend = this.shopItem.products;
for (let i = 0; i < this.shopRecommend.length; i++) {
this.shopRecommend[i].categoryId = '1';
this.shopRecommend[i].isChecked = false;
}
}
this.getCategory(this.shopItem.id);
this.getProduct('');
});
},
onBottomPopupChange(e) {
if (e.show) {
this.bottomPopupOpenCount += 1;
@ -1550,6 +1631,7 @@
this.$refs.pintuanPopup.close();
},
submitPintuan(isFaceToFace) {
if (!requireLoginToCurrentPage()) return;
if (this.currentOrderId && this.backendTotalAmount) {
this.$refs.payPopup.open('bottom');
if (this.$refs.pintuanPopup) this.$refs.pintuanPopup.close();
@ -1592,6 +1674,7 @@
this.$refs.pintuanPopup.close();
},
submitFTFJoinPay(specChoices) {
if (!requireLoginToCurrentPage()) return;
if (this.currentOrderId && this.backendTotalAmount) {
this.$refs.payPopup.open('bottom');
if (this.$refs.pintuanPopup) this.$refs.pintuanPopup.close();
@ -1627,9 +1710,14 @@
}
let packageFee = parseFloat(this.currentItem.lunchBox || 0);
let regionId = this.getCurrentRegionId();
if (!regionId) {
this.tui.toast('请先选择校区');
return null;
}
return {
userId: uni.getStorageSync('id') || 'test-user123',
userId: uni.getStorageSync('id'),
shopId: this.shopItem.id,
deliveryType: this.tuanzhangOrder.deliveryType,
packageFee: this.tuanzhangOrder.deliveryType == 1 ? packageFee : 0,
@ -1643,7 +1731,7 @@
shopAddress: this.shopItem.shopAddress || '',
groupId: this.groupId,
userCouponId: this.selectedCoupon ? this.selectedCoupon.id : null,
regionId: JSON.parse(uni.getStorageSync('area')).id
regionId: regionId
};
},
createFTFJoinOrder(specChoices, autoPay) {
@ -1783,6 +1871,7 @@
return arr.join(',');
},
submitCartCheckout() {
if (!requireLoginToCurrentPage()) return;
if (this.cartItems.length === 0) {
this.$refs.selectGoodsPopup.open()
return;
@ -1975,6 +2064,7 @@
this.$forceUpdate()
},
wxPayment() {
if (!requireLoginToCurrentPage()) return;
let that = this;
if (!this.currentOrderId || !this.backendTotalAmount) {
if (this.pendingPaySpecChoices) {
@ -2057,11 +2147,13 @@
fetchCoupons() {
let userId = uni.getStorageSync('id');
if (!userId) return Promise.resolve([]);
let regionId = this.getCurrentRegionId();
if (!regionId) return Promise.resolve([]);
let amount = this.getFaceToFaceGoodsAmount();
return this.tui.request('/mall/coupon/available', 'GET', {
userId: userId,
applyScene: 1,
regionId: JSON.parse(uni.getStorageSync('area')).id,
regionId: regionId,
amount: amount,
merchantId: this.shopItem.id || '0'
}, false, true).then((res) => {

1
package2/group/searchGroup.vue

@ -131,6 +131,7 @@
shopArea:'',
pageNumber: 1,
pageSize: '10',
merchantType: 1,
sort: "shoprank",
order: "desc",
sortOrder:'shoprank',

56
package2/login/login.vue

@ -76,6 +76,7 @@
</template>
<script>
import { resolveHomeShareTarget, getEnterShareTarget } from '@/utils/sharePath.js'
export default {
data() {
return {
@ -222,13 +223,30 @@
},
goAfterLogin(clearRedirect) {
const pendingPath = this.redirectKey ? uni.getStorageSync(this.redirectKey) : ''
const targetUrl = pendingPath || '/pages/index/index'
const fallbackTargetPath = uni.getStorageSync('authPendingTargetPath') || uni.getStorageSync('pendingShareTargetPath') || getEnterShareTarget() || ''
const targetUrl = pendingPath || fallbackTargetPath || '/pages/index/index'
const homeTargetPath = this.extractHomeTargetPath(targetUrl)
if (homeTargetPath) {
uni.setStorageSync('pendingShareTargetPath', homeTargetPath)
}
const needsAreaBeforeTarget = targetUrl &&
targetUrl.indexOf('/pages/index/index') !== 0 &&
targetUrl.indexOf('pages/index/index') !== 0 &&
!uni.getStorageSync('area')
const done = () => {
if (clearRedirect && pendingPath) {
uni.removeStorageSync(this.redirectKey)
}
if (targetUrl && targetUrl !== '/pages/index/index' && targetUrl.indexOf('/pages/index/index?') !== 0) {
uni.removeStorageSync('authPendingTargetPath')
}
}
const fallbackHome = () => {
if (homeTargetPath) {
uni.setStorageSync('pendingShareTargetPath', homeTargetPath)
} else if (targetUrl && targetUrl.indexOf('/pages/index/index') !== 0 && targetUrl.indexOf('pages/index/index') !== 0) {
uni.setStorageSync('pendingShareTargetPath', targetUrl)
}
uni.reLaunch({
url: '/pages/index/index',
success: done,
@ -240,9 +258,18 @@
}
})
}
if (needsAreaBeforeTarget) {
uni.setStorageSync('pendingShareTargetPath', targetUrl)
uni.reLaunch({
url: '/pages/index/index',
success: done,
fail: fallbackHome
})
return
}
if (targetUrl.indexOf('/pages/index/index') === 0 || targetUrl.indexOf('pages/index/index') === 0) {
uni.reLaunch({
url: targetUrl,
url: homeTargetPath ? '/pages/index/index' : targetUrl,
success: done,
fail: fallbackHome
})
@ -254,6 +281,31 @@
fail: fallbackHome
})
},
extractHomeTargetPath(url) {
if (!url) return ''
if (url.indexOf('/pages/index/index') !== 0 && url.indexOf('pages/index/index') !== 0) return ''
const queryIndex = url.indexOf('?')
if (queryIndex === -1) return ''
const query = url.slice(queryIndex + 1).split('&')
const queryMap = {}
for (let i = 0; i < query.length; i++) {
const pair = query[i].split('=')
queryMap[pair[0]] = pair.slice(1).join('=') || ''
}
const shareTargetPath = resolveHomeShareTarget(queryMap)
if (shareTargetPath) return shareTargetPath
for (let i = 0; i < query.length; i++) {
const pair = query[i].split('=')
if (pair[0] === 'targetPath') {
try {
return decodeURIComponent(pair.slice(1).join('=') || '')
} catch (e) {
return pair.slice(1).join('=') || ''
}
}
}
return ''
},
protocol(num) {
uni.navigateTo({
url: num == '1' ? '/package2/login/protocol' : '/package2/login/privacy'

36
package2/myCenter/wallet.vue

@ -86,8 +86,8 @@
<input type="digit" v-model="commionAmount"
style="width: 140rpx; border-bottom: 1px solid #ccc; text-align: center; font-size: 28rpx; font-weight: normal; height: 50rpx; min-height: 50rpx;"
placeholder="金额" />
<view class="btn" style="background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));width: 90%;height: 100rpx;border-radius: 100rpx;text-align: center;font-size: 28rpx;font-weight: 700;line-height: 100rpx;margin: 40rpx auto;" @tap="wxPayment">
确认提现
<view class="btn" :style="{opacity: submittingWithdraw ? 0.6 : 1}" style="background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));width: 90%;height: 100rpx;border-radius: 100rpx;text-align: center;font-size: 28rpx;font-weight: 700;line-height: 100rpx;margin: 40rpx auto;" @tap="wxPayment">
{{submittingWithdraw ? '提现中...' : '确认提现'}}
</view>
</uni-popup>
</view>
@ -121,6 +121,8 @@
linkId:'',
autoplay: true,
balanceShop:[],
submittingWithdraw: false,
withdrawRequestId: '',
}
},
onLoad(option) {
@ -156,7 +158,7 @@
if(res.result.shop){
this.balanceShop = res.result.shop
}
that.$forceUpdate();
this.$forceUpdate();
} else {
this.tui.toast(res.message)
}
@ -180,16 +182,36 @@
}
this.commionAmount = commion
this.commionType = type
this.submittingWithdraw = false
this.withdrawRequestId = this.createWithdrawRequestId()
this.$refs.payPopup.open();
},
createWithdrawRequestId(){
return `${Date.now()}${Math.floor(Math.random() * 1000000)}`
},
wxPayment(){
let that = this
if(this.commionAmount < 1 || this.commionAmount > 5000){
if (this.submittingWithdraw) {
that.tui.toast('提现处理中,请勿重复提交')
return
}
const amount = Number(this.commionAmount)
if(!amount || amount < 1 || amount > 5000){
that.tui.toast('单笔提现金额应在1-5000之间')
return
}
if(!this.aliName){
that.tui.toast('支付宝实名名称不能为空')
return
}
if(!this.aliAccount){
that.tui.toast('支付宝手机号不能为空')
return
}
this.submittingWithdraw = true
let data = {
commission:this.commionAmount,
id:this.withdrawRequestId || this.createWithdrawRequestId(),
commission:amount,
aliName:this.aliName,
aliAccount:this.aliAccount
}
@ -204,13 +226,17 @@
that.loadStatus = 'nomore';
if (res.code == 200) {
this.$refs.payPopup.close();
this.withdrawRequestId = ''
this.beginData();
} else {
that.tui.toast(res.message)
that.submittingWithdraw = false
return
}
that.submittingWithdraw = false
uni.hideLoading()
}).catch((res) => {
that.submittingWithdraw = false
that.tui.toast(res.message)
})
},

Loading…
Cancel
Save