agencyCompanyDetail.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <div class="line-container-p24">
  3. <i class="el-icon-arrow-left"></i>
  4. <div
  5. class="dib go-back ml8"
  6. @click="router.replace('/agencyManage/agencyCompanyList')"
  7. >
  8. 返回代理公司列表
  9. </div>
  10. </div>
  11. <div class="container-title">代理信息</div>
  12. <div class="line-container-p24 df aic">
  13. <div class="normal-label">代理名称</div>
  14. <div class="show-input">{{ proxyName }}</div>
  15. <div class="normal-label">联系人</div>
  16. <div class="show-input">{{ contactName }}</div>
  17. <div class="normal-label">联系人手机号</div>
  18. <div class="show-input">{{ contactPhone }}</div>
  19. </div>
  20. <div class="container-title">货主信息</div>
  21. <div class="line-container-p24">
  22. <div style="display: flex; justify-content: space-between">
  23. <div style="display: flex">
  24. <el-input
  25. placeholder="公司名称/联系人/手机号"
  26. prefix-icon="el-icon-search"
  27. v-model="term2"
  28. clearable
  29. style="width: 330px"
  30. ></el-input>
  31. <div class="seach-btn" @click="getCargoOwnerCompanyByAgencyCompany">
  32. 查询
  33. </div>
  34. </div>
  35. <div class="cargo-owner-add" @click="dialogFormVisible2 = true">
  36. 关联货主公司
  37. </div>
  38. <el-dialog
  39. title="关联货主公司"
  40. v-model="dialogFormVisible2"
  41. @closed="resetForm2"
  42. >
  43. <template v-slot:default>
  44. <el-form
  45. :model="ruleForm2"
  46. :rules="rules2"
  47. ref="form2"
  48. label-width="110px"
  49. label-position="left"
  50. >
  51. <el-form-item prop="cargoOwnerId" label="货主公司">
  52. <RemoteSearch
  53. api="getCargoOwnerCompanySelect"
  54. v-model="cargoOwnerCompanyStr"
  55. placeholder="公司名称/联系人/手机号"
  56. @selectItem="selectCargoOwner($event)"
  57. class="mb10"
  58. ></RemoteSearch>
  59. </el-form-item>
  60. </el-form>
  61. </template>
  62. <template v-slot:footer>
  63. <div class="dialog-footer">
  64. <el-button @click="resetForm2">取 消</el-button>
  65. <el-button type="primary" @click="relateCargoAgency(ruleForm2)">
  66. 确认关联
  67. </el-button>
  68. </div>
  69. </template>
  70. </el-dialog>
  71. </div>
  72. <div style="margin-top: 24px">
  73. <el-table :data="tableData2" stripe style="width: 100%">
  74. <el-table-column
  75. type="index"
  76. label="序号"
  77. min-width="80"
  78. align="center"
  79. ></el-table-column>
  80. <el-table-column
  81. prop="proxyName"
  82. label="公司名称"
  83. min-width="120"
  84. align="center"
  85. ></el-table-column>
  86. <el-table-column
  87. prop="contactName"
  88. label="联系人"
  89. min-width="120"
  90. align="center"
  91. ></el-table-column>
  92. <el-table-column
  93. prop="contactPhone"
  94. label="联系人手机号"
  95. min-width="160"
  96. align="center"
  97. ></el-table-column>
  98. </el-table>
  99. <div style="width: 100%; text-align: right; margin-top: 43px">
  100. <el-pagination
  101. background
  102. layout="prev, pager, next"
  103. :total="total2"
  104. @current-change="pageChange2"
  105. ></el-pagination>
  106. </div>
  107. </div>
  108. </div>
  109. </template>
  110. <script setup>
  111. import { ref, h, reactive, toRefs, onMounted } from "vue";
  112. import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
  113. import store from "../../store";
  114. import router from "../../router";
  115. import { useRoute } from "vue-router";
  116. import api from "../../apis/fetch";
  117. import { subTimeStr } from "../../utils/utils";
  118. const route = useRoute();
  119. let proxyName = ref();
  120. let contactName = ref();
  121. let contactPhone = ref();
  122. async function getAgencyCompanyDetail() {
  123. let res = await api.getAgencyCompanyDetail({
  124. proxyId: route.query.id,
  125. });
  126. if (res.data.status == 0) {
  127. proxyName.value = res.data.result.proxyName;
  128. contactName.value = res.data.result.contactName;
  129. contactPhone.value = res.data.result.contactPhone;
  130. } else {
  131. console.log(res);
  132. }
  133. }
  134. let tableData2 = ref([]);
  135. let term2 = ref("");
  136. let currentPage2 = ref(1);
  137. let total2 = ref(0);
  138. let dialogFormVisible2 = ref(false);
  139. let form2 = ref(null);
  140. async function getCargoOwnerCompanyByAgencyCompany() {
  141. tableData2.value = [];
  142. let res = await api.getCargoOwnerCompanyByAgencyCompany({
  143. proxyId: route.query.id,
  144. currentPage: currentPage2.value,
  145. size: 10,
  146. term: term2.value,
  147. });
  148. term2.value = "";
  149. if (res.data.status == 0) {
  150. tableData2.value = res.data.result;
  151. total2.value = res.data.total;
  152. }
  153. }
  154. let cargoOwnerCompanyStr = ref("");
  155. const ruleForm2 = ref({
  156. cargoOwnerId: "",
  157. });
  158. const rules2 = ref({
  159. cargoOwnerId: [
  160. { required: true, message: "请选择货主公司", trigger: "blur" },
  161. ],
  162. });
  163. function selectCargoOwner(item) {
  164. ruleForm2.value.cargoOwnerId = item.key;
  165. console.log(ruleForm2.value);
  166. }
  167. function resetForm2() {
  168. dialogFormVisible2.value = false;
  169. cargoOwnerCompanyStr.value = "";
  170. form2.value.resetFields();
  171. }
  172. function pageChange2(e) {
  173. currenrPage2.value = e;
  174. getCargoOwnerCompanyByAgencyCompany();
  175. }
  176. async function relateCargoAgency() {
  177. form2.value.validate(async (valid) => {
  178. if (valid) {
  179. let { cargoOwnerId } = ruleForm2.value;
  180. let res = await api.relateCargoAgency({
  181. proxyId: route.query.id,
  182. cargoOwnerId,
  183. });
  184. console.log(res);
  185. if (res.data.status == 0) {
  186. ElNotification.success({
  187. title: "添加成功",
  188. duration: 2000,
  189. message: `${res.data.msg}`,
  190. type: "success",
  191. });
  192. resetForm2();
  193. getCargoOwnerCompanyByAgencyCompany();
  194. } else {
  195. ElNotification.error({
  196. title: "失败",
  197. duration: 3000,
  198. message: res.data.msg,
  199. });
  200. }
  201. } else {
  202. return false;
  203. }
  204. });
  205. }
  206. onMounted(() => {
  207. getAgencyCompanyDetail();
  208. getCargoOwnerCompanyByAgencyCompany();
  209. });
  210. </script>
  211. <style scoped>
  212. .go-back {
  213. font-size: 16px;
  214. font-family: PingFangSC-Medium, PingFang SC;
  215. font-weight: 500;
  216. color: #333d43;
  217. line-height: 100%;
  218. cursor: pointer;
  219. }
  220. .normal-label {
  221. font-size: 14px;
  222. font-family: PingFangSC-Regular, PingFang SC;
  223. font-weight: 400;
  224. color: #353a42;
  225. margin-right: 10px;
  226. }
  227. .show-input {
  228. width: 200px;
  229. height: 32px;
  230. background: #ffffff;
  231. border-radius: 2px;
  232. border: 1px solid #dee0e3;
  233. font-size: 14px;
  234. font-family: PingFangSC-Regular, PingFang SC;
  235. font-weight: 400;
  236. color: #333333;
  237. line-height: 32px;
  238. padding-left: 12px;
  239. margin-right: 40px;
  240. }
  241. .radio-btns {
  242. height: 38px;
  243. width: 103px;
  244. border: 1px solid #1486f9;
  245. line-height: 38px;
  246. text-align: center;
  247. font-size: 14px;
  248. font-family: PingFangSC-Regular, PingFang SC;
  249. font-weight: 400;
  250. color: #0094fe;
  251. cursor: pointer;
  252. }
  253. .left-radius {
  254. border-top-left-radius: 19px;
  255. border-bottom-left-radius: 19px;
  256. }
  257. .right-radius {
  258. border-top-right-radius: 19px;
  259. border-bottom-right-radius: 19px;
  260. }
  261. .currentbtn {
  262. background: #1486f9;
  263. color: #fff;
  264. }
  265. .seach-btn {
  266. display: inline-block;
  267. width: 60px;
  268. height: 38px;
  269. background: #0094fe;
  270. border-radius: 2px;
  271. font-size: 14px;
  272. font-family: PingFangSC-Regular, PingFang SC;
  273. font-weight: 400;
  274. color: #ffffff;
  275. text-align: center;
  276. line-height: 38px;
  277. margin-left: 15px;
  278. cursor: pointer;
  279. box-sizing: border-box;
  280. }
  281. .seach-btn {
  282. display: inline-block;
  283. width: 60px;
  284. height: 38px;
  285. background: #0094fe;
  286. border-radius: 2px;
  287. font-size: 14px;
  288. font-family: PingFangSC-Regular, PingFang SC;
  289. font-weight: 400;
  290. color: #ffffff;
  291. text-align: center;
  292. line-height: 38px;
  293. margin-left: 15px;
  294. cursor: pointer;
  295. box-sizing: border-box;
  296. }
  297. .cargo-owner-add {
  298. width: 120px;
  299. height: 36px;
  300. border-radius: 2px;
  301. border: 1px solid #0094fe;
  302. font-size: 14px;
  303. font-family: PingFangSC-Regular, PingFang SC;
  304. font-weight: 400;
  305. color: #0094fe;
  306. line-height: 36px;
  307. text-align: center;
  308. cursor: pointer;
  309. margin-right: 20px;
  310. }
  311. :deep().el-dialog {
  312. width: 560px;
  313. padding: 20px 50px;
  314. border-radius: 6px;
  315. }
  316. :deep() .el-dialog__title {
  317. font-size: 18px;
  318. font-family: PingFangSC-Regular, PingFang SC;
  319. font-weight: 400;
  320. color: #0094fe;
  321. }
  322. </style>