list.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <view class="app-main app-content">
  3. <view class="input-wrap_box">
  4. <view @click="setSearchType" style="font-size:30upx;margin-right:10upx;color:#666666">
  5. <text>编号</text>
  6. </view>
  7. <view> <AppSearchModule placeholder="请输入编号" @input="searchFn"/> </view>
  8. <view class="select-dn_bx">
  9. <DateSelect class="bar" top="0" @selectDateFn="selectDateFn" defaultShowName='时间' />
  10. </view>
  11. </view>
  12. <view class="app-tabs">
  13. <app-tabs :tabs="tabs" :isFixed="false" :top="50" :currentTab="tabIndex" :height="100" @change="change" itemWidth="33%" />
  14. </view>
  15. <div class="list-wrap">
  16. <block v-if="!$util.isEmpty(list.data)">
  17. <div class="list" v-for="(item, index) in list.data" :key="index">
  18. <workItem :item="item" @cancel="cancel" @printWork="printWork"></workItem>
  19. </div>
  20. </block>
  21. <block v-else>
  22. <app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
  23. </block>
  24. </div>
  25. <view class="app-footer"> <view class="admin-button-com middle blue" style="margin-right:60upx;font-size:30upx;height:70upx;line-height:70upx;width:160upx;" @click="pageTo({url:'/admin/work/add'})">新增</view> </view>
  26. </view>
  27. </template>
  28. <script>
  29. import AppTabs from "@/components/plugin/tabs";
  30. import NotLogin from "@/components/not-login";
  31. import AppWrapperEmpty from "@/components/app-wrapper-empty";
  32. import ModalModule from "@/components/plugin/modal";
  33. import { list } from "@/mixins";
  34. import { mapGetters } from "vuex";
  35. import { getWorkList,cancelWork,print} from "@/api/work";
  36. import AppSearchModule from "@/components/module/app-search";
  37. import DropShopSelect from "@/components/module/shopSelect";
  38. import workItem from "./components/workItem";
  39. import DateSelect from "@/components/module/dateSelect";
  40. export default {
  41. name: "list",
  42. components: {
  43. AppTabs,
  44. AppWrapperEmpty,
  45. ModalModule,
  46. AppSearchModule,
  47. DropShopSelect,
  48. workItem,
  49. DateSelect,
  50. NotLogin
  51. },
  52. mixins: [list],
  53. computed: { ...mapGetters(["getLoginInfo", "getDictionariesInfo"]) },
  54. data() {
  55. return {
  56. orderId:'',
  57. seekVal: "",
  58. isShow: false,
  59. customizationTime: [],
  60. customizationTimeType: "",
  61. tabIndex: 0,
  62. tabs: [
  63. {
  64. name: "全部",
  65. value: '',
  66. id: -1,
  67. },
  68. {
  69. name: "待完成",
  70. value: '',
  71. id: 0,
  72. },
  73. {
  74. name: "已完成",
  75. value: '',
  76. id: 1,
  77. }
  78. ],
  79. selectItemId: "",
  80. operateIndex: null,
  81. operateData: {},
  82. classifyForm: {
  83. categoryId: "",
  84. usageId: "",
  85. },
  86. searchType:0,
  87. searchTypeName:'名称',
  88. searchTime:'',
  89. startTime:'',
  90. endTime:''
  91. };
  92. },
  93. onPullDownRefresh() {
  94. this.resetList();
  95. this._list()
  96. uni.stopPullDownRefresh()
  97. },
  98. onReachBottom() {
  99. if (!this.list.finished) {
  100. this._list().then((res) => {
  101. uni.stopPullDownRefresh();
  102. });
  103. } else {
  104. uni.stopPullDownRefresh();
  105. }
  106. },
  107. mounted() {
  108. },
  109. onLoad() {
  110. let tabIndex = uni.getStorageSync("switchTabQuery") || null;
  111. if (tabIndex) {
  112. uni.removeStorageSync("switchTabQuery");
  113. this.tabIndex = parseInt(tabIndex.tabIndex);
  114. }
  115. this._list();
  116. },
  117. methods: {
  118. printWork(item){
  119. print({id:item.id}).then(res=>{
  120. if(res.code == 1){
  121. this.$msg(res.msg)
  122. }
  123. })
  124. },
  125. cancel(item){
  126. let that = this
  127. that.$util.confirmModal({content:'确认取消?'},() => {
  128. cancelWork({id:item.id}).then(res=>{
  129. if(res.code == 1){
  130. item.status = 2
  131. that.$msg('取消成功')
  132. }
  133. })
  134. })
  135. },
  136. setSearchType(){
  137. let that = this
  138. uni.showActionSheet({
  139. itemList: ['搜索类型:', '名称', '编号'],
  140. success: function (respond) {
  141. let currentIndex = respond.tapIndex
  142. if(currentIndex == 0){
  143. return false
  144. }
  145. that.searchType = Number(currentIndex) - 1
  146. that.searchTypeName = that.searchType == 0 ? '名称' : '编号'
  147. that.searchFn()
  148. }
  149. })
  150. },
  151. selectDateFn(val) {
  152. this.searchTime = val.searchTime
  153. this.startTime = val.startTime
  154. this.endTime = val.endTime
  155. this.resetList();
  156. this._list();
  157. },
  158. searchFn(e) {
  159. this.resetList();
  160. this.seekVal = e;
  161. this._list()
  162. },
  163. _list() {
  164. return getWorkList({
  165. searchTime: this.searchTime,
  166. startTime: this.startTime,
  167. endTime: this.endTime,
  168. status: this.tabs[this.tabIndex].id,
  169. name: this.seekVal,
  170. page: this.list.page,
  171. searchType:this.searchType,
  172. }).then((res) => {
  173. this.completes(res);
  174. if (this.$util.isEmpty(res.data)){
  175. return false
  176. }
  177. });
  178. },
  179. change(e) {
  180. if (this.tabIndex == e.index) {
  181. return false;
  182. } else {
  183. this.tabIndex = e.index;
  184. this.resetList();
  185. this._list();
  186. }
  187. },
  188. classifyOrder(id) {
  189. this.currentOrderId = id;
  190. },
  191. },
  192. };
  193. </script>
  194. <style lang="scss" scoped>
  195. .admin-button-com {
  196. width: 140upx;
  197. height: 60upx;
  198. padding: 0;
  199. line-height: 60upx;
  200. text-align: center;
  201. font-size: 26upx;
  202. &.active {
  203. border: 1upx solid #ccc;
  204. }
  205. }
  206. page{
  207. width: 750upx;
  208. overflow: hidden;
  209. }
  210. .app-content {
  211. padding-top: 100upx;
  212. padding-bottom: 1upx;
  213. overflow: hidden;
  214. .select-dn_bx {
  215. padding-left: 18upx;
  216. }
  217. .app-tabs {
  218. position: fixed;
  219. /* 手机mobile屏幕小于1000px */
  220. @media screen and (max-width: 1100px) {
  221. width: 100%;
  222. }
  223. /* 收银台cashier屏幕大于1000px */
  224. @media screen and (min-width:1100px) {
  225. width: 40%;
  226. }
  227. z-index: 9;
  228. }
  229. .input-wrap_box {
  230. background-color: #fff;
  231. position: fixed;
  232. top: 0;
  233. z-index: 10;
  234. /* 手机mobile屏幕小于1000px */
  235. @media screen and (max-width: 1100px) {
  236. width: 100%;
  237. }
  238. /* 收银台cashier屏幕大于1000px */
  239. @media screen and (min-width:1100px) {
  240. width: 40%;
  241. }
  242. height: 100upx;
  243. display: flex;
  244. align-items: center;
  245. padding: 0 30upx;
  246. & > view:nth-child(2) {
  247. flex: 1;
  248. }
  249. }
  250. .list-wrap {
  251. padding-top: 100upx;
  252. .list {
  253. background-color: #fff;
  254. margin-bottom: 20upx;
  255. }
  256. }
  257. .app-footer {
  258. justify-content: flex-end;
  259. }
  260. }
  261. .upload-confirm-wrap {
  262. max-height: 600upx;
  263. overflow-y: auto;
  264. .modal-tit {
  265. @include disFlex(center, center);
  266. font-size: 40upx;
  267. margin-top: 30upx;
  268. margin-bottom: 50upx;
  269. .iconfont {
  270. color: #09bb07;
  271. margin-right: 20upx;
  272. font-size: 50upx;
  273. }
  274. }
  275. .sel-wrap {
  276. color: $fontColor2;
  277. font-size: 32upx;
  278. .sel-tit {
  279. text-align: left;
  280. }
  281. .sel-btn {
  282. @include disFlex(center, flex-start);
  283. flex-wrap: wrap;
  284. padding: 10upx 0 40upx;
  285. .admin-button-com {
  286. margin-right: 20upx;
  287. margin-top: 20upx;
  288. padding-top: 16upx;
  289. padding-bottom: 16upx;
  290. border-radius: 4upx;
  291. }
  292. }
  293. }
  294. }
  295. </style>