listComponent.vue 8.0 KB

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