listComponent.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <view class="sales-list-component">
  3. <scroll-view class="sales-list-con" :style="{height: scrollH+'px'}" 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.buyerNameCurrent}}</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.sourceTypeDictValue" :text="item.sourceTypeDictValue" :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.sourceType == 'SATELLITE' || item.sourceType == 'SALES' || item.sourceType == '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.sourceType == 'SATELLITE' || item.sourceType == 'SALES' || item.sourceType == '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.sourceType == '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.sourceType == '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. console.log(a,b)
  94. const sys = uni.getSystemInfoSync()
  95. console.log(sys)
  96. if(sys.platform == 'android'){
  97. this.scrollH = sys.windowHeight - a
  98. }else{
  99. if(sys.safeArea.top){
  100. this.scrollH = sys.windowHeight - a + sys.statusBarHeight - 34
  101. }else{
  102. this.scrollH = sys.windowHeight - a - 14
  103. }
  104. }
  105. },
  106. },
  107. mounted() {
  108. this.getList()
  109. },
  110. methods:{
  111. refash(){
  112. this.listData = []
  113. this.totalNum = 0
  114. this.getList(1)
  115. },
  116. // 列表
  117. getList(pageNo){
  118. const _this = this
  119. if (pageNo) {
  120. this.pageNo = pageNo
  121. }
  122. let params = {
  123. pageNo: this.pageNo,
  124. pageSize: this.pageSize,
  125. payOnlineFlag:0
  126. }
  127. this.status = "loading"
  128. console.log(Object.assign(params, this.params))
  129. salesList(Object.assign(params, this.params)).then(res => {
  130. if (res.status == 200) {
  131. if(this.pageNo>1){
  132. this.listData = this.listData.concat(res.data.list || [])
  133. }else{
  134. this.listData = res.data.list || []
  135. }
  136. this.totalNum = res.data.count || 0
  137. } else {
  138. this.listData = []
  139. this.totalNum = 0
  140. this.noDataText = res.message
  141. }
  142. this.status = "loadmore"
  143. })
  144. },
  145. // scroll-view到底部加载更多
  146. onreachBottom() {
  147. if(this.listData.length < this.totalNum){
  148. this.pageNo += 1
  149. this.getList()
  150. }
  151. },
  152. // 查看详情
  153. getDetail(data){
  154. uni.navigateTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify(data) })
  155. },
  156. // 编辑
  157. handleEdit(data){
  158. uni.navigateTo({ url: '/pages/sales/edit?pageType=edit&data='+JSON.stringify(data) })
  159. },
  160. // 操作
  161. handleFun(type, data){
  162. this.dataInfo = data
  163. if(type == 'audit'){ // 审核
  164. this.auditModal = true
  165. }else if(type == 'out'){ // 出库
  166. this.outModal = true
  167. }else if(type == 'del'){ // 删除
  168. this.delText = '确认要删除吗?'
  169. this.delModal = true
  170. }else if(type == 'cancel'){ // 取消
  171. this.delText = '确认要取消吗?'
  172. this.delModal = true
  173. }
  174. },
  175. // 审核通过或不通过
  176. handleAudit(billStatus){
  177. salesWriteAudit({
  178. id: this.dataInfo.id,
  179. billStatus: billStatus
  180. }).then(res => {
  181. if (res.status == 200) {
  182. this.toashMsg(res.message)
  183. this.getList(1)
  184. this.auditModal = false
  185. } else {
  186. this.auditModal = false
  187. }
  188. })
  189. },
  190. // 出库
  191. handleOut(){
  192. salesWriteStockOut({ salesBillSn: this.dataInfo.salesBillSn }).then(res => {
  193. if (res.status == 200) {
  194. this.toashMsg(res.message)
  195. this.getList(1)
  196. this.outModal = false
  197. } else {
  198. this.outModal = false
  199. }
  200. })
  201. },
  202. // 删除
  203. handleDel(){
  204. salesDel({ id: this.dataInfo.id }).then(res => {
  205. if (res.status == 200) {
  206. this.toashMsg(res.message)
  207. this.getList(1)
  208. this.delModal = false
  209. } else {
  210. this.delModal = false
  211. }
  212. })
  213. }
  214. }
  215. }
  216. </script>
  217. <style lang="less">
  218. .sales-list-component{
  219. .color_6{
  220. color: #666;
  221. }
  222. .font_13{
  223. font-size: 26upx;
  224. }
  225. .sales-list-con{
  226. .sales-list-main{
  227. .sales-list-item{
  228. background: #ffffff;
  229. padding: 20upx;
  230. margin: 25upx 0;
  231. border-radius: 20upx;
  232. box-shadow: 1px 1px 3px #EEEEEE;
  233. .list-item-tit{
  234. padding-bottom: 18upx;
  235. padding-top: 10upx;
  236. border-bottom: 1px solid #e4e7ed;
  237. .u-line{
  238. display: inline-block;
  239. width: 6upx;
  240. height: 28upx;
  241. vertical-align: bottom;
  242. margin: 0 10upx;
  243. border-radius: 5upx;
  244. }
  245. .buyer{
  246. flex-grow: 1;
  247. font-size: 28upx;
  248. font-weight: bold;
  249. }
  250. >view{
  251. &:last-child{
  252. width: 160upx;
  253. text-align: right;
  254. color: #666;
  255. font-size: 26upx;
  256. }
  257. }
  258. }
  259. .list-item-con{
  260. padding: 10upx 0;
  261. .list-item-line{
  262. padding: 8upx 0;
  263. }
  264. text{
  265. color: #666;
  266. }
  267. }
  268. .button-box{
  269. text-align: right;
  270. button{
  271. margin: 0 10upx;
  272. }
  273. }
  274. }
  275. }
  276. }
  277. }
  278. </style>