addorder.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <view class="content">
  3. <view class="navbar">
  4. <view v-for="(item, index) in navlist" :key="index" class="nav-item"
  5. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.title }}</view>
  6. </view>
  7. <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300" disable-touch>
  8. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navlist" :key="tabIndex">
  9. <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData" :style="{ height: height }">
  10. <!-- 空白页 -->
  11. <u-empty text="暂无数据" mode="list" v-if="tabItem.loaded && tabItem.list.length == 0"></u-empty>
  12. <!-- 订单列表 -->
  13. <view class="good" v-for="item in tabItem.list">
  14. <image src="" mode="" class="good-img"></image>
  15. <view class="good-info">
  16. <view class="good-tit clamp2">
  17. 涅槃旗下官方正品线雕提拉术
  18. </view>
  19. <view class="good-tip">
  20. 随时随地 预约服务
  21. </view>
  22. <view class="good-buy">
  23. 已售1000件
  24. </view>
  25. <view class="good-price">
  26. 34 <text class="ot-price"></text>
  27. </view>
  28. </view>
  29. <view class="add-jian-wrap">
  30. <image src="../../static/img/jian.png" mode="" v-if="nun > 0" @click="jian()"></image>
  31. <input type="number" class="input" v-model="nun" v-if="nun > 0" disabled>
  32. <image src="../../static/img/add.png" mode="" @click="add()"></image>
  33. </view>
  34. </view>
  35. <u-loadmore :status="tabItem.loadingType" />
  36. <view class="tc" style="height: 100rpx;"></view>
  37. </scroll-view>
  38. </swiper-item>
  39. </swiper>
  40. <view class="sub-btn">
  41. <view class="sub-info">
  42. 合计:<input type="number" >
  43. </view>
  44. <view class="sub" @click="sub">
  45. 结算(2)
  46. </view>
  47. </view>
  48. <u-modal
  49. v-model="tip_show"
  50. @confirm="ok()"
  51. @cancel="cancel()"
  52. :show-cancel-button="true"
  53. cancel-text="取消"
  54. confirm-text="确认"
  55. content="确认添加这些商品吗"
  56. title="确认"
  57. confirm-color="#FF5454"
  58. ></u-modal>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. data() {
  64. return {
  65. tip_show: false,
  66. nun: 0,
  67. height: '',
  68. tabCurrentIndex: 0,
  69. navlist: [{
  70. status: 0,
  71. title: '服务项目',
  72. list: 10,
  73. page: 1,
  74. limit: 10,
  75. loaded: false,
  76. loadingType: 'loadmore'
  77. },
  78. {
  79. status: 1,
  80. title: '实体商品',
  81. list: [],
  82. page: 1,
  83. limit: 10,
  84. loaded: false,
  85. loadingType: 'loadmore'
  86. }
  87. ]
  88. }
  89. },
  90. onLoad(opt) {
  91. },
  92. onShow() {
  93. },
  94. onReachBottom() {
  95. },
  96. onReady() {
  97. var _this = this;
  98. uni.getSystemInfo({
  99. success: resu => {
  100. const query = uni.createSelectorQuery();
  101. query.select('.swiper-box').boundingClientRect();
  102. query.exec(function(res) {
  103. _this.height = resu.windowHeight - res[0].top + 'px';
  104. console.log('打印页面的剩余高度', _this.height);
  105. });
  106. },
  107. fail: res => {}
  108. });
  109. },
  110. methods: {
  111. // 减少商品
  112. jian() {
  113. this.nun--
  114. },
  115. // 增加商品
  116. add() {
  117. this.nun++
  118. },
  119. //顶部tab点击
  120. tabClick(index) {
  121. this.tabCurrentIndex = index;
  122. // this.loadData('tab')
  123. },
  124. // 获取数据
  125. loadData(type) {
  126. let that = this
  127. let index = that.tabCurrentIndex
  128. let item = that.navlist[index]
  129. if (type == 'reload') {
  130. item.loaded = false
  131. item.loadingType = 'more'
  132. item.page = 1
  133. item.list = []
  134. }
  135. if (type == 'tab' && item.loaded) {
  136. return
  137. }
  138. if (item.loadingType == 'loading' || item.loadingType == 'noMore') {
  139. return
  140. }
  141. item.loadingType = 'loading'
  142. },
  143. sub() {
  144. this.tip_show = true
  145. },
  146. ok() {
  147. },
  148. cancel() {
  149. }
  150. }
  151. }
  152. </script>
  153. <style lang="scss">
  154. .navbar {
  155. display: flex;
  156. height: 88rpx;
  157. padding: 0 5px;
  158. background: #fff;
  159. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  160. position: relative;
  161. z-index: 10;
  162. .nav-item {
  163. flex: 1;
  164. display: flex;
  165. justify-content: center;
  166. align-items: center;
  167. height: 100%;
  168. font-size: 15px;
  169. color: #999999;
  170. position: relative;
  171. &.current {
  172. color: #FD463E;
  173. &:after {
  174. content: '';
  175. position: absolute;
  176. left: 50%;
  177. bottom: 0;
  178. transform: translateX(-50%);
  179. width: 44px;
  180. height: 0;
  181. border-bottom: 2px solid #FD463E;
  182. }
  183. }
  184. }
  185. }
  186. .good {
  187. width: 690rpx;
  188. margin: 20rpx auto;
  189. display: flex;
  190. justify-content: flex-start;
  191. padding: 20rpx;
  192. background-color: #fff;
  193. border-radius: 20rpx;
  194. position: relative;
  195. .add-jian-wrap {
  196. position: absolute;
  197. // top: ;
  198. bottom: 30rpx;
  199. right: 50rpx;
  200. width: 150rpx;
  201. height: 44rpx;
  202. display: flex;
  203. align-items: center;
  204. justify-content: flex-end;
  205. image {
  206. width: 44rpx;
  207. height: 44rpx;
  208. flex-shrink: 0;
  209. }
  210. .input {
  211. // display: flex;
  212. text-align: center;
  213. line-height: 44rpx;
  214. flex-grow: 1;
  215. font-size: 36rpx;
  216. font-weight: bold;
  217. color: #333333;
  218. }
  219. }
  220. .good-check {
  221. position: absolute;
  222. bottom: 20rpx;
  223. right: 20rpx;
  224. }
  225. .good-img {
  226. width: 256rpx;
  227. height: 256rpx;
  228. background: #D6DEE1;
  229. border-radius: 15rpx;
  230. flex-shrink: 0;
  231. margin-right: 15rpx;
  232. }
  233. .good-info {
  234. display: flex;
  235. flex-direction: column;
  236. // align-items: ;
  237. justify-content: space-between;
  238. align-items: flex-start;
  239. .good-tit {
  240. font-size: 28rpx;
  241. font-weight: 500;
  242. color: #333333;
  243. }
  244. .good-buy {
  245. font-size: 24rpx;
  246. font-weight: 500;
  247. color: #9a9a9a;
  248. }
  249. .good-tip {
  250. font-size: 24rpx;
  251. font-weight: 500;
  252. color: #FA7014;
  253. }
  254. .good-price {
  255. color: #fd463e;
  256. font-size: 32rpx;
  257. &::before {
  258. content: '¥';
  259. font-size: 22rpx;
  260. color: #fd463e;
  261. }
  262. text {
  263. }
  264. }
  265. }
  266. }
  267. .sub-btn {
  268. width: 750rpx;
  269. height: 100rpx;
  270. background: #FFFFFF;
  271. position: fixed;
  272. bottom: 0;
  273. display: flex;
  274. justify-content: space-between;
  275. align-items: center;
  276. padding: 0 30rpx;
  277. .sub-info {
  278. display: flex;
  279. justify-content: flex-start;
  280. align-items: center;
  281. input {
  282. color: #FF4C4C;
  283. font-size: 32rpx;
  284. font-weight: bold;
  285. }
  286. }
  287. .sub {
  288. width: 220rpx;
  289. height: 80rpx;
  290. line-height: 80rpx;
  291. background: #FF4C4C;
  292. border-radius: 40rpx;
  293. font-size: 32rpx;
  294. font-weight: bold;
  295. color: #FFFFFF;
  296. text-align: center;
  297. }
  298. }
  299. </style>