order.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <template>
  2. <view class="app-content">
  3. <view class="order-page">
  4. <view class="input-wrap_box">
  5. <view>
  6. <AppSearchModule placeholder="核销码 / 名称 / 手机号" @input="searchFn"/>
  7. </view>
  8. <view style="padding:0 0upx 0 20upx;" >
  9. <button class="admin-button-com middle blue" @click="showCgStaff">{{ cgStaffName==''?'采购人':'已选择'}}</button>
  10. </view>
  11. </view>
  12. <view class="tabs">
  13. <Tabs :isFixed="false" :tabs="tabs" :currentTab="tabIndex" @change="changeTabEvent" itemWidth="25%"></Tabs>
  14. </view>
  15. <view scroll-y class="order-list">
  16. <view style="margin-left:50upx;padding-bottom:25upx;">
  17. <DateSelect class="bar" top="0" @selectDateFn="selectDateFn" defaultShowName='时间' />
  18. </view>
  19. <block v-if="!$util.isEmpty(list.data)">
  20. <OrderItem v-for="(item, index) in list.data" :key="index" :info="item" @click="gotoDetails(item)"></OrderItem>
  21. </block>
  22. <block v-else>
  23. <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
  24. </block>
  25. </view>
  26. <view class="app-footer open_btn">
  27. <view @click="addEvent" class="admin-button-com big blue">新增采购</view>
  28. </view>
  29. </view>
  30. <uni-popup ref="staffRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
  31. <view style="max-height:90vh;overflow: scroll;">
  32. <view style="margin-left:30upx;margin-top:19upx;font-size:27upx;font-weight:bold;">请选择:</view>
  33. <view style="display:flex;padding:20upx;height:auto;justify-content: space-between;align-items:center;flex-wrap:wrap;max-height:100vh;overflow:auto;">
  34. <view v-for="(item, index) in staffData" :key="index" @tap.stop="getCgStaff(item)" style="margin-bottom:20upx;margin-left:3upx;">
  35. <view style="margin-top:8upx;overflow: hidden;white-space: nowrap;width:120upx;text-align:center;font-weight:bold;font-size:30upx;">{{item.name}}</view>
  36. </view>
  37. </view>
  38. <view style="text-align:center;padding:10upx 0 10upx 0;"><button class="admin-button-com big blue" @click="cancelSelectStaff()">取消选择</button></view>
  39. </view>
  40. </uni-popup>
  41. </view>
  42. </template>
  43. <script>
  44. import Tabs from "@/components/plugin/tabs";
  45. import OrderItem from "./orderItem";
  46. import AppWrapperEmpty from "@/components/app-wrapper-empty";
  47. import { list } from "@/mixins";
  48. import { getPurchaseListApi,getLsRunningOrderNum } from "@/api/purchase";
  49. import AppSearchModule from "@/components/module/app-search";
  50. import DateSelect from "@/components/module/dateSelect";
  51. import { getAllStaff } from "@/api/shop-admin";
  52. export default {
  53. components: {
  54. Tabs,
  55. OrderItem,
  56. AppWrapperEmpty,
  57. AppSearchModule,
  58. DateSelect
  59. },
  60. mixins: [list],
  61. data() {
  62. return {
  63. getappIdList: {},
  64. tabIndex: 0,
  65. lsFhNum:0,
  66. lsShNum:0,
  67. staffData:[],
  68. needRefresh:0,
  69. tabs: [
  70. {
  71. name: "全部",
  72. key: "",
  73. value: "0"
  74. },
  75. {
  76. name: "待入库",
  77. key: "3",
  78. value: "0"
  79. },
  80. {
  81. name: "已入库",
  82. key: "4",
  83. value: "0"
  84. },
  85. {
  86. name: "已取消",
  87. key: "5",
  88. value: "0"
  89. }
  90. ],
  91. T:null,
  92. searchContent:'',
  93. searchTime:'',
  94. startTime:'',
  95. endTime:'',
  96. cgStaffName:'',
  97. cgStaffId:0
  98. }
  99. },
  100. onPullDownRefresh() {
  101. this.resetList();
  102. this.getCgList().then(res => {
  103. uni.stopPullDownRefresh();
  104. });
  105. },
  106. onReachBottom() {
  107. if (!this.list.finished) {
  108. this.getCgList().then((res) => {
  109. uni.stopPullDownRefresh();
  110. })
  111. } else {
  112. uni.stopPullDownRefresh()
  113. }
  114. },
  115. onLoad(){
  116. if(this.option.cgStaffId){
  117. this.cgStaffId = this.option.cgStaffId
  118. }
  119. if(this.option.cgStaffName){
  120. this.cgStaffName = this.option.cgStaffName
  121. }
  122. this.getCgList()
  123. getAllStaff().then(res=>{
  124. if(res.code == 1){
  125. this.staffData = res.data.list ? res.data.list : []
  126. }
  127. })
  128. },
  129. onShow() {
  130. //采购成功之后的订单详情页过来不刷新
  131. if(this.needRefresh == 0){
  132. this.needRefresh = 1
  133. }else{
  134. this.resetList()
  135. this.getCgList()
  136. }
  137. },
  138. methods: {
  139. cancelSelectStaff(){
  140. this.$refs.staffRef.close()
  141. this.cgStaffName = ''
  142. this.cgStaffId = 0
  143. this.resetList()
  144. this.getCgList()
  145. },
  146. cancelShowCgStaff(){
  147. this.$refs.staffRef.close()
  148. },
  149. getCgStaff(staff){
  150. this.$refs.staffRef.close()
  151. this.cgStaffName = staff.name
  152. this.cgStaffId = staff.id
  153. this.resetList()
  154. this.getCgList()
  155. },
  156. showCgStaff(){
  157. this.$refs.staffRef.open('center')
  158. },
  159. searchFn(e){
  160. if (this.$util.isEmpty(e) && this.$util.isEmpty(this.searchContent)){
  161. return false
  162. }
  163. let that = this
  164. if(that.T != null){
  165. clearTimeout(that.T)
  166. }
  167. that.T = setTimeout(function(){
  168. that.searchContent = e
  169. that.resetList()
  170. that.getCgList()
  171. },700)
  172. },
  173. selectDateFn(val) {
  174. this.searchTime = val.searchTime
  175. this.startTime = val.startTime
  176. this.endTime = val.endTime
  177. this.resetList();
  178. this.getCgList();
  179. },
  180. init(){
  181. },
  182. getCgList() {
  183. let ghsId = this.option.ghsId || 0
  184. let status = this.tabs[this.tabIndex].key
  185. let options = {page:this.list.page,status:status,ghsId:ghsId,search:this.searchContent,searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,cgStaffId:this.cgStaffId}
  186. return getPurchaseListApi(options) .then(res => {
  187. this.completes(res);
  188. this.tabs[this.tabIndex].value = res.data.totalNum?res.data.totalNum:0
  189. })
  190. },
  191. changeTabEvent(info) {
  192. const { index } = info;
  193. if (this.tabIndex == index) {
  194. return false;
  195. }
  196. this.tabIndex = index;
  197. this.resetList();
  198. this.getCgList();
  199. },
  200. addEvent() {
  201. uni.navigateTo({ url: `/pagesPurchase/supplier` })
  202. },
  203. gotoDetails(item) {
  204. uni.navigateTo({ url: `/pagesPurchase/info?orderSn=${item.orderSn}` })
  205. }
  206. }
  207. };
  208. </script>
  209. <style lang="scss" scoped>
  210. .order-page {
  211. height: 100%;
  212. display: flex;
  213. flex-direction: column;
  214. background-color: #f9fbfc;
  215. .input-wrap_box {
  216. background-color: #fff;
  217. height: 100upx;
  218. display: flex;
  219. align-items: center;
  220. padding: 0 30upx;
  221. & > view:nth-child(1) {
  222. flex: 1;
  223. }
  224. }
  225. .order-list {
  226. padding-top:20upx;
  227. padding-bottom:100upx;
  228. flex: 1;
  229. .allot-item {
  230. margin-bottom: 1upx;
  231. padding: 30upx;
  232. display: flex;
  233. align-items: center;
  234. box-shadow: 0upx 1upx 0upx 0upx #eeeeee;
  235. background-color: #fff;
  236. .info {
  237. flex: 1;
  238. margin-right: 20upx;
  239. .info-order {
  240. font-size: 32upx;
  241. font-weight: 600;
  242. color: #333333;
  243. }
  244. .info-name {
  245. margin: 40upx 0 20upx;
  246. font-size: 28upx;
  247. font-weight: 400;
  248. color: #666666;
  249. }
  250. .info-time {
  251. margin-right: 30upx;
  252. font-size: 28upx;
  253. font-weight: 400;
  254. color: #666666;
  255. }
  256. }
  257. .status {
  258. display: flex;
  259. flex-direction: column;
  260. align-items: center;
  261. flex-shrink: 0;
  262. width: 100upx;
  263. color: #cccccc;
  264. .status-name {
  265. margin-top: 10upx;
  266. font-size: 24upx;
  267. }
  268. .iconfont {
  269. font-size: 46upx;
  270. }
  271. &.primary {
  272. color: #3385ff;
  273. }
  274. &.gray {
  275. color: #cccccc;
  276. }
  277. &.warn {
  278. color: #ffaf1d;
  279. }
  280. }
  281. }
  282. }
  283. .bar-view {
  284. flex-shrink: 0;
  285. display: flex;
  286. justify-content: flex-end;
  287. align-items: center;
  288. padding: 0 30upx;
  289. width: 100%;
  290. height: 100upx;
  291. box-shadow: 0upx -1upx 6upx 0upx rgba(4, 0, 0, 0.06);
  292. .btn-view {
  293. display: flex;
  294. .admin-button-com {
  295. margin: 0 10upx;
  296. width: 140upx;
  297. }
  298. }
  299. }
  300. .cg-set{
  301. margin-right:60upx;
  302. color:#3385ff;
  303. font-size:30upx;
  304. }
  305. }
  306. </style>