listComponent.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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. <u-section :title="item.buyerName":right="false" :line-color="$config('primaryColor')"></u-section>
  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. scrollH: 300
  82. }
  83. },
  84. mounted() {
  85. const _this = this
  86. uni.getSystemInfo({
  87. success: function (res) {
  88. const winH = res.windowHeight * 2
  89. _this.scrollH = winH - _this.height - 85
  90. }
  91. })
  92. this.getList()
  93. },
  94. methods:{
  95. // 列表
  96. getList(pageNo){
  97. const _this = this
  98. if (pageNo) {
  99. this.pageNo = pageNo
  100. }
  101. let params = {
  102. pageNo: this.pageNo,
  103. pageSize: this.pageSize
  104. }
  105. salesList(Object.assign(params, this.params)).then(res => {
  106. if (res.status == 200) {
  107. if(this.pageNo>1){
  108. this.listData = this.listData.concat(res.data.list || [])
  109. }else{
  110. this.listData = res.data.list || []
  111. }
  112. this.totalNum = res.data.count || 0
  113. } else {
  114. this.listData = []
  115. this.totalNum = 0
  116. this.noDataText = res.message
  117. }
  118. })
  119. },
  120. // scroll-view到底部加载更多
  121. onreachBottom() {
  122. if(this.listData.length < this.totalNum){
  123. this.pageNo += 1
  124. this.getList()
  125. }
  126. },
  127. // 查看详情
  128. getDetail(data){
  129. uni.navigateTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify(data) })
  130. },
  131. // 编辑
  132. handleEdit(data){
  133. uni.navigateTo({ url: '/pages/sales/edit?pageType=edit&data='+JSON.stringify(data) })
  134. },
  135. // 操作
  136. handleFun(type, data){
  137. this.dataInfo = data
  138. if(type == 'audit'){ // 审核
  139. this.auditModal = true
  140. }else if(type == 'out'){ // 出库
  141. this.outModal = true
  142. }else if(type == 'del'){ // 删除
  143. this.delText = '确认要删除吗?'
  144. this.delModal = true
  145. }else if(type == 'cancel'){ // 取消
  146. this.delText = '确认要取消吗?'
  147. this.delModal = true
  148. }
  149. },
  150. // 审核通过或不通过
  151. handleAudit(billStatus){
  152. salesWriteAudit({
  153. id: this.dataInfo.id,
  154. billStatus: billStatus
  155. }).then(res => {
  156. if (res.status == 200) {
  157. this.toashMsg(res.message)
  158. this.getList(1)
  159. this.auditModal = false
  160. } else {
  161. this.auditModal = false
  162. }
  163. })
  164. },
  165. // 出库
  166. handleOut(){
  167. salesWriteStockOut({ salesBillSn: this.dataInfo.salesBillSn }).then(res => {
  168. if (res.status == 200) {
  169. this.toashMsg(res.message)
  170. this.getList(1)
  171. this.outModal = false
  172. } else {
  173. this.outModal = false
  174. }
  175. })
  176. },
  177. // 删除
  178. handleDel(){
  179. salesDel({ id: this.dataInfo.id }).then(res => {
  180. if (res.status == 200) {
  181. this.toashMsg(res.message)
  182. this.getList(1)
  183. this.delModal = false
  184. } else {
  185. this.delModal = false
  186. }
  187. })
  188. }
  189. }
  190. }
  191. </script>
  192. <style lang="scss">
  193. .sales-list-component{
  194. .color_6{
  195. color: #666;
  196. }
  197. .font_13{
  198. font-size: 26upx;
  199. }
  200. .sales-list-con{
  201. .sales-list-main{
  202. .sales-list-item{
  203. background: #ffffff;
  204. padding: 20upx;
  205. margin-bottom: 25upx;
  206. border-radius: 25upx;
  207. box-shadow: 1px 1px 3px #EEEEEE;
  208. .list-item-tit{
  209. padding-bottom: 12upx;
  210. border-bottom: 1px dashed #e4e7ed;
  211. white-space: nowrap;
  212. overflow: hidden;
  213. text-overflow: ellipsis;
  214. .u-line{
  215. display: inline-block;
  216. width: 8upx;
  217. height: 40upx;
  218. background-color: red;
  219. vertical-align: bottom;
  220. margin: 0 20upx 0 10upx;
  221. }
  222. }
  223. .list-item-con{
  224. padding: 10upx 0;
  225. .list-item-line{
  226. padding: 8upx 0;
  227. }
  228. text{
  229. color: #666;
  230. }
  231. }
  232. .button-box{
  233. text-align: right;
  234. padding-top: 10upx;
  235. border-top: 1px dashed #e4e7ed;
  236. button{
  237. margin: 0 10upx;
  238. }
  239. }
  240. }
  241. }
  242. }
  243. }
  244. </style>