SupplierDetail.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <view>
  3. <view class="detail-view" v-if="$accessCheck($Access.SupplierGetSupplierInfoById)">
  4. <u-form label-width="150">
  5. <view class="form-model-view">
  6. <u-form-item label="供应商编号">
  7. <view class="form-value">{{ supplier_detail.code }}</view>
  8. </u-form-item>
  9. <u-form-item label="供应商名称">
  10. <view class="form-value">{{ supplier_detail.title }}</view>
  11. </u-form-item>
  12. <u-form-item label="联系人">
  13. <view class="form-value">{{ supplier_detail.realName }}</view>
  14. </u-form-item>
  15. <u-form-item label="联系电话">
  16. <view class="form-value mobile" @click="callPhone(supplier_detail.mobile)">
  17. {{ supplier_detail.mobile }}
  18. <u-icon name="arrow-right" size="28"></u-icon>
  19. </view>
  20. </u-form-item>
  21. <u-form-item label="联系人职务">
  22. <view class="form-value">{{ supplier_detail.position }}</view>
  23. </u-form-item>
  24. <u-form-item label="状态" v-if='$accessCheck($Access.SupplierUpdateEnableStatus)'>
  25. <view class="form-value">
  26. <u-switch style="transform: translateY(14rpx);" @change="enableStatusChange"
  27. v-model="enable_status" :active-value="5" :inactive-value="5" size="40"></u-switch>
  28. </view>
  29. </u-form-item>
  30. </view>
  31. <view class="form-model-view">
  32. <u-form-item label="所属区域" label-position="top">
  33. <block v-if="supplier_detail.area">
  34. {{ supplier_detail.area.provinceName }}-{{ supplier_detail.area.cityName }}-{{ supplier_detail.area.districtName }}-{{ supplier_detail.area.address }}
  35. </block>
  36. </u-form-item>
  37. </view>
  38. <view class="form-model-view">
  39. <u-form-item label="开户人">
  40. <view class="form-value">{{ supplier_detail.accountName || '--' }}</view>
  41. </u-form-item>
  42. <u-form-item label="开户银行">
  43. <view class="form-value">{{ supplier_detail.bankName || '--' }}</view>
  44. </u-form-item>
  45. <u-form-item label="银行账号">
  46. <view class="form-value">{{ supplier_detail.bankCard || '--' }}</view>
  47. </u-form-item>
  48. </view>
  49. <view class="form-model-view">
  50. <u-form-item label="备注" label-position="top">{{ supplier_detail.remark || '无' }}</u-form-item>
  51. </view>
  52. </u-form>
  53. <view class="detail-bottom">
  54. <view v-if="$accessCheck($Access.SupplierDelSupplier)" class="handel-btn info-btn"
  55. @click="openModel('确定要删除该供应商吗?', '删除')">删除</view>
  56. <view v-if="$accessCheck($Access.SupplierEditSupplier)" class="handel-btn"
  57. @click="goPage(`/pagesT/Purchase/AddSupplier?id=${supplier_id}`)">编辑</view>
  58. </view>
  59. <u-modal v-model="model_show" :show-cancel-button="true" :content="model_content" @confirm="modelConfirm">
  60. </u-modal>
  61. </view>
  62. <view v-else>没有权限</view>
  63. </view>
  64. </template>
  65. <script>
  66. export default {
  67. data() {
  68. return {
  69. model_tag: '',
  70. model_show: false,
  71. enable_status: false,
  72. model_content: '',
  73. supplier_id: '',
  74. supplier_detail: {},
  75. add_form: {
  76. title: '',
  77. provinceCode: '',
  78. cityCode: '',
  79. districtCode: '',
  80. address: '',
  81. realName: '',
  82. mobile: '',
  83. enableStatus: 5,
  84. sex: 0,
  85. phone: '',
  86. position: '',
  87. email: '',
  88. remark: '',
  89. accountName: '',
  90. bankName: '',
  91. bankCard: ''
  92. }
  93. };
  94. },
  95. onLoad(options) {
  96. this.supplier_id = options.id;
  97. this.getSupplierInfoById();
  98. },
  99. onPullDownRefresh() {
  100. this.getSupplierInfoById();
  101. },
  102. onShow() {
  103. this.getSupplierInfoById();
  104. },
  105. methods: {
  106. // 打开提示框
  107. openModel(content, tag) {
  108. this.model_content = content;
  109. this.model_show = true;
  110. this.model_tag = tag;
  111. },
  112. modelConfirm() {
  113. switch (this.model_tag) {
  114. case '删除':
  115. this.delSupplier();
  116. break;
  117. }
  118. },
  119. getSupplierInfoById() {
  120. this.$u.api.getSupplierInfoById(this.supplier_id).then(res => {
  121. this.supplier_detail = res.data;
  122. this.enable_status = res.data.enableStatus === 5;
  123. });
  124. },
  125. enableStatusChange() {
  126. this.$u.api
  127. .SupplierUpdateEnableStatus(this.supplier_id, {
  128. enableStatus: this.enable_status ? 5 : 4
  129. })
  130. .then(res => {
  131. this.$u.toast('操作成功');
  132. setTimeout(() => {
  133. this.getSupplierInfoById();
  134. }, 1500)
  135. });
  136. },
  137. delSupplier() {
  138. this.$u.api.delSupplier(this.supplier_id).then(res => {
  139. this.$u.toast('已删除');
  140. setTimeout(() => {
  141. uni.navigateBack();
  142. }, 2000);
  143. });
  144. }
  145. }
  146. };
  147. </script>
  148. <style lang="scss">
  149. .mobile {
  150. color: $uni-color-primary;
  151. }
  152. </style>