123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377 |
- <template>
- <view>
- <view>
- <view>
- <u-list @scrolltolower="scrolltolower">
- <!-- <view class="listTermDate">
- <u-cell-group>
- <u-cell :title="from.date" arrow-direction="down" @click="dateShow = true" isLink></u-cell>
- </u-cell-group>
- <view>
- <u-datetime-picker :show="dateShow" closeOnClickOverlay v-model="from.date" mode="date"
- @cancel="dateShow = false" @confirm="submitDate" :formatter="formatter"
- @change="change">
- </u-datetime-picker>
- </view>
- </view> -->
- <view class="hand">
- <u-row>
- <u-col span="8">
- <view class="orgTop">
- <uni-row>
- <uni-col :span="10">
- <u--text text="所属机构" size="22" bold color="#619f8a"></u--text>
- </uni-col>
- <uni-col :span="24">
- <u--text :text="from.organizationName" size="22" bold color="#757575">
- </u--text>
- </uni-col>
- </uni-row>
- </view>
- </u-col>
- <!--<u-col span="4">
- <view>
- <u-button class="sxButton" size="normal" loadingMode="circle" color="#65c1aa">统计查看
- </u-button>
- </view>
- </u-col> -->
- </u-row>
- </view>
- <view v-if="indexList.length === 0" style="padding: 0 50px;">
- <image style="margin: 0 auto; width: 100%;" src="../../../static/img/page/empty_view.png">
- </image>
- </view>
- <view v-for="(item, index) in indexList" :key="index">
- <view :data-index="index" class="order-item" @touchstart="drawStart" @touchmove="drawMove"
- @touchend="drawEnd" :style="'right:'+item.right+'px'">
- <view class="listItemStyle">
- <u-row>
- <u-col span="3">
- <view class="orderFoodStyle orderFoodType0">
- {{item.statusText}}
- </view>
- </u-col>
- <u-col span="5" class="orderFoodStyle orderFoodType">
- <view style="font-size: 24rpx;">
- 订单:{{item.orderNumber}}
- </view>
- </u-col>
- <u-col span="4" textAlign="right">
- <view class="moneyText">
- {{"- "+item.orderTotal+""}}
- </view>
- </u-col>
- </u-row>
- <u-row>
- <u-col span="7" class="orderTimeText">{{item.paytime}}</u-col>
- <!-- <u-col span="2" class="orderTimeText">
- <view style="color: #1787ff;font-size: 34rpx;" @click="toJDPage(item)">
- 进度
- </view>
- </u-col> -->
- <u-col span="3" class="orderTimeText">
- <view style="color: #1787ff;font-size: 34rpx;" @click="getDetails(item)">
- 详情
- </view>
- </u-col>
- <u-col span="2" class="orderTimeText">
- <view v-if="item.isNews === '1'"
- style="font-size: 22rpx;color: rgb(55,186,189);" @click="toJDPage(item)">
- 新消息
- </view>
- </u-col>
- </u-row>
- </view>
- <view class="remove" @click="delData(item)">退 单
- </view>
- </view>
- </view>
- </u-list>
- <u-modal :show="modalContent1.show" :title="modalContent1.title" :showCancelButton="true"
- confirmColor="#53a591" @confirm="toBack()" @cancel="modalContent1.show = false">
- {{modalContent1.content}}
- </u-modal>
- <u-modal :show="modalContent2.show" :title="modalContent2.title" :content='modalContent2.content'
- confirmColor="#53a591" @confirm="modalContent2.show = false">
- </u-modal>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- type: uni.getStorageSync("tabType"),
- dateShow: false,
- data: {},
- from: {
- organizationName: ''
- },
- indexList: [],
- modalContent1: {
- show: false,
- title: '提示',
- content: '确认退单吗?'
- },
- modalContent2: {
- show: false,
- title: '提示',
- content: ''
- },
- //列表数据(
- indexList: [],
- //左滑默认宽度
- startX: 0,
- startY: 0,
- delBtnWidth: 90,
- pageNum: 1,
- pageSize: 10,
- total: 1
- }
- },
- onLoad() {
- },
- onShow() {
- this.getExpenseCalendarList()
- },
- onHide() {
- this.getExpenseCalendarList()
- },
- onUnload: function() {
- console.log("-----onUnload------>");
- },
- methods: {
- toJDPage(item) {
- uni.setStorageSync('order', item)
- this.$goto('../orderProcess')
- },
- getDetails(item) {
- uni.setStorageSync('order', item)
- this.$goto('details')
- },
- async getExpenseCalendarList() {
- if (this.indexList.length >= this.total) {
- return;
- }
- const orgInfo = uni.getStorageSync("orgInfo")
- this.from.organizationName = orgInfo.organizationName
- this.from.userName = uni.getStorageSync('userInfo').userName
- this.from.organizationCode = orgInfo.organizationCode
- // 发送请求
- const {
- data: res
- } = await this.$httpRequest({
- url: '/app/getOrder2?' + "pageNum=" + this.pageNum + "&" + "pageSize=" + this.pageSize,
- method: 'post',
- data: this.from,
- urlType: this.$getUrlType()
- });
- if (res.code === 200) {
- this.total = res.total
- this.loadmore(res.rows)
- }
- },
- async toBack(item) {
- this.modalContent1.show = false;
- // 发送请求
- const {
- data: res
- } = await this.$httpRequest({
- url: '/app/giftBack?orderId=' + uni.getStorageSync("orderNumber"),
- method: 'get',
- data: this.from,
- urlType: this.$getUrlType()
- });
- if (res.code === 200) {
- this.$showModal('退单成功')
- uni.redirectTo({
- url: 'expenseCalendar'
- });
- } else {
- this.modalContent2.content = res.msg
- this.modalContent2.show = true
- }
- },
- change(e) {
- //this.changeDate = this.result(e.value, e.mode)
- },
- scrolltolower() {
- this.pageNum++;
- this.getExpenseCalendarList()
- },
- loadmore(data) {
- if (data.length === 0) {
- return;
- }
- for (var i = 0; i < data.length; i++) {
- this.indexList.push(data[i])
- }
- },
- formatter(type, value) {
- if (type === 'year') {
- return `${value}年`
- }
- if (type === 'month') {
- return `${value}月`
- }
- if (type === 'day') {
- return `${value}日`
- }
- return value
- },
- //开始触摸滑动
- drawStart(e) {
- var touch = e.touches[0];
- this.startX = touch.clientX;
- this.startY = touch.clientY;
- },
- //触摸滑动
- drawMove(e) {
- for (var index in this.indexList) {
- this.$set(this.indexList[index], 'right', 0);
- }
- var item = this.indexList[e.currentTarget.dataset.index];
- if (item.zfbz === 2) {
- return;
- }
- if (item.zfbz === 3) {
- return;
- }
- var touch = e.touches[0];
- //防止快速滑动影响动画效果
- //上滑
- if (e.touches[0].clientY - this.startY > 100) {
- return;
- }
- //下滑
- if (this.startY - e.touches[0].clientY > 100) {
- return;
- }
- var disX = this.startX - touch.clientX;
- if (disX >= 0) {
- if (disX > this.delBtnWidth) {
- disX = this.delBtnWidth;
- }
- this.$set(this.indexList[e.currentTarget.dataset.index], 'right', disX);
- } else {
- this.$set(this.indexList[e.currentTarget.dataset.index], 'right', 0);
- }
- },
- //触摸滑动结束
- drawEnd(e) {
- var item = this.indexList[e.currentTarget.dataset.index];
- //如果滑动距离超过65默认展开按钮
- if (item.right >= 65) {
- item.right = this.delBtnWidth;
- return;
- }
- //赋值动画初始距离
- var dhWidth = item.right;
- //每隔 3 毫秒 减少 2px动画距离 实现动画效果
- var dhStop = setInterval(() => {
- //console.log(item.right)
- dhWidth -= 2;
- //当动画距离已经为0或小于零 默认列表距离为0
- if (dhWidth <= 0) {
- item.right = 0;
- //清除本次定时器
- clearInterval(dhStop)
- return;
- }
- item.right = dhWidth;
- }, 3);
- },
- //删除方法
- delData(item) {
- this.modalContent1.show = true;
- uni.setStorageSync("orderNumber", item.orderId)
- //关闭侧边滑动
- item.right = 0
- }
- }
- }
- </script>
- <style>
- .hand {
- margin-top: 2px;
- padding: 20rpx;
- border-radius: 10px 10px 0 0;
- background: linear-gradient(to bottom right, #85c1bf, #f1fef9);
- }
- .orgTop {
- margin-bottom: 5px;
- }
- .sxButton {
- width: 100px;
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- .order-item {
- position: relative;
- }
- .remove {
- width: 100px;
- height: 100%;
- background-color: #57aa8e;
- color: white;
- position: absolute;
- top: 0;
- right: -100px;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 18px;
- }
- .listTermDate {
- padding: 10px 0;
- }
- .listItemStyle {
- background-color: #ffffff;
- padding: 15px;
- border: 1px solid #d8d8d8;
- margin: 10rpx;
- }
- .orderFoodStyle {
- font-size: 20px;
- }
- .orderFoodType {
- color: #000000;
- }
- .orderFoodType0 {
- color: #1787ff;
- }
- .orderFoodType1 {
- color: #da0000;
- }
- .orderFoodType2 {
- color: #00af00;
- }
- .moneyText {
- font-size: 26rpx;
- color: #b30000;
- }
- .orderTimeText {
- position: relative;
- top: 5px;
- color: #bebebe;
- font-size: 24rpx;
- }
- </style>
|