myIndex.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <!-- 菜单悬浮的原理: 通过给菜单添加position:sticky实现, 用法超简单, 仅APP端的低端机不兼容 https://caniuse.com/#feat=css-sticky -->
  2. <template>
  3. <view>
  4. <view class="sticky-tabs">
  5. <!-- <me-tabs v-model="tabIndex" nameKey='name' :tabs="tabs" @change="tabChange"></me-tabs> -->
  6. <u-tabs :list="tabs" :is-scroll="false" :current="tabIndex" @change="tabChange"></u-tabs>
  7. </view>
  8. <view>
  9. <view class="box" v-for="(item,index) in goods" :key="index"
  10. @click="goNav('/my/order/pay?id='+item.postPushId)">
  11. <view class="flex align-center justify-between padding-lr padding-tb-sm">
  12. <view style="color: #82A9FE;">{{item.statusName}}</view>
  13. <view class="text-sm" style="color: #999999;">{{item.createTime}}</view>
  14. </view>
  15. <view style="width: 100%;height: 1rpx;background: #EEEEEE;"></view>
  16. <view class="padding-lr padding-tb-sm">
  17. <view class="flex align-center justify-between">
  18. <view class="text-bold" style="color: #6696FF;font-size: 38upx;">
  19. {{item.projectName?item.projectName:''}}
  20. </view>
  21. <view class="text-sm" style="color: #FF4A28;"><text
  22. class="text-lg text-bold">{{item.projectDayNum?item.projectDayNum:0}}</text>个月工期</view>
  23. </view>
  24. <view class="flex align-center margin-top-sm">
  25. <view class="argrtn">{{item.projectType}}
  26. </view>
  27. </view>
  28. <!-- <view v-if="item.status==2" class="flex align-center justify-between" style="margin: 30rpx 0 10rpx 0;">
  29. <view class="">
  30. 推送进度
  31. </view>
  32. <view class="">
  33. {{item.num}}/{{item.counts}}
  34. </view>
  35. </view> -->
  36. <!-- <view class="flex align-center justify-between margin-top-sm" style="color: #666666;">
  37. <view class="text-bold">UI界面交互设计</view>
  38. <view class="text-df">西安 莲湖区</view>
  39. </view> -->
  40. </view>
  41. <view style="width: 100%;height: 1rpx;background: #EEEEEE;"></view>
  42. <view class="flex align-center padding-tb justify-between padding-lr">
  43. <view class="">
  44. <view class="" style="float: left;">
  45. 预计<span style="color: red;padding: 0 5rpx 0 5rpx;">{{Math.ceil(dayNum / peopleNum * item.counts)}}</span>天完成
  46. </view>
  47. </view>
  48. <view class="flex align-center">
  49. <view class="btn" @click.stop="Changekefu()">联系客服</view>
  50. <view class="btn" v-if="item.status == 5 || item.status==6"
  51. @click.stop="updataServeType(item.postPushId)">修改内容</view>
  52. <view v-if="item.status==1" class="btn" @click.stop="cancelProject(item.postPushId)">取消项目</view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <empty v-if="goods.length==0" />
  58. </view>
  59. </template>
  60. <script>
  61. import meTabs from "@/components/mescroll-uni/me-tabs/me-tabs.vue";
  62. import empty from '@/components/empty.vue'
  63. export default {
  64. components: {
  65. meTabs,
  66. empty
  67. },
  68. data() {
  69. return {
  70. statustab:'',
  71. count: 0,
  72. statuss: 'loadmore',
  73. iconType: 'flower',
  74. loadText: {
  75. loadmore: '轻轻上拉',
  76. loading: '努力加载中',
  77. nomore: '实在没有了'
  78. },
  79. goods: [], // 数据列表
  80. game: [],
  81. tabs: [{
  82. name: '全部',
  83. status: ''
  84. }, {
  85. name: '进行中',
  86. status: 2
  87. }, {
  88. name: '已解冻',
  89. status: 3
  90. }],
  91. tabIndex: 0, // tab下标
  92. page: 1,
  93. limit: 10,
  94. userId: 0,
  95. status: 1,
  96. nickName: '',
  97. avatar: '',
  98. customStyle: {
  99. color: '#999999',
  100. border: '2rpx solid #999999',
  101. // backgroundColor: '#1E1F31',
  102. border: "8rpx",
  103. width: '180rpx',
  104. height: '54rpx',
  105. margin: "0 0 0 20rpx"
  106. },
  107. customStyle1: {
  108. color: '#557EFD',
  109. border: '2rpx solid #557EFD',
  110. // backgroundColor: '#1E1F31',
  111. border: "8rpx",
  112. width: '180rpx',
  113. height: '54rpx',
  114. margin: "0 0 0 20rpx"
  115. }
  116. }
  117. },
  118. onLoad(option) {
  119. this.$queue.showLoading("加载中...");
  120. this.gettype1();
  121. this.gettype2();
  122. this.getlist()
  123. this.userId = uni.getStorageSync('userId')
  124. this.nickName = uni.getStorageSync('nickName')
  125. },
  126. onShow() {
  127. this.getlist()
  128. },
  129. methods: {
  130. //获取估计人数
  131. gettype1(){
  132. this.$Request.get('/app/common/type/276').then(res => {
  133. if (res.code == 0) {
  134. this.peopleNum = parseInt(res.data.value)
  135. }
  136. })
  137. },
  138. //获取估计天数
  139. gettype2(){
  140. this.$Request.get('/app/common/type/277').then(res => {
  141. if (res.code == 0) {
  142. this.dayNum = parseInt(res.data.value)
  143. }
  144. })
  145. },
  146. //修改项目
  147. updataServeType(postPushId) {
  148. uni.navigateTo({
  149. url: '/my/publish/updataServeTypes?postPushId=' + postPushId
  150. })
  151. },
  152. //取消项目
  153. cancelProject(postPushId) {
  154. let that = this
  155. uni.showModal({
  156. content: '确认取消该项目?',
  157. title: '提示',
  158. confirmColor:'#00B88F',
  159. success(iet) {
  160. if (iet.confirm) {
  161. let data = {
  162. postPushId: postPushId
  163. }
  164. that.$Request.post('/app/postPush/cleanPostPush', data).then(res => {
  165. if (res.code == 0) {
  166. uni.showToast({
  167. title: '取消成功',
  168. duration: 1500,
  169. complete() {
  170. that.page = 1
  171. that.getlist()
  172. }
  173. })
  174. } else {
  175. uni.showToast({
  176. title: res.msg,
  177. icon: 'none'
  178. })
  179. }
  180. uni.hideLoading()
  181. })
  182. }
  183. }
  184. })
  185. },
  186. //联系客服
  187. Changekefu() {
  188. // let that = this
  189. // // #ifdef MP-WEIXIN
  190. // wx.openCustomerServiceChat({
  191. // extInfo: {
  192. // url: that.$queue.getData('kefu')
  193. // },
  194. // corpId: that.$queue.getData('kefuAppid'),
  195. // success(res) {}
  196. // })
  197. // // #endif
  198. // // #ifdef H5
  199. // window.location.href = that.$queue.getData('kefu');
  200. // // #endif
  201. // // #ifdef APP
  202. // let kefu = that.$queue.getData('kefu')
  203. // console.log(kefu)
  204. // plus.runtime.openURL(kefu, function(res) {});
  205. // // #endif
  206. uni.navigateTo({
  207. url:'/my/setting/chat'
  208. })
  209. },
  210. getlist() {
  211. let data = {
  212. status: this.statustab,
  213. classify:1,
  214. page: this.page,
  215. limit: this.limit
  216. }
  217. this.$Request.get('/app/postPush/selectPostPushListByUserId', data).then(res => {
  218. if (res.code == 0) {
  219. if (this.page == 1) this.goods = []; //如果是第一页需手动制空列表
  220. res.data.records.forEach(ret => {
  221. if (ret.status == 1) {
  222. ret.statusName = '待审核'
  223. } else if (ret.status == 2) {
  224. ret.statusName = '进行中'
  225. } else if (ret.status == 3) {
  226. ret.statusName = '已完成'
  227. } else if (ret.status == 4) {
  228. ret.statusName = '未完成'
  229. } else if (ret.status == 5) {
  230. ret.statusName = '已取消'
  231. } else if (ret.status == 6) {
  232. ret.statusName = '已拒绝'
  233. }
  234. this.goods.push(ret)
  235. })
  236. this.count = res.data.total
  237. }
  238. uni.hideLoading()
  239. })
  240. },
  241. // 切换菜单
  242. tabChange(e) {
  243. console.log(e)
  244. this.tabIndex = e
  245. this.tabs.map((item,index)=>{
  246. if(e==index){
  247. this.statustab = item.status
  248. }
  249. })
  250. this.goods = []; // 置空列表,显示加载进度条
  251. this.getlist()
  252. },
  253. goNav(url) {
  254. uni.navigateTo({
  255. url
  256. })
  257. }
  258. },
  259. onReachBottom: function() {
  260. if (this.goods.length == this.count) {
  261. uni.showToast({
  262. title: '已经到底了',
  263. icon: 'none'
  264. })
  265. } else {
  266. this.page = this.page + 1;
  267. this.getlist()
  268. }
  269. },
  270. onPullDownRefresh: function() {
  271. this.page = 1;
  272. this.getlist()
  273. }
  274. }
  275. </script>
  276. <style lang="scss">
  277. /*
  278. sticky生效条件:
  279. 1、父元素不能overflow:hidden或者overflow:auto属性。(mescroll-body设置:sticky="true"即可, mescroll-uni本身没有设置overflow)
  280. 2、必须指定top、bottom、left、right4个值之一,否则只会处于相对定位
  281. 3、父元素的高度不能低于sticky元素的高度
  282. 4、sticky元素仅在其父元素内生效,所以父元素必须是 mescroll
  283. */
  284. .sticky-tabs {
  285. z-index: 990;
  286. position: sticky;
  287. top: var(--window-top);
  288. // background-color: #fff;
  289. }
  290. page {
  291. background-color: #F7F7F7;
  292. }
  293. .bg {
  294. background-color: #FFFFFF;
  295. }
  296. .box {
  297. background: #FFFFFF;
  298. border-radius: 24upx;
  299. margin: 30upx;
  300. }
  301. .argrtn {
  302. background: #F6F6F6;
  303. color: #666666;
  304. font-size: 24upx;
  305. border-radius: 8upx;
  306. padding: 5upx 20upx;
  307. margin-right: 20upx;
  308. }
  309. .btn {
  310. border: 1px solid #82A9FE;
  311. border-radius: 30px;
  312. color: #82A9FE;
  313. padding: 14upx 35upx;
  314. margin-left: 20upx;
  315. }
  316. </style>