fix:修复获取openid的code

This commit is contained in:
hanlin 2024-12-11 10:26:58 +08:00
parent 03138b7089
commit 409d5f0ab8
8 changed files with 718 additions and 610 deletions

View File

@ -489,7 +489,8 @@ export default {
day,
value: [9999, month - 1, day - 1],
visible: true,
url: ''
url: '',
status: 0
}
},
computed: {
@ -750,6 +751,16 @@ export default {
fileListLen++
}
},
async getOpenId() {
uni.login({
provider: 'weixin',
success: async ({ code }) => {
const res = await this.$api.login.getOpenId({ code })
this.status = res.data.status
if (res.data.status !== 0) this.$common.msgToast(res.msg)
}
})
},
async signContract() {
this.loading = true
const data1 = {
@ -759,15 +770,11 @@ export default {
'/api/v2/warehouse/create',
data1
)
if (res1.code === 200) {
const res3 = await this.$api.login.getOpenId()
if (res3.status === 0) {
const res2 = await postDataByParams(
'/api/v2/warehouse/paid',
{
await this.getOpenId()
if (res1.code === 200 && this.status === 0) {
const res2 = await postDataByParams('/api/v2/warehouse/paid', {
ID: res1.data.ID
}
)
})
if (res2.code === 200) {
uni.requestPayment({
...res2.data,
@ -782,9 +789,6 @@ export default {
}
})
}
} else {
this.$common.msgToast(res3.msg)
}
}
},
async obtainAmount() {

View File

@ -4,7 +4,12 @@
<template #left>
<u-action-sheet
:show="show"
:actions="statusValue.map(x=>({name:x.label,value:x.value}))"
:actions="
statusValue.map((x) => ({
name: x.label,
value: x.value
}))
"
title="请选择状态"
@close="show = false"
@select="statusSelect"
@ -12,8 +17,17 @@
</u-action-sheet>
<div @click="openStatus" class="wrap1">
<div class="wrap1_1">
<div class="wrap1_1_1">{{ statusValue.find(x => x.value === artworkStatus).label }}</div>
<image style="width: 12rpx;height: 8rpx" src="../../static/dbx2@3x.png"></image>
<div class="wrap1_1_1">
{{
statusValue.find(
(x) => x.value === artworkStatus
).label
}}
</div>
<image
style="width: 12rpx; height: 8rpx"
src="../../static/dbx2@3x.png"
></image>
</div>
</div>
</template>
@ -24,66 +38,131 @@
<image src="../../static/zu1@3x.png"></image>
</div>
<div class="wrap1_2"></div>
<input v-model="mobileKey" placeholder-style="color: #C7C7C7;font-size: 20rpx;"
placeholder="在此处搜索您的订单"/>
<input
v-model="mobileKey"
placeholder-style="color: #C7C7C7;font-size: 20rpx;"
placeholder="在此处搜索您的订单"
/>
</div>
<div class="wrap2" @click="search">
搜索
</div>
<div class="wrap2" @click="search">搜索</div>
</div>
<div class="content3">
<scroll-view :style="{height:`${elementBottom}rpx`}" class="scrollbox" :scroll-y="true" @scrolltolower="loadMore">
<scroll-view
:style="{ height: `${elementBottom}rpx` }"
class="scrollbox"
:scroll-y="true"
@scrolltolower="loadMore"
>
<div
v-for="(item,index) in mainList" :key="index"
@touchstart="(e)=>{touchStart(e,index)}"
@touchmove="(e)=>{touchMove(e,index)}"
@touchend="()=>{touchEnd(index)}"
v-for="(item, index) in mainList"
:key="index"
@touchstart="
(e) => {
touchStart(e, index)
}
"
@touchmove="
(e) => {
touchMove(e, index)
}
"
@touchend="
() => {
touchEnd(index)
}
"
@click="goRouter(item)"
:style="{transform: `translateX(${item.distanceX}px)`}" class="wrap1">
:style="{ transform: `translateX(${item.distanceX}px)` }"
class="wrap1"
>
<div class="wrap1_1">
<image :src="item.artworkImg?item.artworkImg:'../../static/jx632@3x.png'"></image>
<image
:src="
item.artworkImg
? item.artworkImg
: '../../static/jx632@3x.png'
"
></image>
</div>
<div class="wrap1_2">
<div class="wrap1_2_1">{{ item.artworkName }}</div>
<!-- <div class="wrap1_2_2">订单号:{{ item.artworkName }}</div>-->
<div class="wrap1_2_3">{{ item.artworkSquareSize }}平尺</div>
<!-- <div class="wrap1_2_2">订单号:{{ item.artworkName }}</div>-->
<div class="wrap1_2_3">
{{ item.artworkSquareSize }}平尺
</div>
<div class="wrap1_2_4">
<div v-if="![1].includes(item.artworkStatus)">
{{ item.startAt.replaceAll('-','.') || '' }}-{{ item.endAt.replaceAll('-','.') || '' }}
{{ item.startAt.replaceAll('-', '.') || '' }}-{{
item.endAt.replaceAll('-', '.') || ''
}}
</div>
<div v-else>{{item.cycleName}} </div>
<div v-else>{{ item.cycleName }}</div>
</div>
</div>
<div class="wrap1_3" :class="[`status${item.artworkStatus}`]">
<div class="wrap1_3_1" v-if="item.artworkStatus===4">
<div
class="wrap1_3"
:class="[`status${item.artworkStatus}`]"
>
<div class="wrap1_3_1" v-if="item.artworkStatus === 4">
<div class="wrap1_3_1_1">{{ item.endAt }}</div>
<div class="wrap1_3_1_2">已延期</div>
<div class="wrap1_3_1_3" v-if="item.isSupplementary" @click.stop="openShow2(item)">点击补款</div>
<div
class="wrap1_3_1_3"
v-if="item.isSupplementary"
@click.stop="openShow2(item)"
>
点击补款
</div>
</div>
<div class="wrap1_3_3" v-if="item.artworkStatus !== 4">
<div class="wrap1_3_3_1">
{{
statusValue.find(
(x) => x.value === item.artworkStatus
).label
}}
</div>
<div class="wrap1_3_3" v-if="item.artworkStatus!==4">
<div class="wrap1_3_3_1">{{ statusValue.find(x => x.value === item.artworkStatus).label }}</div>
</div>
<div v-if="item.shelvesNum" class="wrap1_3_2">
<div class="wrap1_3_2_1">货架号:</div>
<div class="wrap1_3_2_2">{{ item.shelvesNum }}</div>
</div>
<div v-if="!item.shelvesNum" class="wrap1_3_2" >
<div class="wrap1_3_2_2">{{item.warehouseName}}</div>
</div>
<div class="wrap1_3_4" v-if="![1,5].includes(item.artworkStatus)" @click.stop="pickUp(item)">
{{item.isUserApplyPickUp?'取消申请':'申请取货'}}
<div v-if="!item.shelvesNum" class="wrap1_3_2">
<div class="wrap1_3_2_2">
{{ item.warehouseName }}
</div>
</div>
<div class="wrap1_4" v-if="item.isRight&&item.artworkStatus===5" @click.stop="openDelete(item)">
<image style="width: 80rpx;height: 80rpx" src="../../static/zu154@3x.png"></image>
<div
class="wrap1_3_4"
v-if="![1, 5].includes(item.artworkStatus)"
@click.stop="pickUp(item)"
>
{{
item.isUserApplyPickUp ? '取消申请' : '申请取货'
}}
</div>
</div>
<div
class="wrap1_4"
v-if="item.isRight && item.artworkStatus === 5"
@click.stop="openDelete(item)"
>
<image
style="width: 80rpx; height: 80rpx"
src="../../static/zu154@3x.png"
></image>
</div>
</div>
</scroll-view>
</div>
<uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog :type="'info'" cancelText="关闭" confirmText="确认" title="提示" :content="messageText"
<uni-popup-dialog
:type="'info'"
cancelText="关闭"
confirmText="确认"
title="提示"
:content="messageText"
@confirm="popForward"
></uni-popup-dialog>
</uni-popup>
@ -91,12 +170,12 @@
</div>
</template>
<script>
import tabbar from "../../components/uiq-tabbar/uiq-tabbar.vue";
import UImage from "../../uview-ui/components/u--image/u--image.vue";
import {postDataByParams} from "../../http/service";
import tabbar from '../../components/uiq-tabbar/uiq-tabbar.vue'
import UImage from '../../uview-ui/components/u--image/u--image.vue'
import { postDataByParams } from '../../http/service'
export default {
name: "index",
name: 'index',
data() {
return {
messageText: '',
@ -111,15 +190,23 @@ export default {
artworkStatus: 0,
pageSize: 999,
mainList: [],
statusValue: [{label: '全部状态', value: 0}, {label: '待入库', value: 1}, {
statusValue: [
{ label: '全部状态', value: 0 },
{ label: '待入库', value: 1 },
{
label: '已入库',
value: 2
}, {label: '即将到期', value: 3}, {label: '延期未补款', value: 4}, {label: '延期已补款', value: 7}, {label: '已取出', value: 5}]
},
{ label: '即将到期', value: 3 },
{ label: '延期未补款', value: 4 },
{ label: '延期已补款', value: 7 },
{ label: '已取出', value: 5 }
],
status: 0
}
},
components: {UImage, tabbar},
components: { UImage, tabbar },
mounted() {
uni.getSystemInfo({
success: (res) => {
this.windowWidth = res.windowWidth
@ -127,37 +214,36 @@ export default {
})
this.getDistanceFromTopToPageBottom('.content3')
},
onShow(){
onShow() {
this.getData()
},
computed: {},
methods: {
async pickUp(item){
let url=''
if (!item.isUserApplyPickUp){
url='/api/warehouse/apply/pickup'
}else {
url='/api/warehouse/apply/pickup/cancel'
async pickUp(item) {
let url = ''
if (!item.isUserApplyPickUp) {
url = '/api/warehouse/apply/pickup'
} else {
url = '/api/warehouse/apply/pickup/cancel'
}
const data={
ID:item.ID
const data = {
ID: item.ID
}
const res = await postDataByParams(url, data)
if (res.code===200){
if (res.code === 200) {
uni.showToast({
title: '请求成功',
icon: 'none'
})
}else {
} else {
uni.showToast({
title:res.msg,
title: res.msg,
icon: 'none'
})
}
this.getData()
},
popForward() {
if (this.messageText === '确认补款吗') {
this.supplementaryPayment()
} else if (this.messageText === '确认删除吗') {
@ -169,36 +255,55 @@ export default {
this.messageText = `确认补款吗`
this.$refs.alertDialog.open()
},
async getOpenId() {
uni.login({
provider: 'weixin',
success: async ({ code }) => {
const res = await this.$api.login.getOpenId({ code })
this.status = res.data.status
if (res.data.status !== 0) this.$common.msgToast(res.msg)
}
})
},
async supplementaryPayment() {
const data = {
ID: this.item.ID
}
const res3 = await this.$api.login.getOpenId()
if(res3.status === 0) {
const res = await postDataByParams('/api/warehouse/supply/paid', data)
if (res.code===200){
uni.requestPayment({...res.data,fail:(res)=>{
},success:()=>{
const res = await postDataByParams(
'/api/warehouse/supply/paid',
data
)
await this.getOpenId()
if (res.code === 200 && this.status === 0) {
uni.requestPayment({
...res.data,
fail: (res) => {},
success: () => {
this.getData()
uni.showToast({
title: '补款成功',
icon: 'none'
})
}})
}else {
}
})
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
} else {
this.$common.msgToast(res3.msg)
}
},
async getDistanceFromTopToPageBottom(classValue) {
const {windowHeight, windowWidth} = await uni.getSystemInfo();
const [{top}] = await new Promise(resolve => uni.createSelectorQuery().select(classValue).boundingClientRect().exec(resolve));
this.elementBottom = ((windowHeight - top) / windowWidth) * 750 - 175;
const { windowHeight, windowWidth } = await uni.getSystemInfo()
const [{ top }] = await new Promise((resolve) =>
uni
.createSelectorQuery()
.select(classValue)
.boundingClientRect()
.exec(resolve)
)
this.elementBottom =
((windowHeight - top) / windowWidth) * 750 - 175
/* if(uni.getSystemInfoSync().platform === 'ios'){
this.elementBottom = ((windowHeight - top) / windowWidth) * 750 - 175;
}else {
@ -269,38 +374,43 @@ export default {
}
},
touchMove(e, index) {
if (this.mainList[index].artworkStatus!==5){
if (this.mainList[index].artworkStatus !== 5) {
return
}
this.mainList[index].distanceX = e.touches[0].clientX - this.startX;
this.mainList[index].distanceX = e.touches[0].clientX - this.startX
},
touchStart(e, index) {
if (this.mainList[index].artworkStatus!==5){
if (this.mainList[index].artworkStatus !== 5) {
return
}
this.mainList[index].isRight = true
this.startX = e.touches[0].clientX;
this.startX = e.touches[0].clientX
},
touchEnd(index) {
if (this.mainList[index].artworkStatus!==5){
if (this.mainList[index].artworkStatus !== 5) {
return
}
if (this.mainList[index].distanceX < -((144 / 750) * this.windowWidth)) {
this.mainList[index].distanceX = -((144 / 750) * this.windowWidth);
if (
this.mainList[index].distanceX <
-((144 / 750) * this.windowWidth)
) {
this.mainList[index].distanceX = -(
(144 / 750) *
this.windowWidth
)
} else {
this.mainList[index].isRight = false
this.mainList[index].distanceX = 0;
this.mainList[index].distanceX = 0
}
}
}
}
</script>
<style scoped lang="scss">
.order-goods {
overflow: hidden;
box-sizing: border-box;
background-image: url("https://cdns.fontree.cn/fonchain-main/prod/image/default/artwork/4fdc9a0f-d72a-46b6-a04d-ed56d5465213.png");
background-image: url('https://cdns.fontree.cn/fonchain-main/prod/image/default/artwork/4fdc9a0f-d72a-46b6-a04d-ed56d5465213.png');
padding-left: 30rpx;
padding-right: 30rpx;
background-size: cover;
@ -328,7 +438,7 @@ export default {
align-items: center;
height: 228rpx;
width: 154rpx;
background-color: #B7C0C8;
background-color: #b7c0c8;
right: -144rpx;
position: absolute;
z-index: -1;
@ -352,43 +462,43 @@ export default {
}
&.status1 {
background: #FFBA00;
background: #ffba00;
.wrap1_3_3_1 {
color: #FFBA00;
color: #ffba00;
}
}
&.status2 {
background: #76C458;
background: #76c458;
.wrap1_3_3_1 {
color: #76C458;
color: #76c458;
}
}
&.status7 {
background: #76C458;
background: #76c458;
.wrap1_3_3_1 {
font-size: 23rpx!important;
font-size: 23rpx !important;
}
}
&.status3 {
background: #76C458;
background: #76c458;
.wrap1_3_3_1 {
color: #FF4848;
color: #ff4848;
}
}
&.status4 {
background: #FF4848;
background: #ff4848;
.wrap1_3_3_1 {
color: #FF4848;
color: #ff4848;
}
}
.wrap1_3_4{
.wrap1_3_4 {
display: flex;
align-items: center;
justify-content: center;
@ -419,7 +529,6 @@ export default {
.wrap1_3_2_2 {
color: #fff;
font-size: 24rpx;
}
}
@ -444,7 +553,6 @@ export default {
}
.wrap1_3_1 {
padding-bottom: 6rpx;
display: flex;
flex-direction: column;
@ -458,12 +566,12 @@ export default {
.wrap1_3_1_1 {
font-size: 16rpx;
color: #FF4848;
color: #ff4848;
}
.wrap1_3_1_2 {
font-size: 24rpx;
color: #FF4848;
color: #ff4848;
}
.wrap1_3_1_3 {
@ -496,7 +604,6 @@ export default {
margin-bottom: 12rpx;
color: #808080;
font-size: 24rpx;
}
.wrap1_2_3 {
@ -506,8 +613,7 @@ export default {
}
.wrap1_2_4 {
color: #FF4848;
color: #ff4848;
font-size: 24rpx;
}
}
@ -535,7 +641,7 @@ export default {
font-size: 20rpx;
width: 94rpx;
height: 52rpx;
background-color: #4E964D;
background-color: #4e964d;
}
.wrap1 {
@ -555,7 +661,6 @@ export default {
}
input {
}
.wrap1_1 {
@ -578,7 +683,7 @@ export default {
color: #fff;
width: 132rpx;
height: 52rpx;
background-color: #76C458;
background-color: #76c458;
display: flex;
justify-content: center;
align-items: center;
@ -591,13 +696,12 @@ export default {
align-items: center;
.wrap2_1 {
color: #4E964D;
color: #4e964d;
font-size: 32rpx;
}
.wrap2_2 {
color: #7C9F6F;
color: #7c9f6f;
font-size: 16rpx;
}
}
@ -608,7 +712,7 @@ export default {
border-radius: 20rpx;
width: 156rpx;
height: 52rpx;
background-color: #4E964D;
background-color: #4e964d;
color: #fff;
font-size: 24rpx;
display: flex;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -54,7 +54,7 @@
align-items: center;
height: 228rpx;
width: 154rpx;
background-color: #B7C0C8;
background-color: #b7c0c8;
right: -144rpx;
position: absolute;
z-index: -1;
@ -75,34 +75,34 @@
color: #939393;
}
.order-goods .content3 .wrap1 .wrap1_3.status1.data-v-c0c42e9e {
background: #FFBA00;
background: #ffba00;
}
.order-goods .content3 .wrap1 .wrap1_3.status1 .wrap1_3_3_1.data-v-c0c42e9e {
color: #FFBA00;
color: #ffba00;
}
.order-goods .content3 .wrap1 .wrap1_3.status2.data-v-c0c42e9e {
background: #76C458;
background: #76c458;
}
.order-goods .content3 .wrap1 .wrap1_3.status2 .wrap1_3_3_1.data-v-c0c42e9e {
color: #76C458;
color: #76c458;
}
.order-goods .content3 .wrap1 .wrap1_3.status7.data-v-c0c42e9e {
background: #76C458;
background: #76c458;
}
.order-goods .content3 .wrap1 .wrap1_3.status7 .wrap1_3_3_1.data-v-c0c42e9e {
font-size: 23rpx !important;
}
.order-goods .content3 .wrap1 .wrap1_3.status3.data-v-c0c42e9e {
background: #76C458;
background: #76c458;
}
.order-goods .content3 .wrap1 .wrap1_3.status3 .wrap1_3_3_1.data-v-c0c42e9e {
color: #FF4848;
color: #ff4848;
}
.order-goods .content3 .wrap1 .wrap1_3.status4.data-v-c0c42e9e {
background: #FF4848;
background: #ff4848;
}
.order-goods .content3 .wrap1 .wrap1_3.status4 .wrap1_3_3_1.data-v-c0c42e9e {
color: #FF4848;
color: #ff4848;
}
.order-goods .content3 .wrap1 .wrap1_3 .wrap1_3_4.data-v-c0c42e9e {
display: flex;
@ -169,11 +169,11 @@
}
.order-goods .content3 .wrap1 .wrap1_3 .wrap1_3_1 .wrap1_3_1_1.data-v-c0c42e9e {
font-size: 16rpx;
color: #FF4848;
color: #ff4848;
}
.order-goods .content3 .wrap1 .wrap1_3 .wrap1_3_1 .wrap1_3_1_2.data-v-c0c42e9e {
font-size: 24rpx;
color: #FF4848;
color: #ff4848;
}
.order-goods .content3 .wrap1 .wrap1_3 .wrap1_3_1 .wrap1_3_1_3.data-v-c0c42e9e {
display: flex;
@ -208,7 +208,7 @@
font-size: 24rpx;
}
.order-goods .content3 .wrap1 .wrap1_2 .wrap1_2_4.data-v-c0c42e9e {
color: #FF4848;
color: #ff4848;
font-size: 24rpx;
}
.order-goods .content3 .wrap1 .wrap1_1 image.data-v-c0c42e9e {
@ -229,7 +229,7 @@
font-size: 20rpx;
width: 94rpx;
height: 52rpx;
background-color: #4E964D;
background-color: #4e964d;
}
.order-goods .content2 .wrap1.data-v-c0c42e9e {
align-items: center;
@ -262,7 +262,7 @@
color: #fff;
width: 132rpx;
height: 52rpx;
background-color: #76C458;
background-color: #76c458;
display: flex;
justify-content: center;
align-items: center;
@ -274,11 +274,11 @@
align-items: center;
}
.order-goods .content1 .wrap2 .wrap2_1.data-v-c0c42e9e {
color: #4E964D;
color: #4e964d;
font-size: 32rpx;
}
.order-goods .content1 .wrap2 .wrap2_2.data-v-c0c42e9e {
color: #7C9F6F;
color: #7c9f6f;
font-size: 16rpx;
}
.order-goods .content1 .wrap1 .wrap1_1.data-v-c0c42e9e {
@ -286,7 +286,7 @@
border-radius: 20rpx;
width: 156rpx;
height: 52rpx;
background-color: #4E964D;
background-color: #4e964d;
color: #fff;
font-size: 24rpx;
display: flex;