123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <template>
- <view class="container">
- <scroll-view scroll-y class="page" >
- <view class="cu-list menu-avatar">
- <view class="cu-item" :class="modalName=='move-box-'+ item.id?'move-cur':''" v-for="item in datas" :key="item.id"
- @touchstart="ListTouchStart" @touchmove="ListTouchMove" @touchend="ListTouchEnd" :data-target="'move-box-' + item.id">
- <view class="cu-avatar radius">
- <text class="cuIcon-home"></text>
- </view>
- <view class="content" style="background-color: #FFFFFF;">
- <view class="text-grey">{{item.companyName}}</view>
- <view class="text-gray text-sm">
- <text class="margin-right-xs cuIcon-calendar"></text> {{item.identificationNo}}
- </view>
- <view class="text-gray text-sm">
- <text class="margin-right-xs cuIcon-phone"></text> {{item.companyPhone}}
- </view>
- </view>
- <view class="move">
- <view class='bg-grey' @click='editCompany(item)'>编辑</view>
- <view class='bg-red' @click='delCompany(item)'>删除</view>
- </view>
- </view>
- </view>
- </scroll-view>
- <drag-button
- :isDock="true"
- :existTabBar="true"
- :isIcon="true"
- text="新增"
- location="20"
- @btnClick="Company"
- />
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- export default {
- data() {
- return {
- datas:[],
- listTouchStart: 0,
- listTouchDirection: null,
- modalName: null,
- }
- },
- computed: {
- },
- onShow() {
- var that=this
- this.$api.request('company', 'getCompany', failres => {
- that.$api.msg(failres.errmsg)
- uni.hideLoading()
- }).then(res => {
- if(res.data.code=='SUCCESS'){
- that.datas=res.data.data
- uni.hideLoading()
- }else{
- that.$api.msg(res.data.code)
- uni.hideLoading()
- }
- })
- },
- onLoad() {
-
-
- },
- onReady(){
-
- },
- methods: {
- // ListTouch触摸开始
- ListTouchStart(e) {
- this.listTouchStart = e.touches[0].pageX
- },
- // ListTouch计算方向
- ListTouchMove(e) {
- this.listTouchDirection = e.touches[0].pageX - this.listTouchStart > 0 ? 'right' : 'left'
- },
- // ListTouch计算滚动
- ListTouchEnd(e) {
- if (this.listTouchDirection == 'left') {
- this.modalName = e.currentTarget.dataset.target
- } else {
- this.modalName = null
- }
- this.listTouchDirection = null
- },
- Company(){
- uni.navigateTo({
- url: '/pageA/pages/newcompany'
- })
- },
- editCompany(item){
- console.log(item.companyName+1)
- uni.navigateTo({
- url: `/pageA/pages/newcompany?accountNo=${item.accountNo}&companyBank=${item.companyBank}&companyName=${item.companyName}&personNo=${item.personNo}&personName=${item.personName}&personNoImg=${item.personNoImg}&personNoImg1=${item.personNoImg1}&bankImg=${item.bankImg}&bankImg1=${item.bankImg1}&companyPhone=${item.companyPhone}&companyPlace=${item.companyPlace}&identificationNo=${item.identificationNo}&id=${item.id}`
- })
- },
- delCompany(item){
- var that =this
- var data={}
- data.id=item.id
- this.$api.request('company', 'deleteCompany', data, failres => {
- that.$api.msg(failres.errmsg)
- }).then(res => {
- if(res.data.code=='SUCCESS'){
- that.$api.msg('删除成功')
- }else{
- that.$api.msg(res.data.code)
- }
- setTimeout(()=>{uni.navigateBack({
- delta: 1
- })},1000);
- uni.hideLoading()
- })
- },
- },
- }
- </script>
- <style scoped>
- .cu-list>.cu-item.move-cur {
- -webkit-transform: translateX(-259rpx);
- transform: translateX(-259rpx);
- }
- </style>
|