index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <view class="water-container">
  3. <view class="water-date" @click="showDatePicker">
  4. <text>{{ defaultTime }}</text>
  5. <tui-icon name="turningdown" color="#C9CDD4" :size="24"></tui-icon>
  6. </view>
  7. <view class="water-all">
  8. <view class="all-item">
  9. <text>收入</text>
  10. <text>{{ todayWater[0].income || "0" }}</text>
  11. </view>
  12. <view class="all-item">
  13. <text>支出</text>
  14. <text>{{ todayWater[0].expenditure || "0" }}</text>
  15. </view>
  16. </view>
  17. <view class="water-order">
  18. <view class="order-title">订单明细</view>
  19. <template v-if="dayOrderList.length > 0">
  20. <view class="order-list">
  21. <view
  22. class="order-item"
  23. v-for="(item, index) in dayOrderList"
  24. :key="index"
  25. >
  26. <view class="item-text">
  27. <text>订单单号</text>
  28. <text>{{ item.orderFormid }}</text>
  29. </view>
  30. <view class="item-text">
  31. <text>订单金额</text>
  32. <text>{{ item.money }}</text>
  33. </view>
  34. <view class="item-text">
  35. <text>收支类型</text>
  36. <text>{{ item.incomeType }}</text>
  37. </view>
  38. <view class="item-text">
  39. <text>流水类型</text>
  40. <text>{{ item.waterType }}</text>
  41. </view>
  42. <view class="item-text">
  43. <text>到账时间</text>
  44. <text>{{ item.time }}</text>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <template v-else>
  50. <view class="no-data">
  51. <image src="@/static/image/order/empty.png" />
  52. <text>暂无数据</text>
  53. </view>
  54. </template>
  55. </view>
  56. <tui-datetime
  57. ref="dateTime"
  58. :setDateTime="defaultTime"
  59. :type="defaultType"
  60. color="#EA5C1E"
  61. :radius="true"
  62. @confirm="dateConfirm"
  63. ></tui-datetime>
  64. </view>
  65. </template>
  66. <script>
  67. import { getDayDetail } from "@/config/index";
  68. import { getNowDate } from "@/utils/index";
  69. export default {
  70. props: {
  71. type: {
  72. type: String,
  73. default: "",
  74. },
  75. financialData: {
  76. type: Object,
  77. default: () => {},
  78. },
  79. },
  80. created() {
  81. if (this.type == 1) {
  82. this.defaultType = 2;
  83. this.defaultTime = getNowDate(3);
  84. } else if (this.type == 2) {
  85. this.defaultType = 3;
  86. this.defaultTime = getNowDate(2);
  87. }
  88. },
  89. computed: {
  90. // 过滤当日流水
  91. todayWater() {
  92. // 判断当前有没有数据
  93. if (Object.keys(this.financialData).length <= 0) return "";
  94. let list = this.financialData.finances.filter((item) => {
  95. return item.time == this.defaultTime;
  96. });
  97. if (list.length > 0) {
  98. // 给获取当日订单数据参数赋值
  99. this.queryOrder.time = this.defaultTime;
  100. // 请求当日订单数据
  101. this.getDayOrder();
  102. } else {
  103. // 重置订单数据
  104. this.dayOrderList = [];
  105. }
  106. return list;
  107. },
  108. },
  109. data() {
  110. return {
  111. // 请求总流水的参数
  112. waterAll: {
  113. condition: "1",
  114. time: "",
  115. },
  116. // 默认时间
  117. defaultTime: "",
  118. // 控制年月
  119. defaultType: 2,
  120. // 请求 日 订单数据的参数
  121. queryOrder: {
  122. income: "",
  123. page: 1,
  124. pageSize: 10,
  125. state: "",
  126. time: "",
  127. },
  128. // 订单数据列表
  129. dayOrderList: [],
  130. // 订单总数
  131. dayOrderTotal: 0,
  132. };
  133. },
  134. methods: {
  135. // 获取当日订单数据
  136. async getDayOrder() {
  137. let res = await getDayDetail(this.queryOrder);
  138. this.dayOrderList = res.data.list;
  139. this.dayOrderTotal = res.data.total;
  140. },
  141. // 控制日期选择显示
  142. showDatePicker() {
  143. this.$refs.dateTime && this.$refs.dateTime.show();
  144. },
  145. // 日期确定点击
  146. dateConfirm(date) {
  147. // 对日期重新赋值
  148. this.defaultTime = date.result;
  149. },
  150. },
  151. watch: {
  152. type(val) {
  153. if (val == 1) {
  154. this.defaultType = 2;
  155. this.defaultTime = getNowDate(3);
  156. } else if (val == 2) {
  157. this.defaultType = 3;
  158. this.defaultTime = getNowDate(2);
  159. }
  160. },
  161. },
  162. };
  163. </script>
  164. <style lang="scss" scoped>
  165. .water-container {
  166. padding: 0 32rpx;
  167. box-sizing: border-box;
  168. .water-date {
  169. margin: 32rpx 0;
  170. font-size: 28rpx;
  171. color: #3d3d3d;
  172. font-weight: 400;
  173. @include flex(flex-start, null, 13rpx);
  174. }
  175. .water-all {
  176. @include flex(space-between, null);
  177. .all-item {
  178. width: 304rpx;
  179. height: 104rpx;
  180. border-radius: 8rpx;
  181. background-color: #fff3ee;
  182. padding: 16rpx;
  183. box-sizing: border-box;
  184. display: flex;
  185. flex-direction: column;
  186. justify-content: space-between;
  187. text {
  188. &:nth-of-type(1) {
  189. font-size: 24rpx;
  190. color: rgba(77, 51, 39, 0.41);
  191. font-weight: 500;
  192. }
  193. &:nth-of-type(2) {
  194. font-size: 28rpx;
  195. color: #ea5c1e;
  196. font-weight: 900;
  197. }
  198. }
  199. }
  200. }
  201. .water-order {
  202. width: 100%;
  203. margin-top: 32rpx;
  204. .order-title {
  205. position: relative;
  206. color: rgba(0, 0, 0, 0.9);
  207. font-size: 28rpx;
  208. font-weight: 600;
  209. &::after {
  210. content: "";
  211. position: absolute;
  212. left: -32rpx;
  213. top: 50%;
  214. transform: translateY(-50%);
  215. width: 8rpx;
  216. height: 24rpx;
  217. background-color: #ea5c1e;
  218. }
  219. }
  220. .order-list {
  221. width: 100%;
  222. margin-top: 32rpx;
  223. .order-item {
  224. margin-top: 16rpx;
  225. padding: 0 16rpx 16rpx;
  226. box-sizing: border-box;
  227. width: 100%;
  228. background-color: #f5f4f3;
  229. border-radius: 16rpx;
  230. .item-text {
  231. width: 100%;
  232. @include flex(flex-start);
  233. height: 44rpx;
  234. line-height: 44rpx;
  235. padding-top: 16rpx;
  236. text {
  237. font-size: 28rpx;
  238. &:nth-of-type(1) {
  239. width: 208rpx;
  240. color: rgba(0, 0, 0, 0.4);
  241. }
  242. &:nth-of-type(2) {
  243. color: #000000;
  244. overflow: hidden;
  245. text-overflow: ellipsis;
  246. white-space: nowrap;
  247. }
  248. }
  249. }
  250. }
  251. }
  252. .no-data {
  253. height: 736rpx;
  254. @include flex(center, column, 32rpx);
  255. image {
  256. width: 320rpx;
  257. height: 320rpx;
  258. display: block;
  259. }
  260. text {
  261. color: rgba(0, 0, 0, 0.4);
  262. font-size: 28rpx;
  263. font-weight: 600;
  264. }
  265. }
  266. }
  267. }
  268. </style>