expenseCalendar.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <template>
  2. <view>
  3. <view>
  4. <view>
  5. <u-list @scrolltolower="scrolltolower">
  6. <!-- <view class="listTermDate">
  7. <u-cell-group>
  8. <u-cell :title="from.date" arrow-direction="down" @click="dateShow = true" isLink></u-cell>
  9. </u-cell-group>
  10. <view>
  11. <u-datetime-picker :show="dateShow" closeOnClickOverlay v-model="from.date" mode="date"
  12. @cancel="dateShow = false" @confirm="submitDate" :formatter="formatter"
  13. @change="change">
  14. </u-datetime-picker>
  15. </view>
  16. </view> -->
  17. <view class="hand">
  18. <u-row>
  19. <u-col span="8">
  20. <view class="orgTop">
  21. <uni-row>
  22. <uni-col :span="10">
  23. <u--text text="所属机构" size="22" bold color="#619f8a"></u--text>
  24. </uni-col>
  25. <uni-col :span="24">
  26. <u--text :text="from.organizationName" size="22" bold color="#757575">
  27. </u--text>
  28. </uni-col>
  29. </uni-row>
  30. </view>
  31. </u-col>
  32. <!--<u-col span="4">
  33. <view>
  34. <u-button class="sxButton" size="normal" loadingMode="circle" color="#65c1aa">统计查看
  35. </u-button>
  36. </view>
  37. </u-col> -->
  38. </u-row>
  39. </view>
  40. <view v-if="indexList.length === 0" style="padding: 0 50px;">
  41. <image style="margin: 0 auto; width: 100%;" src="../../../static/img/page/empty_view.png">
  42. </image>
  43. </view>
  44. <view v-for="(item, index) in indexList" :key="index">
  45. <view :data-index="index" class="order-item" @touchstart="drawStart" @touchmove="drawMove"
  46. @touchend="drawEnd" :style="'right:'+item.right+'px'">
  47. <view class="listItemStyle">
  48. <u-row>
  49. <u-col span="2.7">
  50. <view v-if="item.statusText === '已退单'" style="color:red;"
  51. class="orderFoodStyle orderFoodType0">
  52. {{item.statusText}}
  53. </view>
  54. <view v-else class="orderFoodStyle orderFoodType0">
  55. {{item.statusText}}
  56. </view>
  57. </u-col>
  58. <u-col span="7" class="orderFoodStyle orderFoodType">
  59. <view style="font-size: 24rpx;">
  60. 订单:{{item.orderNumber}}
  61. </view>
  62. </u-col>
  63. <u-col span="2.3" textAlign="right">
  64. <view class="moneyText">
  65. {{"- "+item.orderTotal+""}}
  66. </view>
  67. </u-col>
  68. </u-row>
  69. <u-row>
  70. <u-col span="7" class="orderTimeText">{{item.paytime}}</u-col>
  71. <!-- <u-col span="2" class="orderTimeText">
  72. <view style="color: #1787ff;font-size: 34rpx;" @click="toJDPage(item)">
  73. 进度
  74. </view>
  75. </u-col> -->
  76. <u-col span="3" class="orderTimeText">
  77. <view style="color: #1787ff;font-size: 34rpx;" @click="getDetails(item)">
  78. 详情
  79. </view>
  80. </u-col>
  81. <u-col span="2" class="orderTimeText">
  82. <!-- <view v-if="item.isNews === '1'"
  83. style="font-size: 22rpx;color: rgb(55,186,189);" @click="toJDPage(item)">
  84. 新消息
  85. </view> -->
  86. </u-col>
  87. </u-row>
  88. </view>
  89. <view class="remove" @click="delData(item)">退 单
  90. </view>
  91. </view>
  92. </view>
  93. </u-list>
  94. <u-modal :show="modalContent1.show" :title="modalContent1.title" :showCancelButton="true"
  95. confirmColor="#53a591" @confirm="toBack()" @cancel="modalContent1.show = false">
  96. {{modalContent1.content}}
  97. </u-modal>
  98. <u-modal :show="modalContent2.show" :title="modalContent2.title" :content='modalContent2.content'
  99. confirmColor="#53a591" @confirm="modalContent2.show = false">
  100. </u-modal>
  101. </view>
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. export default {
  107. data() {
  108. return {
  109. type: uni.getStorageSync("tabType"),
  110. dateShow: false,
  111. data: {},
  112. from: {
  113. organizationName: ''
  114. },
  115. indexList: [],
  116. modalContent1: {
  117. show: false,
  118. title: '提示',
  119. content: '确认退单吗?'
  120. },
  121. modalContent2: {
  122. show: false,
  123. title: '提示',
  124. content: ''
  125. },
  126. //列表数据(
  127. indexList: [],
  128. //左滑默认宽度
  129. startX: 0,
  130. startY: 0,
  131. delBtnWidth: 90,
  132. pageNum: 1,
  133. pageSize: 10,
  134. total: 1
  135. }
  136. },
  137. onLoad() {
  138. },
  139. onShow() {
  140. this.getExpenseCalendarList()
  141. },
  142. onHide() {
  143. this.getExpenseCalendarList()
  144. },
  145. onUnload: function() {
  146. console.log("-----onUnload------>");
  147. },
  148. methods: {
  149. toJDPage(item) {
  150. uni.setStorageSync('order', item)
  151. this.$goto('../orderProcess')
  152. },
  153. getDetails(item) {
  154. uni.setStorageSync('order', item)
  155. this.$goto('details')
  156. },
  157. async getExpenseCalendarList() {
  158. if (this.indexList.length >= this.total) {
  159. return;
  160. }
  161. const orgInfo = uni.getStorageSync("orgInfo")
  162. this.from.organizationName = orgInfo.organizationName
  163. this.from.userName = uni.getStorageSync('userInfo').userName
  164. this.from.organizationCode = orgInfo.organizationCode
  165. // 发送请求
  166. const {
  167. data: res
  168. } = await this.$httpRequest({
  169. url: '/app/getOrder2?' + "pageNum=" + this.pageNum + "&" + "pageSize=" + this.pageSize,
  170. method: 'post',
  171. data: this.from,
  172. urlType: this.$getUrlType()
  173. });
  174. if (res.code === 200) {
  175. this.total = res.total
  176. this.loadmore(res.rows)
  177. }
  178. },
  179. async toBack(item) {
  180. this.modalContent1.show = false;
  181. // 发送请求
  182. const {
  183. data: res
  184. } = await this.$httpRequest({
  185. url: '/app/backOd?on=' + uni.getStorageSync("orderNumber"),
  186. method: 'get',
  187. data: this.from,
  188. urlType: this.$getUrlType()
  189. });
  190. if (res.code === 200) {
  191. uni.showModal({
  192. content: "退单成功",
  193. title: '提示',
  194. showCancel: false,
  195. success() {
  196. uni.redirectTo({
  197. url: 'expenseCalendar'
  198. });
  199. }
  200. })
  201. } else {
  202. this.$showModal(res.msg)
  203. }
  204. },
  205. change(e) {
  206. //this.changeDate = this.result(e.value, e.mode)
  207. },
  208. scrolltolower() {
  209. this.pageNum++;
  210. this.getExpenseCalendarList()
  211. },
  212. loadmore(data) {
  213. if (data.length === 0) {
  214. return;
  215. }
  216. for (var i = 0; i < data.length; i++) {
  217. this.indexList.push(data[i])
  218. }
  219. },
  220. formatter(type, value) {
  221. if (type === 'year') {
  222. return `${value}年`
  223. }
  224. if (type === 'month') {
  225. return `${value}月`
  226. }
  227. if (type === 'day') {
  228. return `${value}日`
  229. }
  230. return value
  231. },
  232. //开始触摸滑动
  233. drawStart(e) {
  234. var touch = e.touches[0];
  235. this.startX = touch.clientX;
  236. this.startY = touch.clientY;
  237. },
  238. //触摸滑动
  239. drawMove(e) {
  240. for (var index in this.indexList) {
  241. this.$set(this.indexList[index], 'right', 0);
  242. }
  243. var item = this.indexList[e.currentTarget.dataset.index];
  244. if (item.zfbz === 2) {
  245. return;
  246. }
  247. if (item.zfbz === 3) {
  248. return;
  249. }
  250. var touch = e.touches[0];
  251. //防止快速滑动影响动画效果
  252. //上滑
  253. if (e.touches[0].clientY - this.startY > 100) {
  254. return;
  255. }
  256. //下滑
  257. if (this.startY - e.touches[0].clientY > 100) {
  258. return;
  259. }
  260. var disX = this.startX - touch.clientX;
  261. if (disX >= 0) {
  262. if (disX > this.delBtnWidth) {
  263. disX = this.delBtnWidth;
  264. }
  265. this.$set(this.indexList[e.currentTarget.dataset.index], 'right', disX);
  266. } else {
  267. this.$set(this.indexList[e.currentTarget.dataset.index], 'right', 0);
  268. }
  269. },
  270. //触摸滑动结束
  271. drawEnd(e) {
  272. var item = this.indexList[e.currentTarget.dataset.index];
  273. //如果滑动距离超过65默认展开按钮
  274. if (item.right >= 65) {
  275. item.right = this.delBtnWidth;
  276. return;
  277. }
  278. //赋值动画初始距离
  279. var dhWidth = item.right;
  280. //每隔 3 毫秒 减少 2px动画距离 实现动画效果
  281. var dhStop = setInterval(() => {
  282. //console.log(item.right)
  283. dhWidth -= 2;
  284. //当动画距离已经为0或小于零 默认列表距离为0
  285. if (dhWidth <= 0) {
  286. item.right = 0;
  287. //清除本次定时器
  288. clearInterval(dhStop)
  289. return;
  290. }
  291. item.right = dhWidth;
  292. }, 3);
  293. },
  294. //删除方法
  295. delData(item) {
  296. this.modalContent1.show = true;
  297. uni.setStorageSync("orderNumber", item.orderNumber)
  298. //关闭侧边滑动
  299. item.right = 0
  300. }
  301. }
  302. }
  303. </script>
  304. <style>
  305. .hand {
  306. margin-top: 2px;
  307. padding: 20rpx;
  308. border-radius: 10px 10px 0 0;
  309. background: linear-gradient(to bottom right, #85c1bf, #f1fef9);
  310. }
  311. .orgTop {
  312. margin-bottom: 5px;
  313. }
  314. .sxButton {
  315. width: 100px;
  316. display: flex;
  317. flex-direction: column;
  318. align-items: center;
  319. }
  320. .order-item {
  321. position: relative;
  322. }
  323. .remove {
  324. width: 100px;
  325. height: 100%;
  326. background-color: #57aa8e;
  327. color: white;
  328. position: absolute;
  329. top: 0;
  330. right: -100px;
  331. display: flex;
  332. justify-content: center;
  333. align-items: center;
  334. font-size: 18px;
  335. }
  336. .listTermDate {
  337. padding: 10px 0;
  338. }
  339. .listItemStyle {
  340. background-color: #ffffff;
  341. padding: 15px;
  342. border: 1px solid #d8d8d8;
  343. margin: 10rpx;
  344. }
  345. .orderFoodStyle {
  346. font-size: 20px;
  347. }
  348. .orderFoodType {
  349. color: #000000;
  350. }
  351. .orderFoodType0 {
  352. color: #1787ff;
  353. }
  354. .orderFoodType1 {
  355. color: #da0000;
  356. }
  357. .orderFoodType2 {
  358. color: #00af00;
  359. }
  360. .moneyText {
  361. font-size: 26rpx;
  362. color: #b30000;
  363. }
  364. .orderTimeText {
  365. position: relative;
  366. top: 5px;
  367. color: #bebebe;
  368. font-size: 24rpx;
  369. }
  370. </style>