listComponent.vue 9.5 KB

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