123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634 |
- <template>
- <view class="pagesCons">
- <view class="tab-body">
- <view class="uTabs">
- <u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false"
- swiperWidth="750"></u-tabs-swiper>
- </view>
- <swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
- <swiper-item class="swiper-item" v-for="(tabs, index) in tabList" :key="index">
- <scroll-view scroll-y class="scroll-view" @scrolltolower="onreachBottom">
- <view class="check-order-list" v-if="index==current" v-for="item in list" :key="item.id"
- @click="viewRow(item)">
- <view class="check-row">
- <view class="createDate">{{item.createDate}}</view>
- <view>{{item.orderStateDictValue}}</view>
- </view>
- <view class="bundle-list" v-for="row in item.orderGoodsList" :key="row.id">
- <view class="img-cont">
- <image :src="row.goodsImages"></image>
- </view>
- <view>
- <view class="ellipsis-two">{{row.goodsName}}</view>
- <view class="bundle-num">
- <view class="num-cont">
- <text class="price-num">{{row.payGold}}</text>
- <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
- </view>
- <view>X {{row.buyQty}}</view>
- </view>
- </view>
- </view>
- <view class="check-row">
- <view class="text-right">
- <text class="total-text">
- 共{{item.goodsNum}}件商品
- </text>
- <view class="num-cont" v-if="item.orderState=='WAIT_PAY'">
- <text class="money-total">应付</text>
- <text class="price-num">{{item.payGold}}</text>
- <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
- </view>
- <view class="num-cont" v-else>
- <text class="money-total">实付</text>
- <text class="price-num">{{item.payGold}}</text>
- <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
- </view>
- </view>
- </view>
- <view class="check-row">
- <view v-if="item.orderState=='WAIT_PAY'" class="text-right left-time">
- <text style="margin-right: 20upx;">
- 支付剩余
- </text>
- <u-count-down @end="getRow"
- style="margin-right: 20upx;" separator ="zh"
- :timestamp="item.leftTimeT" :show-days="false" :show-hours="false"></u-count-down>
- <u-button :custom-style="btnStyle" @click="toPay(item)" shape="circle" type="success" size="medium">去支付</u-button>
- </view>
- <view v-if="item.orderState=='WAIT_SEND'||item.orderState=='SEND_PART'" class="text-right">
- <u-button :custom-style="btnStyle" @click="showTip" shape="circle" size="medium">提醒发货</u-button>
- </view>
- <view v-if="item.orderState=='SEND_ALL'||item.orderState=='SEND_PART'" class="text-right">
- <u-button @click="showLog(item)" :custom-style="btnStyle"
- style="margin-right: 20upx;margin-left: 20upx;" shape="circle" size="medium">查看物流</u-button>
- <u-button :custom-style="btnStyle" @click="showLog(item)" shape="circle" type="primary" size="medium">确认收货</u-button>
- </view>
- <view v-if="item.orderState=='FINISH'" class="text-right">
- <u-button @click="showLog(item)" :custom-style="btnStyle" shape="circle" size="medium">查看物流</u-button>
- </view>
- </view>
- </view>
- <u-empty style="padding-top: 10vh;height: auto;" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'"
- mode="list"></u-empty>
- <view v-if="index==current" style="padding: 20upx;">
- <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
- </view>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- <!-- 提示用户设置支付密码 -->
- <u-modal v-model="showSetPswModal"
- content="请先设置支付密码,才能使用乐豆"
- show-cancel-button
- confirm-text="去设置"
- cancel-text="暂时放弃"
- @confirm="toSetPwd"
- @cancel="showSetPswModal=false"
- ></u-modal>
- <!-- 确认取消弹窗 -->
- <u-modal v-model="showLeavePsw"
- title="确认放弃支付吗?"
- content="您的订单在30分钟内未支付将被取消"
- show-cancel-button
- confirm-text="确认放弃"
- cancel-text="继续支付"
- @confirm="canclePay"
- @cancel="payAgain"
- ></u-modal>
- <!-- 确认支付弹窗 -->
- <u-popup mode="center" :mask-close-able="false" negative-top="300" closeable @close="closePayModal" v-model="showInputPsw" width="500rpx" >
- <view class="slot-content">
- <view>确认支付</view>
- <view class="text-cont">
- <text class="num-big">{{totalPrice}}</text>
- <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
- </view>
- <view class="footer">
- <input
- v-model="password"
- maxlength="30"
- :focus="focus"
- style="text-align: center;"
- type="password"
- placeholder="请输入支付密码"
- @confirm="toPayOrder"/>
- </view>
- <view class="fot-btn">
- <u-button @click="toPayOrder" type="success" >确认支付</u-button>
- </view>
- </view>
- </u-popup>
- </view>
- </template>
- <script src="assets/global/plugins/passwordguard/js/jsencrypt.min.js" type="text/javascript"></script>
- <script>
- import {
- getLookUpDatas,
- listLookUp
- } from '@/api/data'
- import {
- getOrderList, signPay, existPayPwd
- } from '@/api/order.js'
- import moment from 'moment'
- import md5 from 'md5'
- export default {
- components: {},
- data() {
- return {
- btnStyle:{
- width: '180rpx',
- fontSize: '30rpx',
- },
- status: 'loadmore',
- noDataText: '暂无数据',
- tabList: [{
- dispName: '全部',
- typeId: 2,
- queryLabel: [] // tab参数
- },
- {
- dispName: '待支付',
- typeId: 1,
- queryLabel: ['WAIT_PAY'] // tab参数
- },
- {
- dispName: '待发货',
- typeId: 3,
- queryLabel: ['WAIT_SEND'] // tab参数
- },
- {
- dispName: '待收货',
- typeId: 3,
- queryLabel: ['SEND_ALL','SEND_PART'] // tab参数
- },
- {
- dispName: '已完成',
- typeId: 3,
- queryLabel: ['FINISH'] // tab参数
- },
- ],
- current: 0,
- swiperCurrent: 0,
- pageNo: 1,
- pageSize: 10,
- list: [],
- logData: { // 物流信息
- logName: '韵达快递',
- logNum: 12356544544
- },
- total: 0,
- totalPrice: 0, // 支付合计
- password: '', // 支付密码
- focus: false,
- action: 'swiperChange', // 操作类型,上划分页,或左右滑动
- showSetPswModal: false, // 设置支付密码弹窗
- showInputPsw: false, // 打开输入密码弹窗
- showLeavePsw: false, // 打开确定放弃弹窗
- payFinish: false ,// 是否支付成功
- userData: null
- }
- },
- onLoad() {
- this.userData = this.$store.state.vuex_userData
- // 监听设置密码是否成功
- uni.$once('setPswSuccess', this.setPsw)
- // 监听页面刷新事件 在详情支付成功后或在物流确认收货后刷新列表
- uni.$on('refresh', this.handleRefresh)
- this.pageInit()
- // 开启分享
- uni.showShareMenu({
- withShareTicket: true,
- menus: ['shareAppMessage', 'shareTimeline']
- })
- },
- onUnload() {
- uni.$off('refresh', this.handleRefresh)
- },
- onShow() {
- this.getRow(1) // 解决安卓息屏后倒计时不走问题
- },
- // 下拉刷新
- onPullDownRefresh() {
- console.log('refresh')
- this.pageNo = 1
- this.getRow()
- setTimeout(function () {
- uni.stopPullDownRefresh()
- }, 200)
- },
- methods: {
- pageInit() {
- this.sortIndex = 1
- this.pageNo = 1
- this.getRow()
- },
- handleRefresh() {
- this.getRow()
- },
- // tabs通知swiper切换
- tabsChange(index) {
- this.swiperCurrent = index;
- },
- swiperChange(event) {
- this.action = 'swiperChange'
- this.status = 'loading'
- },
- // swiper-item左右移动,通知tabs的滑块跟随移动
- transition(e) {
- let dx = e.detail.dx;
- this.$refs.uTabs.setDx(dx);
- },
- // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
- // swiper滑动结束,分别设置tabs和swiper的状态
- animationfinish(e) {
- let current = e.detail.current;
- let isCurtab = this.current == current
- if (this.status != "nomore") {
- let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab;
- if (loadData) {
- this.$refs.uTabs.setFinishCurrent(current);
- this.swiperCurrent = current;
- this.current = current;
- this.resetPage();
- }
- }
- },
- // scroll-view到底部加载更多
- onreachBottom() {
- this.action = 'onreachBottom'
- if (this.list.length < this.total) {
- this.pageNo += 1
- this.getRow()
- } else {
- if(this.list.length) {
- uni.showToast({
- title: '已经到底了',
- icon: 'none'
- });
- }
- this.status = "nomore"
- }
- },
- // 查询列表
- getRow(pageNo) {
- this.status = "loadmore"
- if (pageNo) {
- this.pageNo = pageNo
- }
- let params = {
- pageNo: this.pageNo,
- pageSize: this.pageSize,
- orderStateList: this.tabList[this.current].queryLabel, // tab分类
- }
- this.noDataText = '暂无数据'
- this.status = "loading"
- getOrderList(params).then(res => {
- if (res.status == 200) {
- if (this.pageNo > 1) {
- this.list = this.list.concat(res.data.list || [])
- } else {
- this.list = res.data.list || []
- }
- const date1 = moment().toArray() // 当前时间 数组形式
- this.list.map(item=>{
- const date2 = moment(item.orderTime).toDate() // 下单时间 日期格式
- const date3 = moment(date2).toArray() // 下单时间 数组形式
- const tt = 1800 - moment(date1).diff(moment(date3), 'seconds')// 距离30分钟支付 当前剩余秒数 = 1800秒 - 计算相差的秒数(当前时间-支付时间)
- item.leftTimeT = tt > 0 ? tt : 0
- })
- this.total = res.data.count || 0
- } else {
- this.list = []
- this.total = 0
- this.noDataText = res.message
- }
- this.status = "loadmore"
- })
- },
- resetPage() {
- this.status = 'loading';
- // 上划分页
- if (this.action == 'onreachBottom') {
- this.getRow();
- }
- // 左右切换tab
- if (this.action == 'swiperChange') {
- this.list = [];
- this.getRow(1);
- }
- },
- // 获取查询参数 刷新列表
- refresh(params) {
- // console.log(params,'1111111111')
- this.searchParams = params
- this.getRow(1)
- },
-
- // 跳转到设置支付密码页
- toSetPwd () {
- uni.navigateTo({
- url:"/pages/userCenter/userInfo/smsVerification"
- })
- },
- // 设置密码成功, 打开输入密码弹窗
- setPsw (e) {
- if (e.success) {
- this.showInputPsw = true
- setTimeout(()=>{
- this.focus = true
- },300)
- }
- },
- // 关闭输入密码弹窗
- closePayModal(){
- if(!this.payFinish) {
- this.showLeavePsw = true
- }
- },
- //确认放弃
- canclePay() {
- this.password = ''
- this.showLeavePsw = false
- this.showInputPsw = false
- this.focus = false
- },
- // 继续支付
- payAgain () {
- this.focus = false
- this.showLeavePsw = false
- this.showInputPsw = true
- setTimeout(()=>{
- this.focus = true
- },300)
- },
- // 支付 判断用户是否设置过支付密码
- toPay(item) {
- if(this.userData.customerRole == 9){
- uni.showToast({
- icon:"none",
- title:"抱歉,您目前无法使用乐豆"
- })
- return
- }
- this.orderId = item.id
- this.totalPrice = item.originalGold
- this.payFinish = false
- // 判断用户是否设置过支付密码
- existPayPwd().then(res=>{
- console.log(res,'rrrrrr')
- if(res.status == 200) {
- // 设置过支付密码,输入密码
- if(res.data) {
- this.showInputPsw = true
- setTimeout(()=>{
- this.focus = true
- },300)
- } else {
- // 没设置过支付密码,提示设置密码
- this.showSetPswModal = true
- }
- }
- })
- },
- // 支付
- toPayOrder() {
- if (this.password === '') {
- uni.showToast({
- title: '请先输入支付密码',
- icon: 'none'
- })
- return false
- }
- let params = {
- payPwd: md5(this.password),
- id: this.orderId
- }
- console.log(params,'pppppppppp')
- signPay(params).then(res=>{
- this.btnLoading = false
- if(res.status == 200) {
- // 关闭弹窗 刷新列表
- this.payFinish = true
- this.showInputPsw = false
- this.getRow()
- setTimeout(()=>{
- // 跳转到支付完成界面
- uni.navigateTo({
- url:"/pagesA/toOrder/payFinish?id=" + this.orderId
- })
- },500)
-
- } else{
- this.password = ''
- }
- })
- },
- // 提醒发货
- showTip() {
- uni.showToast({
- title: '已提醒商家发货',
- icon: 'none'
- })
- },
- // 查看物流
- showLog(item) {
- console.log(item, '111111')
- uni.navigateTo({
- url: "/pagesA/order/LogList?orderNo=" + item.orderNo
- })
- },
- // 详细页
- viewRow(item) {
- console.log(item, '111111')
- // 已完成的
- uni.navigateTo({
- url: "/pagesA/order/orderDetail?id=" + item.id
- })
- },
- }
- }
- </script>
- <style lang="scss">
- page {
- height: 100%;
- width: 100%;
- background: #F8F8F8;
- }
- .pagesCons {
- height: 100%;
- width: 100%;
- background: #F8F8F8;
- display: flex;
- flex-direction: column;
- .text-right {
- text-align: right;
- }
- .tab-body {
- flex: 1;
- display: flex;
- flex-direction: column;
- .uTabs {
- border-bottom: 1px solid #EEEEEE;
- box-shadow: 1px 1px 3px #eeeeee;
- }
- .check-list {
- flex: 1;
- overflow-y: scroll;
- .swiper-item {
- width: 100%;
- height: 100%;
- overflow: hidden;
- .scroll-view {
- width: 100%;
- height: 100%;
- overflow: auto;
- }
- }
- }
- // 列表样式
- .check-order-list {
- background: #ffffff;
- padding: 10upx 20upx;
- margin: 25upx;
- border-radius: 6upx;
- box-shadow: 1px 1px 3px #EEEEEE;
- font-size: 28upx;
- .check-row {
- display: flex;
- align-items: center;
- padding: 20upx 10upx;
- .icon-xian {
- text-align: right;
- width: 40upx;
- }
- &:first-child {
- border-bottom: 1px dashed #F8F8F8;
- .createDate {
- color: #666;
- font-size: 26upx;
- margin-left: 10upx;
- }
- }
- &:last-child {
- border-top: 1px dashed #F8F8F8;
- }
- >view {
- &:first-child {
- flex: 1;
- }
- }
- }
- // 订单中商品列表
- .bundle-list {
- display: flex;
- padding: 20upx 10upx;
- font-size: 28upx;
- border-bottom: 1px solid #F8F8F8;
- .img-cont {
- width: 158rpx;
- height: 140upx;
- border-radius: 15upx;
- overflow: hidden;
- >image {
- width: 100%;
- height: 100%;
- }
- }
- >view {
- &:last-child {
- flex: 1;
- padding: 10upx 0;
- margin-left: 20upx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- }
- }
- .bundle-num {
- display: flex;
- justify-content: space-between;
- }
- }
- .btn-cont {
- width: 180upx;
- font-size: 30upx;
- }
- .price-text {
- font-size: 20upx;
- margin-left: 10upx;
- }
- .price-num {
- font-size: 32upx;
- font-weight: 600;
- color: red;
- margin-right: 6rpx;
- }
- .total-text {
- margin-right: 50upx;
- }
- .money-total {
- margin-right: 10upx;
- }
- }
- }
- // 乐豆数量
- .num-cont{
- display: flex;
- align-items: center;
- float: right;
- }
- // 支付密码弹窗
- .slot-content{
- padding: 30upx 0;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: space-between;
- .text-cont{
- width: 100%;
- padding: 60upx 0;
- display: flex;
- align-items: center;
- justify-content: center;
- .num-big{
- font-size: 40upx;
- color: red;
- font-weight: 600;
- margin-right: 6rpx;
- }
- }
- .footer{
- width: 80%;
- border-bottom: 1px solid #b1b1b1;
- margin-bottom: 30upx;
- }
- }
- }
- </style>
|