listComponent.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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. uni.navigateTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify(data) })
  128. },
  129. // 操作
  130. handleFun(type, data){
  131. this.dataInfo = data
  132. if(type == 'audit'){ // 审核
  133. this.auditModal = true
  134. }else if(type == 'out'){ // 出库
  135. this.outModal = true
  136. }else if(type == 'del'){ // 删除
  137. this.delText = '确认要删除吗?'
  138. this.delModal = true
  139. }else if(type == 'cancel'){ // 取消
  140. this.delText = '确认要取消吗?'
  141. this.delModal = true
  142. }
  143. },
  144. // 审核通过或不通过
  145. handleAudit(billStatus){
  146. salesWriteAudit({
  147. id: this.dataInfo.id,
  148. billStatus: billStatus
  149. }).then(res => {
  150. if (res.status == 200) {
  151. this.toashMsg(res.message)
  152. this.getList(1)
  153. this.auditModal = false
  154. } else {
  155. this.auditModal = false
  156. }
  157. })
  158. },
  159. // 出库
  160. handleOut(){
  161. salesWriteStockOut({ salesBillSn: this.dataInfo.salesBillSn }).then(res => {
  162. if (res.status == 200) {
  163. this.toashMsg(res.message)
  164. this.getList(1)
  165. this.outModal = false
  166. } else {
  167. this.outModal = false
  168. }
  169. })
  170. },
  171. // 删除
  172. handleDel(){
  173. salesDel({ id: this.dataInfo.id }).then(res => {
  174. if (res.status == 200) {
  175. this.toashMsg(res.message)
  176. this.getList(1)
  177. this.delModal = false
  178. } else {
  179. this.delModal = false
  180. }
  181. })
  182. }
  183. }
  184. }
  185. </script>
  186. <style lang="scss">
  187. .sales-list-component{
  188. .color_6{
  189. color: #666;
  190. }
  191. .font_13{
  192. font-size: 26upx;
  193. }
  194. .sales-list-con{
  195. .sales-list-main{
  196. .sales-list-item{
  197. background: #ffffff;
  198. padding: 20upx;
  199. margin-bottom: 25upx;
  200. border-radius: 25upx;
  201. box-shadow: 1px 1px 3px #EEEEEE;
  202. .list-item-tit{
  203. padding-bottom: 12upx;
  204. border-bottom: 1px dashed #e4e7ed;
  205. white-space: nowrap;
  206. overflow: hidden;
  207. text-overflow: ellipsis;
  208. .u-line{
  209. display: inline-block;
  210. width: 8upx;
  211. height: 40upx;
  212. background-color: red;
  213. vertical-align: bottom;
  214. margin: 0 20upx 0 10upx;
  215. }
  216. }
  217. .list-item-con{
  218. padding: 10upx 0;
  219. .list-item-line{
  220. padding: 8upx 0;
  221. }
  222. text{
  223. color: #666;
  224. }
  225. }
  226. .button-box{
  227. text-align: right;
  228. padding-top: 10upx;
  229. border-top: 1px dashed #e4e7ed;
  230. button{
  231. margin: 0 10upx;
  232. }
  233. }
  234. }
  235. }
  236. }
  237. }
  238. </style>