customerManagement.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <!--客户管理-->
  2. <template>
  3. <div>
  4. <BaseHeaderLayout :leftSpan="12">
  5. <template slot="left">
  6. <ws-button type="primary" @click="getCustomer()">获取客户</ws-button>
  7. <ws-button type="primary" @click="createCustomer(1)"
  8. >创建新客户</ws-button
  9. >
  10. </template>
  11. <template slot="right">
  12. <ws-select
  13. v-model="searchTypeText"
  14. placeholder=""
  15. @change="selecttaskType"
  16. :value="searchType"
  17. >
  18. <ws-option
  19. v-for="item in warehouseList"
  20. :key="item.value"
  21. :label="item.value"
  22. :value="item.value"
  23. style="color: #8890b1"
  24. />
  25. </ws-select>
  26. <div></div>
  27. <ws-input
  28. v-model="searchKeyWord"
  29. placeholder="可按姓名、手机号查找"
  30. clearable
  31. maxlength="500"
  32. type="input"
  33. ></ws-input>
  34. <ws-button class="find" type="primary" @click="find()"
  35. ><img
  36. width="16"
  37. height="16"
  38. style="
  39. vertical-align: text-top;
  40. position: relative;
  41. top: 0px;
  42. left: -8px;
  43. "
  44. src="../../../public/img/sousuo.png"
  45. alt=""
  46. /></ws-button>
  47. </template>
  48. </BaseHeaderLayout>
  49. <div class="seach">
  50. <!-- <div class="search-left">
  51. <ws-input v-model="searchKeyWord" placeholder="可按姓名、手机号查找" clearable maxlength="500" type="input"
  52. class="findValue"></ws-input>
  53. <ws-button class="find" type="primary" @click="find()">
  54. <img width="16" height="16" style="
  55. vertical-align: text-top;
  56. position: relative;
  57. top: 0px;
  58. left: -8px;
  59. " src="../../../public/img/sousuo.png" alt />
  60. </ws-button>
  61. </div> -->
  62. <div class="search-right">
  63. <!-- <ws-button @click="getCustomer()">获取客户</ws-button> -->
  64. <el-dialog
  65. title="客户扫码"
  66. :visible.sync="customerDialogVisible"
  67. width="30%"
  68. >
  69. <div id="qrcode"></div>
  70. </el-dialog>
  71. <!-- <ws-button @click="createCustomer()">创建新客户</ws-button> -->
  72. <el-dialog
  73. title="创建新客户"
  74. :visible.sync="creatNewCustomerDialogVisible"
  75. width="50%"
  76. >
  77. <customerManagementAdd></customerManagementAdd>
  78. </el-dialog>
  79. </div>
  80. </div>
  81. <el-table
  82. :data="customertList"
  83. style="width: 100%; margin-top: 20px"
  84. ref="customertList"
  85. border
  86. height="780"
  87. >
  88. <el-table-column type="index" label="序号">
  89. <template scope="scope">
  90. <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
  91. <span v-else>{{ scope.$index + 1 }}</span>
  92. </template>
  93. </el-table-column>
  94. <el-table-column prop="customerName" label="客户"></el-table-column>
  95. <el-table-column prop="customerPhone" label="手机号"></el-table-column>
  96. <el-table-column prop="bankCard" label="银行卡号"></el-table-column>
  97. <el-table-column prop="bankDeposit" label="开户行"></el-table-column>
  98. <el-table-column prop="payeeName" label="收款人"></el-table-column>
  99. <el-table-column
  100. prop="authenticationStatus"
  101. label="状态"
  102. ></el-table-column>
  103. <el-table-column prop="address" label="操作">
  104. <template slot-scope="scope">
  105. <img
  106. width="16"
  107. height="16"
  108. style="vertical-align: text-top; margin: 0 6px"
  109. src="../../../public/img/chakan.png"
  110. @click="createCustomer(scope.row, 2)"
  111. v-hasPermission="
  112. `contractManagement.buyContract.buyContractInfo.view`
  113. "
  114. alt
  115. />
  116. <img
  117. width="17"
  118. height="16"
  119. style="vertical-align: text-top; margin: 0 6px"
  120. src="../../../public/img/bianji.png"
  121. @click="createCustomer(scope.row, 3)"
  122. v-hasPermission="
  123. `contractManagement.buyContract.buyContractInfo.edit`
  124. "
  125. alt
  126. />
  127. <img
  128. width="16"
  129. height="17"
  130. style="
  131. vertical-align: text-top;
  132. position: relative;
  133. top: -1px;
  134. margin: 0 6px;
  135. "
  136. src="../../../public/img/shanchu.png"
  137. v-hasPermission="
  138. `contractManagement.buyContract.buyContractInfo.delete`
  139. "
  140. @click="handleDelete(scope.row)"
  141. alt
  142. />
  143. </template>
  144. </el-table-column>
  145. </el-table>
  146. <div style="text-align: center">
  147. <el-pagination
  148. @size-change="handleSizeChange"
  149. @current-change="handleCurrentChange"
  150. :current-page="currentPage"
  151. :page-size="deptCircularPage.pageSize"
  152. layout="total, sizes, prev, pager, next, jumper"
  153. :total="deptBudgetTotal"
  154. >
  155. </el-pagination>
  156. </div>
  157. </div>
  158. </template>
  159. <script>
  160. import {
  161. getCustomerManage,
  162. getCustomerDelete,
  163. selectWarehouseSelf,
  164. } from '@/model/houseSelfCollect/index'
  165. import QRCode from 'qrcodejs2'
  166. import customerManagementAdd from './customerManagementAdd.vue'
  167. export default {
  168. components: {
  169. customerManagementAdd,
  170. },
  171. watch: {},
  172. data() {
  173. return {
  174. searchKeyWord: '',
  175. customerDialogVisible: false,
  176. creatNewCustomerDialogVisible: false,
  177. customertList: [],
  178. currentPage: 1,
  179. pageSize: 10,
  180. deptBudgetTotal: 0,
  181. deptCircularPage: {},
  182. warehouseList: [], //选择仓库数组
  183. searchTypeText: '', //仓库
  184. searchType: '',
  185. }
  186. },
  187. activated() {
  188. this.getList()
  189. },
  190. methods: {
  191. find() {
  192. this.getList()
  193. },
  194. //获取客户
  195. getCustomer() {
  196. this.customerDialogVisible = true
  197. this.$nextTick(function () {
  198. document.getElementById('qrcode').innerHTML = ''
  199. let qrcode = new QRCode('qrcode', {
  200. width: 150,
  201. height: 150,
  202. text: 'https://www.baidu.com',
  203. colorDark: '#109dff',
  204. colorLight: '#d9d9d9',
  205. })
  206. })
  207. },
  208. //选择仓库改变事件
  209. selecttaskType() {},
  210. //创建客户
  211. createCustomer(row, num) {
  212. let type = num
  213. this.$router.push({
  214. name: 'customerManagementAdd',
  215. query: { types: type, id: row.id },
  216. })
  217. },
  218. handleSizeChange(val) {
  219. console.log(`每页 ${val} 条`)
  220. this.pageSize = val
  221. this.getList()
  222. },
  223. handleCurrentChange(val) {
  224. this.currentPage = val
  225. console.log(`当前页: ${val}`)
  226. this.getList()
  227. },
  228. handleEdit(row) {
  229. this.$router.push({
  230. name: 'customerManagementEdit',
  231. query: {
  232. id: row.id,
  233. },
  234. })
  235. },
  236. handleDelete(row) {
  237. this.$confirm('确定删除该客户?', '提示', {
  238. confirmButtonText: '确定',
  239. cancelButtonText: '取消',
  240. type: 'warning',
  241. })
  242. .then(() => {
  243. getCustomerDelete({
  244. compId: sessionStorage.getItem('ws-pf_compId'),
  245. id: row.id,
  246. })
  247. .toPromise()
  248. .then((response) => {
  249. this.$message.success('删除成功')
  250. this.getList()
  251. })
  252. })
  253. .catch(() => {
  254. return false
  255. })
  256. },
  257. getList() {
  258. selectWarehouseSelf({
  259. compId: sessionStorage.getItem('ws-pf_compId'),
  260. personCharge: sessionStorage.getItem('ws-pf_staffName'),
  261. })
  262. .toPromise()
  263. .then((response) => {
  264. this.warehouseList = []
  265. for (let i = 0; i < response.length; i++) {
  266. this.warehouseList.push({
  267. value: response[i].warehouseName,
  268. })
  269. }
  270. })
  271. getCustomerManage({
  272. compId: sessionStorage.getItem('ws-pf_compId'),
  273. currentPage: this.currentPage,
  274. pageSize: this.pageSize,
  275. searchKeyWord: this.searchKeyWord,
  276. searchTypeText:this.searchTypeText
  277. })
  278. .toPromise()
  279. .then((response) => {
  280. this.customertList = response.records
  281. this.deptBudgetTotal = response.total
  282. })
  283. },
  284. },
  285. }
  286. </script>
  287. <style lang="scss" scoped>
  288. .seach {
  289. display: flex;
  290. justify-content: space-between;
  291. align-items: center;
  292. .find {
  293. width: 32px;
  294. }
  295. .search-left {
  296. display: flex;
  297. }
  298. }
  299. .ws-info-table {
  300. border: none;
  301. }
  302. .ws-info-table .el-form-item {
  303. width: 50%;
  304. border: none;
  305. }
  306. /deep/.ws-info-table .el-form-item .el-form-item__label {
  307. width: 30%;
  308. text-align: center;
  309. background: #ffffff;
  310. color: #8890b1;
  311. }
  312. /deep/.ws-info-table .el-form-item .el-form-item__content {
  313. border: none;
  314. }
  315. /deep/.el-table .el-table__header .cell,
  316. .el-table .el-table__body .cell {
  317. text-align: center;
  318. }
  319. /deep/.el-table--enable-row-transition .el-table__body td {
  320. text-align: center;
  321. }
  322. </style>