index - 副本.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view>
  3. <view>
  4. <view style="padding: 20rpx;">
  5. <view class="list-items_1 flex-row list" v-for="(item, index) in goodlist" :key="index">
  6. <view style="">
  7. <view style="position: absolute;z-index: 999;background-color: red;color:#fff;padding:2px;font-size: 11px;">{{ item.cname }}</view>
  8. <image :src="item.litpic" style="width: 150px;height: 120px;"></image>
  9. </view>
  10. <view class="group_3 flex-col">
  11. <text class="text_2" style="color: 'rgba(0,47,167,1)'">{{ item.name }}</text>
  12. <text class="text_3">乐票:{{ item.lpnum }}&nbsp;/&nbsp;{{ item.shouyi }}</text>
  13. <view class="text-wrapper_2 flex-row justify-between">
  14. <text class="text_4">周期:{{ item.tianshu }}天&nbsp;/&nbsp;{{ item.shouyi1 }}%</text>
  15. <text class="text_5" style="margin-left: 20px;">
  16. {{ item.kssj}}&nbsp;~&nbsp;{{ item.jssj}}
  17. </text>
  18. </view>
  19. <text class="text_6">¥{{ item.price }}</text>
  20. <view class="box_1 flex-row">
  21. <view
  22. @click="autoYuyue(item.id, 1, true)"
  23. class="text-wrapper_3 flex-col"
  24. style="background-color: hsl(223deg 49% 51%);"
  25. >
  26. <text class="text_7" style="margin-left: 1px;">自动一单</text>
  27. </view>
  28. <view @click="autoYuyue(item.id, 1, true)" class="text-wrapper_3 flex-col" style="background:#989898;">
  29. <text class="text_7" style="margin-left: 1px;">已结束</text>
  30. </view>
  31. <view
  32. @click="autoYuyue(item.id, 2, true)"
  33. class="text-wrapper_4 flex-col"
  34. style="background-color: hsl(223deg 49% 51%);"
  35. >
  36. <text class="text_8" style="margin-left: 1px;">自动二单</text>
  37. </view>
  38. <view
  39. @click="autoYuyue(item.id, 1, true)"
  40. class="text-wrapper_5 flex-col"
  41. style="background-color: hsl(223deg 49% 51%);"
  42. >
  43. <text class="text_9" style="margin-left: 1px;">手动预约</text>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <uni-popup ref="popup" type="bottom">
  51. <view style="background-color: #fff;padding:10px;">
  52. <view style="padding-left: 10px;">确认预约单数</view>
  53. <input class="uni-input" style="height: 50px;margin:10px;border:solid 0px #999;border-radius: 5px;padding-left: 10px;" v-model="num" placeholder="输入预约单数" />
  54. <button style="width:150px;margin: 0 auto;background-color:dodgerblue;color: #fff;" @click="autoYuyue(0, 0, true)">确定预约</button>
  55. </view>
  56. </uni-popup>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. data() {
  62. return {
  63. constants: {},
  64. goodlist: [],
  65. num: 0,
  66. id: 0,
  67. userinfo: null
  68. };
  69. },
  70. onShow() {
  71. var user = this.$api.getUserinfo();
  72. if (user) {
  73. this.userinfo = user;
  74. } else {
  75. this.userinfo = null;
  76. }
  77. },
  78. filters: {
  79. formatDate: function(value, args) {
  80. var dt = new Date(value);
  81. if (args == 'yyyy-M-d') {
  82. // yyyy-M-d
  83. let year = dt.getFullYear();
  84. let month = dt.getMonth() + 1;
  85. let date = dt.getDate();
  86. return `${year}-${month}-${date}`;
  87. } else if (args == 'yyyy-M-d H:m:s') {
  88. // yyyy-M-d H:m:s
  89. let year = dt.getFullYear();
  90. let month = dt.getMonth() + 1;
  91. let date = dt.getDate();
  92. let hour = dt.getHours();
  93. let minute = dt.getMinutes();
  94. let second = dt.getSeconds();
  95. return `${year}-${month}-${date} ${hour}:${minute}:${second}`;
  96. } else if (args == 'yyyy-MM-dd') {
  97. // yyyy-MM-dd
  98. let year = dt.getFullYear();
  99. let month = (dt.getMonth() + 1).toString().padStart(2, '0');
  100. let date = dt
  101. .getDate()
  102. .toString()
  103. .padStart(2, '0');
  104. return `${year}-${month}-${date}`;
  105. } else if (args == 'HH:mm') {
  106. // yyyy-MM-dd
  107. let hour = dt
  108. .getHours()
  109. .toString()
  110. .padStart(2, '0');
  111. let minute = dt
  112. .getMinutes()
  113. .toString()
  114. .padStart(2, '0');
  115. return `${hour}:${minute}`;
  116. } else {
  117. // yyyy-MM-dd HH:mm:ss
  118. let year = dt.getFullYear();
  119. let month = (dt.getMonth() + 1).toString().padStart(2, '0');
  120. let date = dt
  121. .getDate()
  122. .toString()
  123. .padStart(2, '0');
  124. let hour = dt
  125. .getHours()
  126. .toString()
  127. .padStart(2, '0');
  128. let minute = dt
  129. .getMinutes()
  130. .toString()
  131. .padStart(2, '0');
  132. let second = dt
  133. .getSeconds()
  134. .toString()
  135. .padStart(2, '0');
  136. return `${year}-${month}-${date} ${hour}:${minute}:${second}`;
  137. }
  138. }
  139. },
  140. onLoad(option) {
  141. // console.log(option);
  142. this.getMhGoodlist();
  143. },
  144. methods: {
  145. autoYuyue(id, num, confirm) {
  146. if (!this.userinfo) {
  147. uni.showToast({
  148. title: '请先登录',
  149. icon: 'none'
  150. });
  151. return;
  152. }
  153. if (confirm == false) {
  154. this.id = id;
  155. this.num = num;
  156. //手动预约的 要求输入数量
  157. this.$refs.popup.open('bottom');
  158. return;
  159. }
  160. var data = new Object();
  161. data.cid = id;
  162. data.uid = this.userinfo.id;
  163. data.num = num;
  164. // console.log(data)
  165. this.$api
  166. .MhGetModel(data, 'jingxi/yuyue')
  167. .then(res => {
  168. // console.log('MhGoodAutoYuyue信息', JSON.stringify(res));
  169. if (res.data.code != 0) {
  170. uni.showToast({
  171. title: res.data.msg,
  172. icon: 'none'
  173. });
  174. return;
  175. } else {
  176. uni.showToast({
  177. title: res.data.msg,
  178. icon: 'none'
  179. });
  180. }
  181. })
  182. .catch(err => {
  183. // console.log('request fail', JSON.stringify(err));
  184. });
  185. },
  186. getMhGoodlist() {
  187. var data = new Object();
  188. this.$api
  189. .MhGetModel(data, 'jingxi/list')
  190. .then(res => {
  191. // console.log(res.data.code)
  192. // console.log('jingxi/list信息',JSON.stringify(res.data.data));
  193. this.goodlist = res.data.data;
  194. })
  195. .catch(err => {
  196. // console.log('request fail', JSON.stringify(err));
  197. });
  198. }
  199. }
  200. };
  201. </script>
  202. <style lang="css">
  203. @import '../common/common.css';
  204. @import './assets/style/index.rpx.css';
  205. page{padding: 15rpx;background:#b7bab3 no-repeat;}
  206. .nav-counter {
  207. position: absolute;
  208. top: 11px;
  209. left: -8px;
  210. min-width: 8px;
  211. height: 20px;
  212. width: 20px;
  213. line-height: 19px;
  214. margin-top: -11px;
  215. font-weight: normal;
  216. color: white;
  217. text-align: center;
  218. text-shadow: 0 1px rgb(0 0 0 / 20%);
  219. background: #e23442;
  220. border: 1px solid #911f28;
  221. border-radius: 10px;
  222. background-image: -moz-linear-gradient(top, #e8616c, #dd202f);
  223. background-image: -o-linear-gradient(top, #e8616c, #dd202f);
  224. background-image: linear-gradient(to bottom, #e8616c, #dd202f);
  225. -webkit-box-shadow: inset 0 0 1px 1px rgb(255 255 255 / 10%), 0 1px rgb(0 0 0 / 12%);
  226. box-shadow: inset 0 0 1px 1px rgb(255 255 255 / 10%), 0 1px rgb(0 0 0 / 12%);
  227. }
  228. .list{background: rgba(255,255,255,0.5);padding: 20rpx;border-radius: 10rpx;height: auto !important;}
  229. .nav-counter-blue {
  230. background: #e8616c;
  231. border: 1px solid #dd202f;
  232. background-image: -webkit-linear-gradient(top, #e8616c, #dd202f);
  233. background-image: -moz-linear-gradient(top, #e8616c, #dd202f);
  234. background-image: -o-linear-gradient(top, #e8616c, #dd202f);
  235. background-image: linear-gradient(to bottom, #e8616c, #dd202f);
  236. }
  237. </style>