supplier.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <view class="supplier-container">
  3. <!-- <uni-swipe-action ref="slide">
  4. <view class="supplier-info" @click="gotoSupplierDetail(item)" v-for="(item,index) in dataList" :key="item.id">
  5. <uni-swipe-action-item :right-options="options"
  6. @click="bindClick($event,item)" :show="isOpened" @change="change">
  7. <view class="supplier-title">
  8. <view class="supplier-title-text">
  9. {{item.name || '-'}}
  10. </view>
  11. <view class="supplier-title-contacts">
  12. {{item.contactName || '-'}}
  13. </view>
  14. </view>
  15. <view class="supplier-tel">
  16. {{item.contactPhone || '-'}}
  17. </view>
  18. </uni-swipe-action-item>
  19. </view>
  20. </uni-swipe-action> -->
  21. <view class="supplier-info" @click="gotoSupplierDetail(item)" v-for="(item,index) in dataList" :key="item.id">
  22. <view class="supplier-title">
  23. <view class="supplier-title-text">
  24. {{item.name || '-'}}
  25. </view>
  26. <view class="supplier-title-contacts">
  27. {{item.contactName || '-'}}
  28. </view>
  29. </view>
  30. <view class="supplier-tel">
  31. {{item.contactPhone || '-'}}
  32. </view>
  33. </view>
  34. <u-button type="primary" class="commit-button" @click="jumpPage">增加合作者</u-button>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. //列表数据
  42. dataList: [],
  43. //查询条件
  44. param: {
  45. stationCode: null,
  46. stationName:null,
  47. },
  48. options: [
  49. {
  50. text: "编辑",
  51. style: {
  52. backgroundColor: "blue",
  53. },
  54. },
  55. {
  56. text: "删除",
  57. style: {
  58. backgroundColor: "#ff3242",
  59. },
  60. },
  61. ],
  62. isOpened: "none",
  63. }
  64. },
  65. //第一次加载
  66. onLoad(e) {
  67. this.param.stationCode = e.stationCode
  68. this.param.stationName=e.stationName
  69. },
  70. onReady() {
  71. },
  72. //页面显示
  73. onShow() {
  74. },
  75. mounted() {
  76. this.getSupplierListData();
  77. },
  78. methods: {
  79. //跳转合作者
  80. jumpPage(){
  81. uni.navigateTo({
  82. url:`/pages/index/supplierAdd?stationCode=${this.param.stationCode}&stationName=${this.param.stationName}`
  83. })
  84. },
  85. // bindClick(e,item) {
  86. // if(e.content.text==='删除'){
  87. // let _that = this
  88. // uni.showModal({
  89. // title: `确认删除吗?`,
  90. // content: '',
  91. // success: function(res) {
  92. // if (res.confirm) {
  93. // _that.$http.supplierDel({id:item.id,stationCode:_that.param.stationCode})
  94. // .then(res => {
  95. // if (res.code === 200) {
  96. // _that.getSupplierListData()
  97. // }else{
  98. // _that.$utils.msg(res.msg);
  99. // }
  100. // }).catch(err => {
  101. // console.error(err)
  102. // })
  103. // } else if (res.cancel) {
  104. // return false
  105. // }
  106. // }
  107. // })
  108. // }else{
  109. // uni.navigateTo({
  110. // url:'/pages/index/supplierAdd?item='+encodeURIComponent(JSON.stringify(item))
  111. // })
  112. // }
  113. // },
  114. // change(e) {
  115. // // console.log(e, '改变事件')
  116. // },
  117. //跳转详情页
  118. gotoSupplierDetail(item) {
  119. uni.navigateTo({
  120. url: '/pages/index/supplierDetail?dataInfo=' + encodeURIComponent(JSON.stringify(item)),
  121. })
  122. },
  123. //获取站点内供货商的列表
  124. getSupplierListData() {
  125. let _that = this;
  126. _that.dataList = [];
  127. uni.showLoading({
  128. title: '搜索中...',
  129. })
  130. _that.$http.getSupplierList(_that.param).then(res => {
  131. uni.hideLoading();
  132. if (res.code == 200) {
  133. _that.dataList = res.data.list || [];
  134. } else {
  135. _that.$utils.msg(res.msg);
  136. }
  137. })
  138. },
  139. }
  140. }
  141. </script>
  142. <style lang="scss" scoped>
  143. .supplier-container {
  144. height: 100vh;
  145. position: relative;
  146. box-sizing: border-box;
  147. background: $uni-bg-color;
  148. padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  149. padding-top: 30rpx;
  150. .commit-button {
  151. position: fixed;
  152. width: calc(100% - 60rpx);
  153. bottom: calc(20rpx + env(safe-area-inset-bottom));
  154. z-index: 999;
  155. left: 30rpx;
  156. }
  157. .supplier-info {
  158. height: 160rpx;
  159. background: #FFFFFF;
  160. border-radius: 16rpx 16rpx 16rpx 16rpx;
  161. margin: 0 30rpx 30rpx;
  162. padding: 30rpx;
  163. .supplier-title {
  164. display: flex;
  165. padding-right: 30rpx;
  166. .supplier-title-text {
  167. flex: 1;
  168. font-size: 30rpx;
  169. font-family: PingFang SC-Regular, PingFang SC;
  170. font-weight: 400;
  171. color: #1D2129;
  172. line-height: 44rpx;
  173. }
  174. .supplier-title-contacts {
  175. font-size: 30rpx;
  176. font-family: PingFang SC-Regular, PingFang SC;
  177. font-weight: 400;
  178. color: #1D2129;
  179. line-height: 44rpx;
  180. text-align: right;
  181. }
  182. }
  183. .supplier-tel {
  184. text-align: right;
  185. font-size: 26rpx;
  186. font-family: PingFang SC-Regular, PingFang SC;
  187. font-weight: 400;
  188. color: #86909C;
  189. line-height: 44rpx;
  190. margin-top: 20rpx;
  191. padding-right: 30rpx;
  192. }
  193. }
  194. }
  195. </style>