index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <view class="sales-warp">
  3. <!--销售数据统计 -->
  4. <view class="content-data">
  5. <view class="date-type">
  6. <text v-for="(item, index) in tabNav" :key="index" :class="[index == navInd ? 'active_day' : '']" @click="seleteTime(index)">{{item.name}}</text>
  7. </view>
  8. <view class="total">
  9. <view class="item-box">
  10. <u-count-to v-if="navInd==0" :end-val="bizData&&bizData.sales&&(bizData.sales.dayTotalQty || bizData.sales.dayTotalQty==0) ? bizData.sales.dayTotalQty : 0" separator=","></u-count-to>
  11. <u-count-to v-if="navInd==1" :end-val="bizData&&bizData.sales&&(bizData.sales.weekSalesQty || bizData.sales.weekSalesQty==0) ? bizData.sales.weekSalesQty : 0" separator=","></u-count-to>
  12. <u-count-to v-if="navInd==2" :end-val="bizData&&bizData.sales&&(bizData.sales.monthSalesQty || bizData.sales.monthSalesQty==0) ? bizData.sales.monthSalesQty : 0" separator=","></u-count-to>
  13. <view>销售总单量(个)</view>
  14. </view>
  15. <view class="item-box">
  16. <u-count-to v-if="navInd==0" :end-val="bizData&&bizData.sales&&(bizData.sales.dayTotalAmount || bizData.sales.dayTotalAmount==0) ? bizData.sales.dayTotalAmount : 0" separator="," :decimals="2"></u-count-to>
  17. <u-count-to v-if="navInd==1" :end-val="bizData&&bizData.sales&&(bizData.sales.weekSalesAmount || bizData.sales.weekSalesAmount==0) ? bizData.sales.weekSalesAmount : 0" separator="," :decimals="2"></u-count-to>
  18. <u-count-to v-if="navInd==2" :end-val="bizData&&bizData.sales&&(bizData.sales.monthSalesAmount || bizData.sales.monthSalesAmount==0) ? bizData.sales.monthSalesAmount : 0" separator="," :decimals="2"></u-count-to>
  19. <view>销售总金额(¥)</view>
  20. </view>
  21. </view>
  22. </view>
  23. <!-- 产品报价及新增销售单 -->
  24. <view class="nav-cont flex align_center justify_between">
  25. <view class="nav-item" @click="toPage('/pages/sales/productPricing')">
  26. <u-image class="nav-pic" style="margin-top: 5upx;" :src="`../../static/${theme}/navIcon/price_icon.png`" width="60" height="60"></u-image>
  27. <text class="nav-txt" style="margin-top: 5upx;">产品报价</text>
  28. </view>
  29. <view class="nav-item" @click="toPage('')">
  30. <u-image class="nav-pic" :src="`../../static/${theme}/navIcon/sale_icon.png`" width="70" height="70"></u-image>
  31. <text class="nav-txt">新增销售单</text>
  32. </view>
  33. </view>
  34. <!-- 销售单 -->
  35. <view class="sales-list">
  36. <view class="title">
  37. <text class="title-name">销售单</text>
  38. <view class="title-all" @click="toPage('/pages/sales/list')">查看全部<u-icon name="arrow-right" color="#666" size="28"></u-icon></view>
  39. </view>
  40. <scroll-view class="sales-list-con" scroll-y @scrolltolower="onreachBottom">
  41. <view class="sales-list-main">
  42. <view class="sales-list-item" v-for="(item, index) in listData" :key="item.id" @click="getDetail(item)">
  43. <view class="list-item-tit">
  44. <view class="u-line" :style="{backgroundColor: $config('primaryColor')}"></view>{{item.buyerName}}
  45. </view>
  46. <view class="list-item-con">
  47. <view class="list-item-line flex align_center justify_between">
  48. <view>
  49. <view style="display: inline-block;margin-right: 6upx;">{{item.salesBillNo}}</view>
  50. <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;" />
  51. <u-tag v-if="item.salesBillSourceDictValue" :text="item.salesBillSourceDictValue" :bg-color="$config('primaryColor')" mode="dark" shape="circle" size="mini" style="vertical-align: text-top;" />
  52. </view>
  53. <view class="color_6 font_13">{{item.createDate || '--'}}</view>
  54. </view>
  55. <view class="list-item-line flex align_center justify_between">
  56. <view>总款数:<text>{{toThousands(item.totalCategory||0)}}</text></view>
  57. <view>总数量:<text>{{toThousands(item.totalQty||0)}}</text></view>
  58. <view>总售价:<text>{{toThousands(item.totalAmount||0, 2)}}</text></view>
  59. </view>
  60. <view class="list-item-line flex align_center justify_between">
  61. <view class="flex_1">财务状态:<text>{{item.financialStatusDictValue||'--'}}</text></view>
  62. <view class="flex_1">收款方式:<text>{{item.settleStyleEntity&&item.settleStyleEntity.name||'--'}}</text></view>
  63. </view>
  64. </view>
  65. <view class="button-box">
  66. <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>
  67. <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>
  68. <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>
  69. <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>
  70. <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>
  71. <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>
  72. </view>
  73. </view>
  74. <view v-if="listData && listData.length == 0">
  75. <u-empty :text="noDataText" mode="list" :img-width="200" :margin-top="30"></u-empty>
  76. </view>
  77. </view>
  78. </scroll-view>
  79. </view>
  80. <!-- 审核弹框 -->
  81. <common-modal :openModal="auditModal" content="请点击下方按钮确认操作" confirmText="审核通过" cancelText="审核不通过" :isClose="true" @confirm="handleAudit('WAIT_OUT_WAREHOUSE')" @cancel="handleAudit('AUDIT_REJECT')" @close="auditModal=false" />
  82. <!-- 出库弹框 -->
  83. <common-modal :openModal="outModal" content="确认要出库吗?" @confirm="handleOut" @close="outModal=false" />
  84. <!-- 删除/取消弹框 -->
  85. <common-modal :openModal="delModal" :content="delText" @confirm="handleDel" @close="delModal=false" />
  86. </view>
  87. </template>
  88. <script>
  89. import commonModal from '@/pages/common/commonModal.vue'
  90. import { toThousands } from '@/libs/tools'
  91. import { bizData, salesList, salesWriteAudit, salesWriteStockOut, salesDel } from '@/api/sales'
  92. export default{
  93. components: { commonModal },
  94. data(){
  95. return{
  96. tabNav: [
  97. { name: '今日', ind: 0 },
  98. { name: '本周', ind: 1 },
  99. { name: '本月', ind: 2 }
  100. ],
  101. navInd: 0,
  102. bizData: null, // 销售数据统计
  103. theme: '',
  104. listData: [],
  105. pageNo: 1,
  106. pageSize: 6,
  107. totalNum: 0,
  108. noDataText: '暂无数据',
  109. toThousands,
  110. auditModal: false, // 审核弹框
  111. dataInfo: null,
  112. outModal: false, // 出库弹框
  113. delModal: false, // 删除/取消弹框
  114. delText: '确认要删除吗?'
  115. }
  116. },
  117. onLoad() {
  118. this.theme = getApp().globalData.theme
  119. },
  120. onShow() {
  121. this.getBizData()
  122. this.getList()
  123. },
  124. methods:{
  125. // 列表
  126. getList(pageNo){
  127. const _this = this
  128. if (pageNo) {
  129. this.pageNo = pageNo
  130. }
  131. salesList({ pageNo: this.pageNo, pageSize: this.pageSize }).then(res => {
  132. if (res.status == 200) {
  133. if(this.pageNo>1){
  134. this.listData = this.listData.concat(res.data.list || [])
  135. }else{
  136. this.listData = res.data.list || []
  137. }
  138. this.totalNum = res.data.count || 0
  139. } else {
  140. this.listData = []
  141. this.totalNum = 0
  142. this.noDataText = res.message
  143. }
  144. })
  145. },
  146. // scroll-view到底部加载更多
  147. onreachBottom() {
  148. if(this.listData.length < this.totalNum){
  149. this.pageNo += 1
  150. this.getList()
  151. }
  152. },
  153. seleteTime(val){
  154. this.navInd = val
  155. },
  156. toPage(url){
  157. uni.navigateTo({ url: url })
  158. },
  159. getBizData () {
  160. bizData({}).then(res => {
  161. if (res.status == 200) {
  162. this.bizData = res.data || null
  163. } else {
  164. this.bizData = null
  165. }
  166. })
  167. },
  168. // 查看详情
  169. getDetail(data){},
  170. // 操作
  171. handleFun(type, data){
  172. this.dataInfo = data
  173. if(type == 'audit'){ // 审核
  174. this.auditModal = true
  175. }else if(type == 'out'){ // 出库
  176. this.outModal = true
  177. }else if(type == 'del'){ // 删除
  178. this.delText = '确认要删除吗?'
  179. this.delModal = true
  180. }else if(type == 'cancel'){ // 取消
  181. this.delText = '确认要取消吗?'
  182. this.delModal = true
  183. }
  184. },
  185. // 审核通过或不通过
  186. handleAudit(billStatus){
  187. salesWriteAudit({
  188. id: this.dataInfo.id,
  189. billStatus: billStatus
  190. }).then(res => {
  191. if (res.status == 200) {
  192. this.toashMsg(res.message)
  193. this.getList(1)
  194. this.auditModal = false
  195. } else {
  196. this.auditModal = false
  197. }
  198. })
  199. },
  200. // 出库
  201. handleOut(){
  202. salesWriteStockOut({ salesBillSn: this.dataInfo.salesBillSn }).then(res => {
  203. if (res.status == 200) {
  204. this.toashMsg(res.message)
  205. this.getList(1)
  206. this.outModal = false
  207. } else {
  208. this.outModal = false
  209. }
  210. })
  211. },
  212. // 删除
  213. handleDel(){
  214. salesDel({ id: this.dataInfo.id }).then(res => {
  215. if (res.status == 200) {
  216. this.toashMsg(res.message)
  217. this.getList(1)
  218. this.delModal = false
  219. } else {
  220. this.delModal = false
  221. }
  222. })
  223. }
  224. }
  225. }
  226. </script>
  227. <style lang="scss">
  228. .sales-warp{
  229. width: 100%;
  230. padding: 20rpx 20upx;
  231. .color_6{
  232. color: #666;
  233. }
  234. .font_13{
  235. font-size: 26upx;
  236. }
  237. .content-data{
  238. background-color: #fff;
  239. padding: 20upx 20upx;
  240. border-radius: 20upx;
  241. box-shadow: 3upx 2upx 6upx #eee;
  242. margin-bottom: 20upx;
  243. .date-type{
  244. margin: 0 120upx 20upx;
  245. border-radius: 50upx;
  246. border: 1upx solid #eee;
  247. text{
  248. display: inline-block;
  249. padding: 10upx 0;
  250. width: 33%;
  251. text-align: center;
  252. }
  253. text:first-child{
  254. border-top-left-radius: 50upx;
  255. border-bottom-left-radius: 50upx;
  256. }
  257. text:last-child{
  258. border-top-right-radius: 50upx;
  259. border-bottom-right-radius: 50upx;
  260. }
  261. text:not(:last-child){
  262. border-right: 1upx solid #eee;
  263. }
  264. .active_day {
  265. background: rgb(0, 122, 255);
  266. color: #fff;
  267. }
  268. }
  269. .total{
  270. display: flex;
  271. .item-box{
  272. text-align: center;
  273. width: 50%;
  274. color:#999;
  275. }
  276. .item-box:first-child{
  277. border-right: 1px solid #e4e7ed;
  278. }
  279. }
  280. }
  281. .nav-cont{
  282. .nav-item{
  283. width: 49%;
  284. border-radius: 25upx;
  285. background-color: #ffffff;
  286. padding: 14upx 0;
  287. box-shadow: 3upx 2upx 6upx #eee;
  288. margin-bottom: 20upx;
  289. text-align: center;
  290. .nav-pic{
  291. margin: 0 auto;
  292. }
  293. .nav-txt{
  294. font-size: 28upx;
  295. color: #666666;
  296. }
  297. }
  298. }
  299. .sales-list{
  300. .title{
  301. margin-bottom: 14upx;
  302. display: flex;
  303. align-items: center;
  304. justify-content: space-between;
  305. .title-name{
  306. font-size: 32upx;
  307. color: #333;
  308. font-weight: 1000;
  309. }
  310. .title-all{
  311. color: #666;
  312. }
  313. }
  314. .sales-list-con{
  315. height: calc(100vh - 458upx);
  316. .sales-list-main{
  317. .sales-list-item{
  318. background: #ffffff;
  319. padding: 20upx;
  320. margin-bottom: 25upx;
  321. border-radius: 25upx;
  322. box-shadow: 1px 1px 3px #EEEEEE;
  323. .list-item-tit{
  324. padding-bottom: 12upx;
  325. border-bottom: 1px dashed #e4e7ed;
  326. white-space: nowrap;
  327. overflow: hidden;
  328. text-overflow: ellipsis;
  329. .u-line{
  330. display: inline-block;
  331. width: 6upx;
  332. height: 40upx;
  333. background-color: red;
  334. vertical-align: bottom;
  335. margin: 0 20upx 0 10upx;
  336. }
  337. }
  338. .list-item-con{
  339. padding: 10upx 0;
  340. .list-item-line{
  341. padding: 8upx 0;
  342. }
  343. text{
  344. color: #666;
  345. }
  346. }
  347. .button-box{
  348. text-align: right;
  349. padding-top: 10upx;
  350. border-top: 1px dashed #e4e7ed;
  351. button{
  352. margin: 0 10upx;
  353. }
  354. }
  355. }
  356. }
  357. }
  358. }
  359. }
  360. </style>