listComponent.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <view class="sales-list-component">
  3. <scroll-view class="sales-list-con" :style="{height: scrollH+'upx'}" scroll-y @scrolltolower="onreachBottom">
  4. <view class="sales-list-main">
  5. <view class="sales-list-item" v-for="(item, index) in listData" :key="item.id" @click="getDetail(item)">
  6. <view class="list-item-tit flex align_center justify_between">
  7. <view class="u-line" :style="{background: $config('primaryColor')}"></view>
  8. <view class="buyer">{{item.buyerName}}</view>
  9. <view>{{item.billStatusDictValue}} <u-icon name="arrow-right" color="#969da3" size="28"></u-icon></view>
  10. </view>
  11. <view class="list-item-con">
  12. <view class="list-item-line flex align_center justify_between">
  13. <view>
  14. <view style="display: inline-block;margin-right: 6upx;">{{item.salesBillNo}}</view>
  15. <u-tag v-if="item.oosFlag==1" text="急件" :bg-color="$config('errorColor')" mode="dark" shape="circle" size="mini" style="margin-right: 6upx;vertical-align: text-top;" />
  16. <u-tag v-if="item.salesBillSourceDictValue" :text="item.salesBillSourceDictValue" :bg-color="$config('primaryColor')" mode="dark" shape="circle" size="mini" style="vertical-align: text-top;" />
  17. </view>
  18. <view class="color_6 font_13">{{item.createDate || '--'}}</view>
  19. </view>
  20. <view class="list-item-line flex align_center justify_between">
  21. <view>总款数:<text>{{toThousands(item.totalCategory||0)}}</text></view>
  22. <view>总数量:<text>{{toThousands(item.totalQty||0)}}</text></view>
  23. <view>总售价:<text>¥{{toThousands(item.totalAmount||0, 2)}}</text></view>
  24. </view>
  25. <view class="list-item-line flex align_center justify_between">
  26. <view class="flex_1">财务状态:<text>{{item.financialStatusDictValue||'--'}}</text></view>
  27. <view class="flex_1">收款方式:<text>{{item.settleStyleSnDictValue||'--'}}</text></view>
  28. </view>
  29. </view>
  30. <!-- <view class="button-box">
  31. <u-button @click="handleFun('audit', item)" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none" v-if="item.billStatus == 'WAIT_AUDIT'">审核</u-button>
  32. <u-button @click="handleFun('out', item)" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none" v-if="item.billStatus == 'WAIT_OUT_WAREHOUSE'">出库</u-button>
  33. <u-button @click="handleEdit(item)" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none" v-if="(item.salesBillSource == 'SATELLITE' || item.salesBillSource == 'SALES' || item.salesBillSource == 'TEMPORARY_DISPATCHING') && (item.billStatus == 'WAIT_AUDIT' || item.billStatus == 'WAIT_SUBMIT' || item.billStatus == 'AUDIT_REJECT')">编辑</u-button>
  34. <u-button @click="handleFun('del', item)" size="mini" :hair-line="false" shape="circle" plain type="error" hover-class="none" v-if="((item.salesBillSource == 'SATELLITE' || item.salesBillSource == 'SALES' || item.salesBillSource == 'TEMPORARY_DISPATCHING') && item.billStatus != 'FINISH')">删除</u-button>
  35. <u-button @click="handleEdit(item)" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none" v-if="item.salesBillSource == 'PURCHASE' && (item.billStatus == 'WAIT_AUDIT' || item.billStatus == 'SUPERIOR_CHANGE')">改单</u-button>
  36. <u-button @click="handleFun('cancel', item)" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none" v-if="item.salesBillSource == 'PURCHASE' && (item.billStatus == 'WAIT_AUDIT' || item.billStatus == 'SUPERIOR_CHANGE')">取消</u-button>
  37. </view> -->
  38. </view>
  39. <view v-if="listData && listData.length == 0 && status!='loading'">
  40. <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="150" :text="noDataText" mode="list" :margin-top="50"></u-empty>
  41. </view>
  42. <view style="padding-bottom: 20upx;">
  43. <u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
  44. </view>
  45. </view>
  46. </scroll-view>
  47. <!-- 审核弹框 -->
  48. <common-modal :openModal="auditModal" content="请点击下方按钮确认操作" confirmText="审核通过" cancelText="审核不通过" :isClose="true" @confirm="handleAudit('WAIT_OUT_WAREHOUSE')" @cancel="handleAudit('AUDIT_REJECT')" @close="auditModal=false" />
  49. <!-- 出库弹框 -->
  50. <common-modal :openModal="outModal" content="确认要出库吗?" @confirm="handleOut" @close="outModal=false" />
  51. <!-- 删除/取消弹框 -->
  52. <common-modal :openModal="delModal" :content="delText" @confirm="handleDel" @close="delModal=false" />
  53. </view>
  54. </template>
  55. <script>
  56. import commonModal from '@/pages/common/commonModal.vue'
  57. import { toThousands } from '@/libs/tools'
  58. import copyText from '@/pages/common/copyText.vue'
  59. import { salesList, salesWriteAudit, salesWriteStockOut, salesDel } from '@/api/sales'
  60. export default{
  61. components: { commonModal, copyText },
  62. props: {
  63. height: { // 非滚动区域高度 upx
  64. type: [String ,Number],
  65. default: 300
  66. },
  67. params: { // 列表查询条件
  68. type: Object,
  69. default: () => {
  70. return {}
  71. }
  72. }
  73. },
  74. data(){
  75. return{
  76. listData: [],
  77. pageNo: 1,
  78. pageSize: 10,
  79. totalNum: 0,
  80. status: 'loadmore',
  81. noDataText: '暂无数据',
  82. toThousands,
  83. auditModal: false, // 审核弹框
  84. dataInfo: null,
  85. outModal: false, // 出库弹框
  86. delModal: false, // 删除/取消弹框
  87. delText: '确认要删除吗?',
  88. scrollH: 300,
  89. }
  90. },
  91. watch:{
  92. height(a,b){
  93. const sys = uni.getSystemInfoSync()
  94. if(sys.platform == 'android'){
  95. this.scrollH = (sys.windowHeight - sys.statusBarHeight - a) * 2
  96. }else{
  97. if(sys.safeArea.top){
  98. this.scrollH = (sys.windowHeight - a) * 2 + sys.statusBarHeight - 34
  99. }else{
  100. this.scrollH = (sys.windowHeight - a) * 2 - 14
  101. }
  102. }
  103. },
  104. },
  105. mounted() {
  106. this.getList()
  107. },
  108. methods:{
  109. refash(){
  110. this.listData = []
  111. this.totalNum = 0
  112. this.getList(1)
  113. },
  114. // 列表
  115. getList(pageNo){
  116. const _this = this
  117. if (pageNo) {
  118. this.pageNo = pageNo
  119. }
  120. let params = {
  121. pageNo: this.pageNo,
  122. pageSize: this.pageSize
  123. }
  124. this.status = "loading"
  125. console.log(Object.assign(params, this.params))
  126. salesList(Object.assign(params, this.params)).then(res => {
  127. if (res.status == 200) {
  128. if(this.pageNo>1){
  129. this.listData = this.listData.concat(res.data.list || [])
  130. }else{
  131. this.listData = res.data.list || []
  132. }
  133. this.totalNum = res.data.count || 0
  134. } else {
  135. this.listData = []
  136. this.totalNum = 0
  137. this.noDataText = res.message
  138. }
  139. this.status = "loadmore"
  140. })
  141. },
  142. // scroll-view到底部加载更多
  143. onreachBottom() {
  144. if(this.listData.length < this.totalNum){
  145. this.pageNo += 1
  146. this.getList()
  147. }
  148. },
  149. // 查看详情
  150. getDetail(data){
  151. uni.navigateTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify(data) })
  152. },
  153. // 编辑
  154. handleEdit(data){
  155. uni.navigateTo({ url: '/pages/sales/edit?pageType=edit&data='+JSON.stringify(data) })
  156. },
  157. // 操作
  158. handleFun(type, data){
  159. this.dataInfo = data
  160. if(type == 'audit'){ // 审核
  161. this.auditModal = true
  162. }else if(type == 'out'){ // 出库
  163. this.outModal = true
  164. }else if(type == 'del'){ // 删除
  165. this.delText = '确认要删除吗?'
  166. this.delModal = true
  167. }else if(type == 'cancel'){ // 取消
  168. this.delText = '确认要取消吗?'
  169. this.delModal = true
  170. }
  171. },
  172. // 审核通过或不通过
  173. handleAudit(billStatus){
  174. salesWriteAudit({
  175. id: this.dataInfo.id,
  176. billStatus: billStatus
  177. }).then(res => {
  178. if (res.status == 200) {
  179. this.toashMsg(res.message)
  180. this.getList(1)
  181. this.auditModal = false
  182. } else {
  183. this.auditModal = false
  184. }
  185. })
  186. },
  187. // 出库
  188. handleOut(){
  189. salesWriteStockOut({ salesBillSn: this.dataInfo.salesBillSn }).then(res => {
  190. if (res.status == 200) {
  191. this.toashMsg(res.message)
  192. this.getList(1)
  193. this.outModal = false
  194. } else {
  195. this.outModal = false
  196. }
  197. })
  198. },
  199. // 删除
  200. handleDel(){
  201. salesDel({ id: this.dataInfo.id }).then(res => {
  202. if (res.status == 200) {
  203. this.toashMsg(res.message)
  204. this.getList(1)
  205. this.delModal = false
  206. } else {
  207. this.delModal = false
  208. }
  209. })
  210. }
  211. }
  212. }
  213. </script>
  214. <style lang="less">
  215. .sales-list-component{
  216. .color_6{
  217. color: #666;
  218. }
  219. .font_13{
  220. font-size: 26upx;
  221. }
  222. .sales-list-con{
  223. .sales-list-main{
  224. .sales-list-item{
  225. background: #ffffff;
  226. padding: 20upx;
  227. margin: 25upx 0;
  228. border-radius: 20upx;
  229. box-shadow: 1px 1px 3px #EEEEEE;
  230. .list-item-tit{
  231. padding-bottom: 18upx;
  232. padding-top: 10upx;
  233. border-bottom: 1px solid #e4e7ed;
  234. .u-line{
  235. display: inline-block;
  236. width: 6upx;
  237. height: 28upx;
  238. vertical-align: bottom;
  239. margin: 0 10upx;
  240. border-radius: 5upx;
  241. }
  242. .buyer{
  243. flex-grow: 1;
  244. font-size: 28upx;
  245. font-weight: bold;
  246. }
  247. >view{
  248. &:last-child{
  249. width: 150upx;
  250. text-align: right;
  251. color: #666;
  252. font-size: 26upx;
  253. }
  254. }
  255. }
  256. .list-item-con{
  257. padding: 10upx 0;
  258. .list-item-line{
  259. padding: 8upx 0;
  260. }
  261. text{
  262. color: #666;
  263. }
  264. }
  265. .button-box{
  266. text-align: right;
  267. button{
  268. margin: 0 10upx;
  269. }
  270. }
  271. }
  272. }
  273. }
  274. }
  275. </style>