| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- // pages/shipOwnerManage/shipOwnerList/shipOwnerList.js
- import {
- uploadFile
- } from "../../../utils/upload"
- import {
- postApi
- } from "../../../apis/api"
- Page({
- data: {
- shipOwnerList: [],
- term: '',
- currentLetter: '',
- },
- async getShipOwnerList(type) {
- if (!wx.getStorageSync('loginAccountId')) {
- this.setData({
- shipOwnerList: [],
- currentLetter: ''
- })
- wx.showToast({
- title: '尚未登录',
- icon: "error"
- })
- return
- }
- let res = await postApi('/ship/wx/list', {
- loginAccountId: wx.getStorageSync('loginAccountId'),
- term: this.data.term
- })
- if (type) wx.stopPullDownRefresh()
- if (res.data.status == 0) {
- if (res.data.result.length == 0) {
- wx.showToast({
- title: '暂无数据',
- icon: "error"
- })
- return
- }
- let shipOwnerList = res.data.result
- shipOwnerList[0].letter = "#"
- shipOwnerList.push(shipOwnerList.shift())
- this.setData({
- shipOwnerList
- })
- } else {
- this.setData({
- shipOwnerList: []
- })
- }
- },
- call(e) {
- wx.makePhoneCall({
- phoneNumber: e.currentTarget.dataset.phone
- })
- },
- addShipOwner() {
- if (!wx.getStorageSync('loginAccountId')) {
- wx.showToast({
- title: '尚未登录',
- icon: "error"
- })
- return
- }
- wx.navigateTo({
- url: '../addShipOnwer/addShipOnwer',
- })
- },
- tapLetter(e) {
- this.setData({
- currentLetter: e.currentTarget.dataset.letter
- })
- },
- createVoyage(e) {
- console.log(e)
- let {
- shipId,
- shipName
- } = e.currentTarget.dataset.shipowner
- wx.showModal({
- title: '是否创建航次?',
- content: shipName,
- success(res) {
- if (res.confirm) {
- wx.navigateTo({
- url: `/pages/voyageManage/createVoyage/createVoyage?shipId=${shipId}&shipName=${shipName}`,
- })
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- },
- fail: e => {
- console.log(e)
- }
- })
- },
- onLoad() {
- },
- onPullDownRefresh() {
- this.setData({
- term: ''
- })
- this.getShipOwnerList(1)
- },
- onShow() {
- this.getShipOwnerList()
- }
- })
|