From 76b833dceec4376961a15e5fa56ef3b5de321c6f Mon Sep 17 00:00:00 2001 From: honghong <2401639944@qq.com> Date: Tue, 4 Apr 2023 12:57:23 +0800 Subject: [PATCH] 优惠券列表接口对接详情接口修改 --- api/my/index.js | 13 ++++++++++++- api/system/index.js | 15 +++++++++++++-- api/user.js | 8 ++++---- config/index.js | 7 ++++--- demand/index/index.vue | 413 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- home/index/index.vue | 21 +++++++++++++-------- my/coupon/index.vue | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------ my/login/login.vue | 40 +++++++++++++++++++++------------------- pages/demand/components/index.vue | 11 +++++++---- pages/demand/index.vue | 351 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------- pages/home/index.vue | 2 +- store/modules/login.js | 26 ++------------------------ 12 files changed, 536 insertions(+), 444 deletions(-) diff --git a/api/my/index.js b/api/my/index.js index 719dbc5..f71e660 100644 --- a/api/my/index.js +++ b/api/my/index.js @@ -11,6 +11,15 @@ const addUserFeedback = (params) => { const couponListGet = (params) =>{ return ApiHttp('/xinrenli/coupon/list',params,'GET') } +// 用户优惠卷有效查询接口 +const userCouponList = (params) => { + return ApiHttp('/xinrenli/userCoupon/list',params,'GET') +} +// 用户优惠卷无效查询接口 +const userCouponListLose = (params) => { + return ApiHttp('/xinrenli/userCoupon/listLose',params,'GET') +} + // 查询邀请列表 const queryInviteListGet = (params) =>{ return ApiHttp('/xinrenli/Inviter/list',params,'GET') @@ -23,5 +32,7 @@ export { addUserFeedback, couponListGet, queryInviteListGet, - addInviterGet + addInviterGet, + userCouponList, + userCouponListLose } \ No newline at end of file diff --git a/api/system/index.js b/api/system/index.js index 7030dbd..33bb07b 100644 --- a/api/system/index.js +++ b/api/system/index.js @@ -10,6 +10,10 @@ const userNeedSquare = (params) => { const orderDetailMsg = (params) => { return ApiHttp('/xinrenli/order/',params,'GET') } +// 获取订单详细信息(最新首页详情) +const orderDetailMsgNew = (params) => { + return ApiHttp('/xinrenli/order/particulars',params,'GET') +} //我的需求 const myNeedList = (params) => { @@ -23,13 +27,20 @@ const addOrderFunction = (params) =>{ // 修改订单(发布) const updateOrderFunction = (params) =>{ - return ApiHttp('/xinrenli/order',params,'PUT') + return ApiHttp('/xinrenli/order/edit',params,'POST') +} + +//取消订单 +const removeOrderFunction = (params) =>{ + return ApiHttp('/xinrenli/order/remove',params,'GET') } export { userNeedSquare, orderDetailMsg, + orderDetailMsgNew, myNeedList, addOrderFunction, - updateOrderFunction + updateOrderFunction, + removeOrderFunction } \ No newline at end of file diff --git a/api/user.js b/api/user.js index e2c6315..3a54d44 100644 --- a/api/user.js +++ b/api/user.js @@ -1,13 +1,13 @@ import { ApiHttp } from '@/utils/request.js' - +// 程序静默登录 const login = (params) => { - return ApiHttp('/system/xcxLogin', params, 'POST') + return ApiHttp('/xcxLogin', params, 'GET') } - +// 获取手机号 const loginPhone = (params) => { - return ApiHttp('/system/getPhone', params, 'POST') + return ApiHttp('/xcxPhoneLogin', params, 'POST') } const loginOut = (params) => { diff --git a/config/index.js b/config/index.js index f6dfce4..f88e7ef 100644 --- a/config/index.js +++ b/config/index.js @@ -1,8 +1,9 @@ -let hostUrl = 'http://xinrenli.nyinhong.com', // 测试 -// let hostUrl = 'http://192.168.0.109:7001', // UAT +// let hostUrl = 'http://xinrenli.nyinhong.com', // 测试 +let hostUrl = 'http://192.168.0.175:7001', // UAT // // let hostUrl = 'https://pepsibdp.masterkong.com.cn', // prd - api = '/api', + api = '', + // api = '/api', imgApi = '/admimage/'; // let hostUrl = '', diff --git a/demand/index/index.vue b/demand/index/index.vue index c368a66..a0d9b9c 100644 --- a/demand/index/index.vue +++ b/demand/index/index.vue @@ -1,214 +1,227 @@ -<template> - <view class="content"> - <view class="content-textarea"> - <view class="">标题</view> - <view class="">{{detailData.title}}</view> - </view> - <view class="content-textarea"> - <view class="">联系人</view> - <view class="">{{detailData.linkman}}</view> - </view> - <view class="content-textarea"> - <view class="">联系电话</view> - <view class="">{{detailData.phone}}</view> - </view> - <view class="content-textarea"> - <view class="">维修时间</view> - <view class="">{{detailData.repairTime | formatDate}}</view> - </view> - <view class="content-textarea"> - <view class="">维修地址</view> - <view class="">{{detailData.repairAddress}}</view> - </view> - <view class="content-textarea"> - <view class="">预算金额</view> - <view class="">{{detailData.budget}}</view> - </view> - <view class="content-photograph"> - <view class="">上传图片 - </view> - <view class="content-photograph-photo"> - <image class="content-photograph-photo-img" src="../../static/logo.png" mode="" v-for="(v ,index) in 5" - :key="index"></image> - </view> - </view> - <view class="content-frequency"> - <view class=""> - 上传视频 - </view> - <view v-for="(v ,index) in 2" :key="index"> - <video id="myVideo" - src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4" - @error="videoErrorCallback" :danmu-list="danmuList" enable-danmu controls - :show-fullscreen-btn='false'></video> - </view> - </view> - <view class="content-voice"> - <view class=""> - 语音描述 - </view> - <view class="content-voice-audio"> - - </view> - </view> - <view class="content-remarks"> - <view class=""> - 备注 - </view> - <u--textarea v-model="detailData.remark" placeholder="请输入内容" disabled></u--textarea> - </view> - <view class="content-reject" v-if="detailData.status == 1"> - <view class="font-bold"> - <text></text>订单已驳回 +<template> + <view class="content"> + <view class="content-textarea"> + <view class="">标题</view> + <view class="">{{detailData.title}}</view> + </view> + <view class="content-textarea"> + <view class="">联系人</view> + <view class="">{{detailData.linkman}}</view> + </view> + <view class="content-textarea"> + <view class="">联系电话</view> + <view class="">{{detailData.phone}}</view> + </view> + <view class="content-textarea"> + <view class="">维修时间</view> + <view class="">{{detailData.repairTime | formatDate}}</view> + </view> + <view class="content-textarea"> + <view class="">维修地址</view> + <view class="">{{detailData.repairAddress}}</view> + </view> + <view class="content-textarea"> + <view class="">预算金额</view> + <view class="">{{detailData.budget}}</view> + </view> + <view class="content-photograph"> + <view class="">上传图片 </view> - <view class="paddding-x-two">驳回理由:沟通金额没有谈妥</view> - <!-- <u--textarea v-model="detailData.value1" placeholder="请输入内容" disabled></u--textarea> --> - </view> - <view class="content-reject" v-if="subscript == 3 && subs== '1'"> - <view class=""> - <text style="background:#2C66FF"></text>该订单已提交退款,等待商家致电…… - </view> - <u--textarea v-model="value1" placeholder="请输入内容" disabled></u--textarea> - </view> - <view class="content-reject" v-if="subscript == 3 && subs== '2'"> - <view class=""> - <text></text>该订单已退款 - </view> - <u--textarea v-model="value1" placeholder="请输入内容" disabled></u--textarea> - </view> - </view> - </view> -</template> - + <view class="content-photograph-photo"> + <image class="content-photograph-photo-img" src="../../static/logo.png" mode="" v-for="(v ,index) in 5" + :key="index"></image> + </view> + </view> + <view class="content-frequency"> + <view class=""> + 上传视频 + </view> + <view v-for="(v ,index) in 2" :key="index"> + <video id="myVideo" + src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4" + @error="videoErrorCallback" :danmu-list="danmuList" enable-danmu controls + :show-fullscreen-btn='false'></video> + </view> + </view> + <view class="content-voice"> + <view class=""> + 语音描述 + </view> + <view class="content-voice-audio"> + + </view> + </view> + <view class="content-remarks"> + <view class=""> + 备注 + </view> + <u--textarea v-model="detailData.remark" placeholder="请输入内容" disabled></u--textarea> + </view> + <view class="content-reject" v-if="detailData.status == 1"> + <view class="font-bold"> + <text></text>订单已驳回 + </view> + <view class="paddding-x-two">驳回理由:沟通金额没有谈妥</view> + <!-- <u--textarea v-model="detailData.value1" placeholder="请输入内容" disabled></u--textarea> --> + </view> + <view class="content-reject" v-if="subscript == 3 && subs== '1'"> + <view class=""> + <text style="background:#2C66FF"></text>该订单已提交退款,等待商家致电…… + </view> + <u--textarea v-model="value1" placeholder="请输入内容" disabled></u--textarea> + </view> + <view class="content-reject" v-if="subscript == 3 && subs== '2'"> + <view class=""> + <text></text>该订单已退款 + </view> + <u--textarea v-model="value1" placeholder="请输入内容" disabled></u--textarea> + </view> + </view> + </view> +</template> + <script> - import {orderDetailMsg} from '../../api/system/index.js' - import apiBaseConfig from '@/config/index.js'; - export default { - data() { - return { - imgBgUrl: apiBaseConfig.imgBgUrl, - globalData: getApp().globalData, + import { + orderDetailMsgNew + } from '../../api/system/index.js' + import apiBaseConfig from '@/config/index.js'; + export default { + data() { + return { + imgBgUrl: apiBaseConfig.imgBgUrl, + globalData: getApp().globalData, scrollTopHeader: 0, - detailInfo:{},//接收的参数 - subscript: '0', + detailInfo: {}, //接收的参数 + subscript: '0', subs: '1', - detailData:{} - }; - }, + detailData: {} + }; + }, onLoad(option) { - if(option.detailInfo){ + if (option.detailInfo) { this.detailInfo = JSON.parse(decodeURIComponent(option.detailInfo)) - console.log(this.detailInfo,'结束') + console.log(this.detailInfo, '结束') this.getOrder() } return - this.subs = option.subs - - }, + this.subs = option.subs + + }, methods: { - //获取订单详情列表 - getOrder(){ + //获取订单详情列表 + async getOrder() { let that = this - orderDetailMsg({id:that.detailInfo.id}).then(res=>{ - console.log('订单详情',res) - if(res.code == 200){ - that.detailData = res.data - } + const data_back = await orderDetailMsgNew({ + id: that.detailInfo.id }) - }, - - } - } -</script> - -<style lang="scss" scoped> - .content { - padding: 0rpx 40rpx 160rpx; - - &-textarea { - display: flex; - justify-content: space-between; - padding: 30rpx 10rpx; - border-bottom: 1rpx solid #E7E7E7; - - >view { - font-size: 26rpx; - font-family: AlibabaPuHuiTi-Regular, AlibabaPuHuiTi; - font-weight: 400; - color: #333333; - } - } - - &-photograph { - padding: 30rpx 0rpx; - - &-photo { - display: flex; - flex-wrap: wrap; - justify-content: flex-start; - - &-img { - margin-top: 20rpx; - margin-right: 20rpx; - width: 210rpx; - height: 210rpx; - } - &-img:nth-child(3n){ - margin-right: 0rpx; - } - } - } - - &-frequency { - padding: 30rpx 0rpx; - - >view { - display: flex; - - >video { - margin-top: 20rpx; - width: 373rpx; - height: 210rpx; - } - } - } - - &-voice { - padding: 30rpx 0rpx; - - &-audio { - margin-top: 20rpx; - background: #F5F5F5; - border-radius: 6rpx; - height: 68rpx; - } - } - - &-remarks { - >view { - margin-bottom: 20rpx; - } - } - - &-reject { - margin-top: 30rpx; - - >view { - display: flex; - margin-bottom: 20rpx; - font-size: 28rpx; - // font-weight: 700; - color: #333333; - - >text { - width: 6rpx; - height: 36rpx; - background: #FD0000; - border-radius: 3rpx; - margin-right: 10rpx; - } - } - } + console.log(data_back, '订单详情') + const { + code, + data + } = data_back + if (code === 200) { + that.detailData = data + } + // orderDetailMsgNew({id:that.detailInfo.id}).then(res=>{ + // console.log('订单详情',res) + // if(res.code == 200){ + // that.detailData = res.data + // } + // }) + }, + + } + } +</script> + +<style lang="scss" scoped> + .content { + padding: 0rpx 40rpx 160rpx; + + &-textarea { + display: flex; + justify-content: space-between; + padding: 30rpx 10rpx; + border-bottom: 1rpx solid #E7E7E7; + + >view { + font-size: 26rpx; + font-family: AlibabaPuHuiTi-Regular, AlibabaPuHuiTi; + font-weight: 400; + color: #333333; + } + } + + &-photograph { + padding: 30rpx 0rpx; + + &-photo { + display: flex; + flex-wrap: wrap; + justify-content: flex-start; + + &-img { + margin-top: 20rpx; + margin-right: 20rpx; + width: 210rpx; + height: 210rpx; + } + + &-img:nth-child(3n) { + margin-right: 0rpx; + } + } + } + + &-frequency { + padding: 30rpx 0rpx; + + >view { + display: flex; + + >video { + margin-top: 20rpx; + width: 373rpx; + height: 210rpx; + } + } + } + + &-voice { + padding: 30rpx 0rpx; + + &-audio { + margin-top: 20rpx; + background: #F5F5F5; + border-radius: 6rpx; + height: 68rpx; + } + } + + &-remarks { + >view { + margin-bottom: 20rpx; + } + } + + &-reject { + margin-top: 30rpx; + + >view { + display: flex; + margin-bottom: 20rpx; + font-size: 28rpx; + // font-weight: 700; + color: #333333; + + >text { + width: 6rpx; + height: 36rpx; + background: #FD0000; + border-radius: 3rpx; + margin-right: 10rpx; + } + } + } } - </style> diff --git a/home/index/index.vue b/home/index/index.vue index ba1cf6b..542fbd1 100644 --- a/home/index/index.vue +++ b/home/index/index.vue @@ -61,7 +61,8 @@ <script> import { - orderDetailMsg + orderDetailMsg, + orderDetailMsgNew } from '../../api/system/index.js' import apiBaseConfig from '@/config/index.js'; import freeAudio from '../../components/chengpeng-audio/free-audio.vue' @@ -102,14 +103,18 @@ }) }, methods: { - getDetailData(id){ + async getDetailData(id){ let that = this - orderDetailMsg({id:id}).then(res=>{ - console.log(res.data,'详情') - if(res.code == 200){ - that.orderDetail = res.data - } - }) + const data_back = await orderDetailMsgNew({id:id}) + console.log(data_back,'返沪') + const {code,data} = data_back + that.orderDetail = data + // orderDetailMsgNew({id:id}).then(res=>{ + // console.log(res.data,'详情') + // if(res.code == 200){ + // that.orderDetail = res.data + // } + // }) }, // 播放 doPlay() { diff --git a/my/coupon/index.vue b/my/coupon/index.vue index 7ac3e5d..d3f5666 100644 --- a/my/coupon/index.vue +++ b/my/coupon/index.vue @@ -2,10 +2,10 @@ <view class="index"> <com-navbar :title="title" :titleStyle="{ color: '#000000', fontSize: '32rpx' }" /> <view class="index-content"> - <view class="index-content-item"> + <view class="index-content-item" v-for="(item,index) in useCouponList"> <view class="index-content-item-nav baiyin-flex baiyin-flex-c-b"> <text></text> - <view>可用优惠券(2)</view> + <view>可用优惠券{{cantotal}}</view> </view> <view class="index-content-item-qu" @click="optionData.type === 'pay'?jump():null"> <image class="index-content-item-qu-bg" src="@/static/icon/xy01.png" mode=""></image> @@ -14,15 +14,15 @@ <view class="index-content-item-qu-bl-lk"> <view class="index-content-item-qu-bl-lk-t"> <text>¥</text> - <text>200</text> + <text>{{item.fullSubtraction}}</text> 优惠券 </view> - <view class="index-content-item-qu-bl-lk-b">有效期:2022.3.1-2022.12.31</view> + <view class="index-content-item-qu-bl-lk-b">有效期:{{item.effectiveTime | formatDate}}-{{item.failureTime | formatDate}}</view> </view> <template v-if="optionData.type === 'pay'"> <view class="index-content-item-qu-bl-rk"> <view class="index-content-item-qu-bl-rk-a">订单金额满</view> - <view class="index-content-item-qu-bl-rk-b">9999元</view> + <view class="index-content-item-qu-bl-rk-b">{{item.minUsed}}元</view> <view class="index-content-item-qu-bl-rk-c">可使用</view> <view class="index-content-item-qu-bl-rk-d">当前可使用</view> </view> @@ -30,7 +30,7 @@ <template v-if="optionData.type === 'coupon'"> <view class="index-content-item-qu-bl-rk"> <view class="index-content-item-qu-bl-rk-a index-content-item-qu-bl-rk-axl">订单金额满</view> - <view class="index-content-item-qu-bl-rk-b index-content-item-qu-bl-rk-bxl">9999元</view> + <view class="index-content-item-qu-bl-rk-b index-content-item-qu-bl-rk-bxl">{{item.minUsed}}元</view> <view class="index-content-item-qu-bl-rk-c index-content-item-qu-bl-rk-cxl">可使用</view> <view class="index-content-item-qu-bl-rk-d index-content-item-qu-bl-rk-dxl">去使用</view> </view> @@ -43,22 +43,22 @@ <text></text> <view>不可用优惠券(2)</view> </view> - <view class="index-content-item-qu"> + <view class="index-content-item-qu" v-for="(info,ix) in couponLoseList"> <image class="index-content-item-qu-bg" src="@/static/icon/xy02.png" mode=""></image> <view class="index-content-item-qu-bl"> <text class="index-content-item-qu-bl-tl index-content-item-qu-bl-tlx">满减优惠券</text> <view class="index-content-item-qu-bl-lk"> <view class="index-content-item-qu-bl-lk-t index-content-item-qu-bl-lk-tx"> <text>¥</text> - <text>200</text> + <text>{{info.fullSubtraction}}</text> 优惠券 </view> <view class="index-content-item-qu-bl-lk-b index-content-item-qu-bl-lk-bx"> - 有效期:2022.3.1-2022.12.31</view> + 有效期:{{info.effectiveTime | formatDate}}-{{info.failureTime | formatDate}}</view> </view> <view class="index-content-item-qu-bl-rk"> <view class="index-content-item-qu-bl-rk-a index-content-item-qu-bl-rk-ax">订单金额满</view> - <view class="index-content-item-qu-bl-rk-b index-content-item-qu-bl-rk-bx">200元</view> + <view class="index-content-item-qu-bl-rk-b index-content-item-qu-bl-rk-bx">{{info.minUsed}}元</view> <view class="index-content-item-qu-bl-rk-c index-content-item-qu-bl-rk-cx">可使用</view> <view class="index-content-item-qu-bl-rk-d index-content-item-qu-bl-rk-dx">不可用</view> </view> @@ -70,13 +70,29 @@ </template> <script> - import {couponListGet} from '../../api/my/index.js' + import {couponListGet,userCouponList,userCouponListLose} from '../../api/my/index.js' export default { data() { return { scrollTopHeader: 0, optionData: {}, - title: '' + title: '', + queryParams:{ + pageNum:1, + pageSize:10, + deleteStatus:0, + useStatus:0 + },//优惠券有效参数 + useCouponList:[],//可使用的优惠券列表 + cantotal:0, + loseParams:{ + pageNum:1, + pageSize:10, + deleteStatus:1, + useStatus:1 + }, + couponLoseList:[], + loseTotal:0 }; }, onLoad(option) { @@ -84,14 +100,35 @@ self.optionData = option; console.log(option) self.initial(); - self.getCoupon() + self.getCoupon() + self.getLoseCoupon() }, methods: { - getCoupon(){ - couponListGet().then(res=>{ - console.log('优惠券',res) - }) - }, + async getCoupon(){ + let that = this + const back_data = await userCouponList(that.queryParams) + console.log(back_data,'优惠券') + const {code,rows,total} = back_data + that.cantotal = total + if(total > 0){ + that.useCouponList =rows + } + }, + async getLoseCoupon() { + let that = this + const back_data = await userCouponListLose(that.loseParams) + console.log(back_data, '失效优惠券') + const { + code, + rows, + total + } = back_data + that.loseTotal = total + if (total > 0) { + that.couponLoseList = rows + } + }, + initial() { let self = this; switch (self.optionData.type) { diff --git a/my/login/login.vue b/my/login/login.vue index fc65a81..667f0c5 100644 --- a/my/login/login.vue +++ b/my/login/login.vue @@ -14,11 +14,15 @@ </template> <script> + import {login} from '@/api/user.js' export default { data() { return { - height:0 + height:0, + loginParams:{ + xcxCode:'' + } } }, onLoad() { @@ -29,7 +33,7 @@ that.height = res.windowHeight } }) - // this.getUserInfo() + this.getUserInfo() }, methods: { // 1.调用微信自带登录方法获取code @@ -37,29 +41,27 @@ let that = this uni.login({ success(res) { - that.loginParams.code = res.code - that.getSessionkeyAndOpenId() - } - }) - uni.getUserInfo({ - success(info) { - that.signature = info.signature - that.rawData = info.rawData + console.log(res,'获取code') + that.getSessionkeyAndOpenId(res.code) } }) }, // 2.获取sessionKey,openId - async getSessionkeyAndOpenId() { - const res = await this.$myRequest({ - url:`/xcxLogin?appid=${this.loginParams.appid}&code=${this.loginParams.code}`, - }) - if(res.data.code == 200){ - let dataObj = JSON.parse(res.data.data) - this.sessionKey = dataObj.sessionKey - this.openid = dataObj.openid - } + async getSessionkeyAndOpenId(code) { + const back_data = await login({xcxCode:code}) + console.log(back_data,'静默登录') }, + // async getSessionkeyAndOpenId() { + // const res = await this.$myRequest({ + // url:`/xcxLogin?appid=${this.loginParams.appid}&code=${this.loginParams.code}`, + // }) + // if(res.data.code == 200){ + // let dataObj = JSON.parse(res.data.data) + // this.sessionKey = dataObj.sessionKey + // this.openid = dataObj.openid + // } + // }, // 3.授权手机号登录拿到encryptedData和iv getPhoneNumber(e) { // 同意登录 diff --git a/pages/demand/components/index.vue b/pages/demand/components/index.vue index 0d2f947..a28dbb4 100644 --- a/pages/demand/components/index.vue +++ b/pages/demand/components/index.vue @@ -20,7 +20,7 @@ <!-- // 已发布 --> <view class="buttoncolor" v-if="subscript == '0'"> <button class="buttoncl" @click.stop="handleAgainAdd(item)">修改</button> - <button class="buttonclde" @click.stop="abolish(1)">取消订单</button> + <button class="buttonclde" @click.stop="abolish(1,item)">取消订单</button> </view> <!-- // 已驳回 --> <view class="d-flex a-end j-sb" v-if="subscript == '1'"> @@ -81,7 +81,8 @@ globalData: getApp().globalData, show: false, title: '确认取消订单吗', - titbut: '取消订单' + titbut: '取消订单', + currentId:'',//当前的id } }, @@ -119,7 +120,9 @@ }); }, // 取消订单1 立即退款2 - abolish(val) { + abolish(val,data) { + console.log(data.id,'数控') + this.currentId = data.id if (val == 1) { this.title = '确认取消订单吗' this.titbut = '1' @@ -151,7 +154,7 @@ }, // 取消订单2 立即退款3 aindexst(val) { - // console.log(val) + this.$emit('getVal',val,this.currentId) this.show = false } } diff --git a/pages/demand/index.vue b/pages/demand/index.vue index 0786d3e..e53b49c 100644 --- a/pages/demand/index.vue +++ b/pages/demand/index.vue @@ -1,174 +1,205 @@ -<template> - <view class="content"> - <com-navbar :leftIcon="false" bgColor="#fff" title="需求" :titleStyle="{ color: '#000000', fontSize: '34rpx' }" /> - <view ></view> - <view class="content-tabs" :style="{ top: `calc(${globalData.statusBarHeight}rpx + 122rpx)` }"> - <view class="content-tabs-text" v-for="(v,index) in list" @click="jump(index)" :key="index"> - <view class="" :style="subscript == index?'color: #000000;' : 'color: #444444;'"> - {{v.name}} - </view> - <view v-show="subscript == index" class="content-tabs-text-area"></view> - </view> - </view> - <template v-if="statusNeedList && statusNeedList.length"> - <comindex :list="statusNeedList" class="content-mindex" :subscript='subscript'></comindex> - </template> - <view v-else class="diagram"> - <image src="@/static/icon/qst.png" mode=""></image> - <view class=""> - 暂无数据 - </view> - </view> - <com-tabbar :list=" [{ - name: '首页', - icon: '/static/tabbar/tb1.png', - selectIcon:'/static/tabbar/td1.png', - url: '/pages/home/index', - type: 'type' - }, { - name: '我的需求', - icon: '/static/tabbar/tb2.png', - selectIcon: '/static/tabbar/td2.png', - url: '/pages/demand/index', - type: 'demand' - }, { - name: '发布', - icon: '/static/tabbar/fb.png', - selectIcon:'/static/tabbar/fb.png', - url: '/pages/release/index', - type: 'type' - }, { - name: '动态', - icon: '/static/tabbar/tb3.png', - selectIcon: '/static/tabbar/td3.png', - url: '/pages/order/index', - type: 'type' - }, { - name:'我的' , - icon:'/static/tabbar/tb4.png' , - selectIcon:'/static/tabbar/td4.png', - url: '/pages/my/index', - type: 'type' - }]"></com-tabbar> - </view> -</template> - +<template> + <view class="content"> + <com-navbar :leftIcon="false" bgColor="#fff" title="需求" :titleStyle="{ color: '#000000', fontSize: '34rpx' }" /> + <view></view> + <view class="content-tabs" :style="{ top: `calc(${globalData.statusBarHeight}rpx + 122rpx)` }"> + <view class="content-tabs-text" v-for="(v,index) in list" @click="jump(index)" :key="index"> + <view class="" :style="subscript == index?'color: #000000;' : 'color: #444444;'"> + {{v.name}} + </view> + <view v-show="subscript == index" class="content-tabs-text-area"></view> + </view> + </view> + <template v-if="statusNeedList && statusNeedList.length"> + <comindex :list="statusNeedList" class="content-mindex" :subscript='subscript' @getVal="handleStatus"></comindex> + </template> + <view v-else class="diagram"> + <image src="@/static/icon/qst.png" mode=""></image> + <view class=""> + 暂无数据 + </view> + </view> + <com-tabbar :list=" [{ + name: '首页', + icon: '/static/tabbar/tb1.png', + selectIcon:'/static/tabbar/td1.png', + url: '/pages/home/index', + type: 'type' + }, { + name: '我的需求', + icon: '/static/tabbar/tb2.png', + selectIcon: '/static/tabbar/td2.png', + url: '/pages/demand/index', + type: 'demand' + }, { + name: '发布', + icon: '/static/tabbar/fb.png', + selectIcon:'/static/tabbar/fb.png', + url: '/pages/release/index', + type: 'type' + }, { + name: '动态', + icon: '/static/tabbar/tb3.png', + selectIcon: '/static/tabbar/td3.png', + url: '/pages/order/index', + type: 'type' + }, { + name:'我的' , + icon:'/static/tabbar/tb4.png' , + selectIcon:'/static/tabbar/td4.png', + url: '/pages/my/index', + type: 'type' + }]"></com-tabbar> + </view> +</template> + <script> - import {myNeedList} from '../../api/system/index.js' - import apiBaseConfig from '@/config/index.js'; - import uniGo from '@/utils/unIGO.js'; - import comindex from '@/pages/demand/components/index.vue' - export default { - data() { - return { - imgBgUrl: apiBaseConfig.imgBgUrl, - globalData: getApp().globalData, - title: 'Hello', - arr:[], - list: [{ - name: '已发布' - }, { - name: '已驳回' - }, { - name: '待支付' - }, { - name: '已接单' - }], - subscript: '0', - needInfo:{ - pageSize:1, - pageNum:10, - status:0 + import { + myNeedList, + removeOrderFunction + } from '../../api/system/index.js' + import apiBaseConfig from '@/config/index.js'; + import uniGo from '@/utils/unIGO.js'; + import comindex from '@/pages/demand/components/index.vue' + export default { + data() { + return { + imgBgUrl: apiBaseConfig.imgBgUrl, + globalData: getApp().globalData, + title: 'Hello', + arr: [], + list: [{ + name: '已发布' + }, { + name: '已驳回' + }, { + name: '待支付' + }, { + name: '已接单' + }], + subscript: '0',//状态 + needInfo: { + pageSize: 1, + pageNum: 10, + status: 0, + deleteStatus:0 }, - statusNeedList:[] - } - }, - components: { - comindex - }, - onLoad(option) { - // console.log(option, 'pppppp') - if(option.id){ - this.subscript = option.id + statusNeedList: [] } - this.getMyNeedList() - }, + }, + components: { + comindex + }, + onLoad(option) { + // console.log(option, 'pppppp') + if (option.id) { + this.subscript = option.id + } + this.getMyNeedList() + }, methods: { - getMyNeedList(){ + getMyNeedList() { let that = this that.needInfo.status = that.subscript - myNeedList(that.needInfo).then(res=>{ - console.log(res,'我的需求') - if(res.code == 200){ - if(res.total > 0){ + myNeedList(that.needInfo).then(res => { + console.log(res, '我的需求') + if (res.code == 200) { + if (res.total > 0) { that.statusNeedList = res.rows - }else{ + } else { that.statusNeedList = [] } } }) - }, + }, jump(ind) { - let that = this + let that = this this.subscript = ind - that.getMyNeedList() - } - } - } -</script> - -<style lang="scss" scoped> - .content { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - - &-tabs { - display: flex; - justify-content: space-around; - width: 100%; - position: fixed; - padding-top: 20rpx; - padding-bottom: 20rpx; - top: -1rpx; - z-index: 999; - background-color: #f3f4f6; - - &-text { - >view:nth-child(1) { - font-size: 24rpx; - } - - &-area { - width: 75rpx; - height: 6rpx; - background: #2C66FF; - } - } - } - - &-mindex { - margin-top: 60rpx; - width: 100%; - margin-bottom: 150rpx; - } - } - - .diagram { - text-align: center; - margin-top: 335rpx; - - >image { - width: 396rpx; - height: 243rpx; - } - - >view { - margin-top: 20rpx; - font-size: 24rpx; - font-weight: 400; - color: #444444; - } - } + that.getMyNeedList() + }, + // 取消订单接口 + async handleCancle(id){ + let that = this + const back_data = await removeOrderFunction({id:id}) + console.log(back_data,'取消') + const {code} = back_data + if(code == 200){ + uni.showToast({ + title:'取消成功!', + icon:'none', + duration:2000, + success() { + setTimeout(()=>{ + that.getMyNeedList() + },1000) + } + }) + } + }, + // 取消订单2 立即退款3 + handleStatus(val,id){ + console.log(val,id,'装订好') + let that = this + if(val == 2){ + that.handleCancle(id) + } + } + } + } +</script> + +<style lang="scss" scoped> + .content { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + + &-tabs { + display: flex; + justify-content: space-around; + width: 100%; + position: fixed; + padding-top: 20rpx; + padding-bottom: 20rpx; + top: -1rpx; + z-index: 999; + background-color: #f3f4f6; + + &-text { + >view:nth-child(1) { + font-size: 24rpx; + } + + &-area { + width: 75rpx; + height: 6rpx; + background: #2C66FF; + } + } + } + + &-mindex { + margin-top: 60rpx; + width: 100%; + margin-bottom: 150rpx; + } + } + + .diagram { + text-align: center; + margin-top: 335rpx; + + >image { + width: 396rpx; + height: 243rpx; + } + + >view { + margin-top: 20rpx; + font-size: 24rpx; + font-weight: 400; + color: #444444; + } + } </style> diff --git a/pages/home/index.vue b/pages/home/index.vue index 5065f3b..8dfc2a1 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -39,7 +39,7 @@ 暂无数据 </view> </view> - <u-loadmore iconSize="50px" @loadmore="loadMore" color="#6A6C6F" fontSize="24rpx" :nomore-text="nomoreText" :loading-text="loadingText" line :status="loadStatus" /> + <u-loadmore v-if="userNeedList && userNeedList.length" iconSize="50px" @loadmore="loadMore" color="#6A6C6F" fontSize="24rpx" :nomore-text="nomoreText" :loading-text="loadingText" line :status="loadStatus" /> </view> <com-navbar :leftIcon="false" :homeShow="false" bgColor="transparent" title="首页" :titleStyle="{ color: '#FFFFFF', fontSize: '32rpx',scrollTopHeader: scrollTopHeader }" /> diff --git a/store/modules/login.js b/store/modules/login.js index aaf60d4..8707a55 100644 --- a/store/modules/login.js +++ b/store/modules/login.js @@ -84,7 +84,8 @@ export default { }) } }, - actions: { + actions: { + async phoneLogin({ commit }, userInfo) { @@ -172,29 +173,6 @@ export default { } } commit('upDateLoginUserMount', obj.userInfo) - // login(params).then(back => { - // const { - // data: dataFrom - // } = back - // // headOrNot 1团长 2消费 - // const { - // headOrNot - // } = dataFrom - // let role; - // headOrNot == 1 ? role = 'head' : role = 'consumer' - // let objForm = { - // token: dataFrom.token, - // userInfo: dataFrom, - // role, - // } - // commit("login", objForm); - // }) - // console.log({ - // code: rev.code, - // encryptedData: obj.encryptedData, - // iv: obj.iv, - // }) - // return dealerPhoneLogin({ code: rev.code, encryptedData: obj.encryptedData, -- libgit2 0.26.0