creatStandard.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  1. <template>
  2. <view class="product">
  3. <view class="top"></view>
  4. <view class="head">
  5. <view class="handle">
  6. <view class="head_left">
  7. <span class="cuIcon-back" @click="back"></span>
  8. </view>
  9. <span class="center">添加品牌标品</span>
  10. </view>
  11. <view class="search">
  12. <span class="cuIcon-search"></span>
  13. <!-- <input @blur="InputBlur" :adjust-position="false" type="text" placeholder="请输入关键词" confirm-type="search"> -->
  14. <u-input v-model="productName" />
  15. </input>
  16. <view class="search_btn" @click.stop="getProductList">
  17. <span></span>搜索
  18. </view>
  19. </view>
  20. </view>
  21. <view class="list">
  22. <view class="product_item" v-for="(item, index) in productList" :key="index">
  23. <view class="details">
  24. <view class="img">
  25. <image :src="item.productImage" mode=""></image>
  26. </view>
  27. <view class="data">
  28. <span>{{ item.productName }}</span>
  29. <!-- <span>售卖时间:{{item.time}}</span> -->
  30. <view class="repertory">售卖时间:{{ item.saleStartDate }} - {{ item.saleEndDate }}</view>
  31. <view class="price">
  32. <span style="font-size: 22rpx;margin: 0px;">¥</span>{{ item.soldPrice }}
  33. <span style="color:#999 ;font-size: 22rpx; text-decoration: line-through;">¥{{ item.price }}</span>
  34. </view>
  35. </view>
  36. <view class="ticket" v-if="item.isRights == 1">
  37. <image src="/static/product/ticket.png" mode=""></image>
  38. </view>
  39. <view class="tag" @click.stop="select(item)">
  40. <!-- <span>组合套餐</span>
  41. <span class="frame"></span> -->
  42. <image src="/static/product/select.png" mode="" v-if="item.select"></image>
  43. <image src="/static/product/round.png" mode="" v-else></image>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="creat">
  49. <view class="operate">
  50. <view class="all" @click="allSelect">
  51. <image src="/static/product/select.png" mode="" v-if="isAll"></image>
  52. <image src="/static/product/round.png" mode="" v-else></image>
  53. 全选
  54. </view>
  55. <view class="delete delist" @click="add()">确认添加</view>
  56. </view>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import configService from '../../common/service/config.service'
  62. export default {
  63. data() {
  64. return {
  65. isManage: false,
  66. currentIndex: 0,
  67. productStatus: 0, //商品状态,默认1售卖中,0未上架,2审核中,3未通过
  68. isAll: false,
  69. canBeDelete: true,
  70. productName: '',
  71. productList: [],
  72. merchantId: '',
  73. tabIndex: 1
  74. }
  75. },
  76. methods: {
  77. //返回
  78. back() {
  79. uni.navigateTo({
  80. url: '/pages/product/index'
  81. })
  82. },
  83. handleClear() {
  84. this.getProductList()
  85. // 这里可以添加其他逻辑
  86. },
  87. //切换分类
  88. selectType(item, index) {
  89. if (!this.isManage) {
  90. this.currentIndex = index
  91. this.productStatus = item.code
  92. this.getProductList()
  93. }
  94. },
  95. add() {
  96. if (this.productList.filter(e => e.select).map(e => e.productId).length > 0) {
  97. let ids = this.productList.filter(e => e.select).map(e => e.productId).join(',')
  98. this.$http.get("/app/product/addPurveyorProduct?ids=" + ids + '&merchantId=' + this.merchantId)
  99. .then(res => {
  100. if (res.data.code == 200) {
  101. this.$tip.success(res.data.message || '添加成功');
  102. this.back()
  103. } else {
  104. uni.showToast({
  105. icon:'error',
  106. title:'不能重复添加'
  107. })
  108. // this.$tip.error(res.data.message);
  109. }
  110. })
  111. } else {
  112. this.$tip.alert('请选择品牌标品');
  113. }
  114. },
  115. select(item) {
  116. item.select = !item.select
  117. },
  118. //全选
  119. allSelect() {
  120. if (this.isAll) {
  121. this.isAll = false
  122. this.productList.forEach(item => {
  123. item.select = false
  124. })
  125. } else {
  126. this.isAll = true
  127. this.productList.forEach(item => {
  128. item.select = true
  129. })
  130. }
  131. },
  132. getProductList() {
  133. this.$http.get("/app/product/purveyor/list?merchantId=" + this.merchantId + "&productStatus=" + this
  134. .productStatus +
  135. '&productName=' + this.productName, )
  136. .then(res => {
  137. if (res.data.code == 200) {
  138. res.data.result.records.forEach((item) => {
  139. item.select = false;
  140. item.saleEndDate = item.saleEndDate.includes('00:00:00') ? item.saleEndDate.slice(0, 10) : item
  141. .saleEndDate
  142. item.saleStartDate = item.saleStartDate.includes('00:00:00') ? item.saleStartDate.slice(0, 10) :
  143. item.saleStartDate
  144. // item.productImage = configService.apiUrl + '/' + item.productImage
  145. })
  146. this.productList = res.data.result.records
  147. }
  148. })
  149. },
  150. },
  151. onShow() {
  152. let that = this
  153. uni.getStorage({
  154. key: 'login_user_info',
  155. success: function(res) {
  156. that.merchantId = res.data.merchantId
  157. that.getProductList()
  158. }
  159. })
  160. uni.removeStorage({
  161. key: 'smdate',
  162. });
  163. uni.removeStorage({
  164. key: 'group',
  165. });
  166. }
  167. // async onShow() {
  168. // let that = this
  169. // uni.getStorage({
  170. // key: 'login_user_info',
  171. // success: function(res) {
  172. // that.merchantId = res.data.merchantId
  173. // }
  174. // })
  175. // let res = await this.$http.get(
  176. // "/app/product/purveyor/list?merchantId=" + this.merchantId + "&productStatus=" + this.productStatus +
  177. // '&productName=' + this.productName)
  178. // console.log(res)
  179. // if (res.data.code == 200) {
  180. // res.data.result.records.forEach((item) => {
  181. // item.select = false;
  182. // item.saleEndDate = item.saleEndDate.includes('00:00:00') ? item.saleEndDate.slice(0, 10) : item
  183. // .saleEndDate
  184. // item.saleStartDate = item.saleStartDate.includes('00:00:00') ? item.saleStartDate.slice(0, 10) : item
  185. // .saleStartDate
  186. // // item.productImage = configService.apiUrl + '/' + item.productImage
  187. // })
  188. // this.productList = res.data.result.records
  189. // console.log(this.productList.length)
  190. // }
  191. // // await this.getProductList()
  192. // // console.log(this.productList.length)
  193. // uni.showToast({
  194. // icon: 'error',
  195. // title: '' + this.productList.length
  196. // })
  197. // // uni.removeStorage({
  198. // // key: 'smdate',
  199. // // });
  200. // // uni.removeStorage({
  201. // // key: 'group',
  202. // // });
  203. // }
  204. }
  205. </script>
  206. <style lang="scss" scoped>
  207. .product {
  208. width: 100%;
  209. height: 100vh;
  210. display: flex;
  211. flex-direction: column;
  212. justify-content: space-between;
  213. background: #F7F8FC;
  214. .top {
  215. width: 100%;
  216. height: var(--status-bar-height);
  217. background: linear-gradient(87deg, #FFFFFF 0%, #A3CDFF 100%), linear-gradient(360deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%);
  218. }
  219. .head {
  220. width: 100%;
  221. background: #ffffff;
  222. .handle {
  223. height: 112rpx;
  224. display: flex;
  225. justify-content: space-between;
  226. align-items: center;
  227. padding: 0px 24rpx;
  228. position: relative;
  229. background: linear-gradient(87deg, #FFFFFF 0%, #A3CDFF 100%), linear-gradient(360deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%);
  230. .head_left {
  231. font-size: 40rpx;
  232. }
  233. .center {
  234. position: absolute;
  235. left: 50%;
  236. top: 50%;
  237. transform: translate(-50%, -50%);
  238. font-size: 36rpx;
  239. font-weight: 600;
  240. }
  241. .head_right {
  242. display: flex;
  243. justify-content: space-between;
  244. align-items: center;
  245. span {
  246. width: 40rpx;
  247. height: 40rpx;
  248. display: flex;
  249. justify-content: center;
  250. align-items: center;
  251. }
  252. .manage {
  253. // width: 150rpx;
  254. margin-left: 28rpx;
  255. }
  256. }
  257. }
  258. .search {
  259. width: 93%;
  260. height: 56rpx;
  261. background: #F7F8FC;
  262. border-radius: 12rpx;
  263. display: flex;
  264. align-items: center;
  265. justify-content: space-between;
  266. margin: 24rpx auto;
  267. font-size: 26rpx;
  268. padding: 13rpx 20rpx;
  269. span {
  270. margin-right: 15rpx;
  271. }
  272. input {
  273. flex: 1;
  274. font-size: 26rpx;
  275. }
  276. .search_btn {
  277. width: 72rpx;
  278. color: #333333;
  279. display: flex;
  280. align-items: center;
  281. justify-content: space-between;
  282. span {
  283. display: block;
  284. width: 1px;
  285. height: 26rpx;
  286. background-color: #eeeeee;
  287. }
  288. }
  289. }
  290. .type {
  291. display: flex;
  292. justify-content: space-between;
  293. background-color: #fff;
  294. padding: 8px 24rpx 16rpx;
  295. .type_item {
  296. height: 54rpx;
  297. display: flex;
  298. justify-content: center;
  299. align-items: center;
  300. font-size: 26rpx;
  301. color: #888888;
  302. position: relative;
  303. padding: 8rpx 12rpx;
  304. background: #F2F3F5;
  305. border-radius: 8rpx;
  306. }
  307. .active {
  308. color: #2D88F4;
  309. background: #ECF5FF;
  310. }
  311. }
  312. }
  313. .list {
  314. width: 100%;
  315. flex: 1;
  316. // padding: 0px 20rpx;
  317. overflow-y: auto;
  318. .product_item {
  319. width: 100%;
  320. background-color: #fff;
  321. border-radius: 20rpx;
  322. padding: 20rpx 40rpx;
  323. margin-top: 20rpx;
  324. .status {
  325. display: flex;
  326. align-items: center;
  327. .round {
  328. display: flex;
  329. align-items: center;
  330. color: #49A03F;
  331. }
  332. .round::before {
  333. content: "";
  334. display: inline-block;
  335. width: 9rpx;
  336. height: 9rpx;
  337. background: #49A03F;
  338. border-radius: 50%;
  339. margin-right: 8rpx;
  340. }
  341. .no {
  342. color: #666666;
  343. }
  344. .no::before {
  345. content: "";
  346. display: inline-block;
  347. width: 9rpx;
  348. height: 9rpx;
  349. background: #666666;
  350. border-radius: 50%;
  351. margin-right: 8rpx;
  352. }
  353. .audit {
  354. display: flex;
  355. align-items: center;
  356. color: #596ABB;
  357. }
  358. .audit::before {
  359. content: "";
  360. display: inline-block;
  361. width: 9rpx;
  362. height: 9rpx;
  363. background: #596ABB;
  364. border-radius: 50%;
  365. margin-right: 8rpx;
  366. }
  367. .reject {
  368. display: flex;
  369. align-items: center;
  370. color: #F55D65;
  371. }
  372. .reject::before {
  373. content: "";
  374. display: inline-block;
  375. width: 9rpx;
  376. height: 9rpx;
  377. background: #F55D65;
  378. border-radius: 50%;
  379. margin-right: 8rpx;
  380. }
  381. .line {
  382. display: block;
  383. width: 1rpx;
  384. height: 20rpx;
  385. background: #d9d9d9;
  386. margin: 0 12rpx;
  387. }
  388. }
  389. .details {
  390. width: 100%;
  391. height: auto;
  392. min-height: 132rpx;
  393. // height: 132rpx;
  394. display: flex;
  395. align-items: center;
  396. margin-top: 20rpx;
  397. .img {
  398. margin-right: 16rpx;
  399. border-radius: 12rpx;
  400. overflow: hidden;
  401. image {
  402. width: 132rpx;
  403. height: 132rpx;
  404. }
  405. }
  406. .data {
  407. flex: 1;
  408. height: 100%;
  409. display: flex;
  410. flex-direction: column;
  411. justify-content: space-between;
  412. font-weight: 600;
  413. font-style: 28rpx;
  414. .repertory {
  415. font-size: 24rpx;
  416. display: flex;
  417. align-items: center;
  418. color: #8A91A8;
  419. font-weight: 400;
  420. margin: 6rpx 0 10rpx 0;
  421. }
  422. .price {
  423. display: flex;
  424. align-items: center;
  425. font-size: 30rpx;
  426. font-weight: 600;
  427. span {
  428. font-size: 26rpx;
  429. margin-left: 20rpx;
  430. font-weight: 400;
  431. }
  432. }
  433. }
  434. .ticket {
  435. margin: 0 20rpx;
  436. image {
  437. width: 50rpx;
  438. height: 50rpx;
  439. }
  440. }
  441. .tag {
  442. width: 40rpx;
  443. height: 40rpx;
  444. display: flex;
  445. flex-direction: column;
  446. align-items: center;
  447. image {
  448. width: 40rpx;
  449. height: 40rpx;
  450. }
  451. }
  452. }
  453. .btn_box {
  454. width: 100%;
  455. display: flex;
  456. justify-content: flex-end;
  457. align-items: center;
  458. margin-top: 20rpx;
  459. .delist {
  460. width: 100rpx;
  461. height: 50rpx;
  462. border-radius: 8rpx;
  463. border: 1px solid #CCCCCC;
  464. display: flex;
  465. justify-content: center;
  466. align-items: center;
  467. font-size: 26rpx;
  468. color: #666666;
  469. }
  470. .edit {
  471. margin-left: 20rpx;
  472. background: rgba(68, 154, 255, 0.05);
  473. border: 1px solid #449AFF;
  474. color: #449AFF;
  475. }
  476. }
  477. }
  478. }
  479. .creat {
  480. width: 100%;
  481. height: 100rpx;
  482. background-color: #fff;
  483. display: flex;
  484. justify-content: center;
  485. align-items: center;
  486. .btn {
  487. width: 672rpx;
  488. height: 76rpx;
  489. display: flex;
  490. justify-content: center;
  491. align-items: center;
  492. background: linear-gradient(90deg, #77B6FF 0%, #449AFF 100%);
  493. border-radius: 75rpx;
  494. font-size: 28rpx;
  495. color: #FFFFFF;
  496. image {
  497. width: 40rpx;
  498. height: 40rpx;
  499. margin-right: 10rpx;
  500. }
  501. }
  502. .operate {
  503. width: 100%;
  504. display: flex;
  505. // justify-content: space-between;
  506. align-items: center;
  507. padding: 0px 20rpx;
  508. justify-content: space-between;
  509. .delete {
  510. width: 205rpx;
  511. height: 76rpx;
  512. background: linear-gradient(90deg, #77B6FF 0%, #449AFF 100%);
  513. border-radius: 49rpx;
  514. font-size: 28rpx;
  515. color: #FFFFFF;
  516. display: flex;
  517. justify-content: center;
  518. align-items: center;
  519. margin-right: 24rpx;
  520. margin-left: 140rpx;
  521. }
  522. .delist {
  523. margin-left: 0rpx;
  524. background: linear-gradient(90deg, #FFA05B 0%, #FF7918 100%);
  525. }
  526. .all {
  527. width: 25%;
  528. // height: 60rpx;
  529. // border: 1px solid #999;
  530. display: flex;
  531. justify-content: center;
  532. align-items: center;
  533. image {
  534. width: 40rpx;
  535. height: 40rpx;
  536. margin-right: 10rpx;
  537. }
  538. }
  539. }
  540. }
  541. .popup {
  542. width: 100vw;
  543. height: 100vh;
  544. position: fixed;
  545. top: 0;
  546. left: 0;
  547. background: rgba(0, 0, 0, 0.4);
  548. display: flex;
  549. align-items: center;
  550. justify-content: center;
  551. .content {
  552. width: 570rpx;
  553. background: #FFFFFF;
  554. border-radius: 16rpx;
  555. padding: 0px 24rpx;
  556. padding-bottom: 16rpx;
  557. .title {
  558. width: 100%;
  559. height: 86rpx;
  560. font-size: 32rpx;
  561. color: #333333;
  562. font-weight: 600;
  563. border-bottom: 1px solid #EEEEEE;
  564. display: flex;
  565. align-items: center;
  566. justify-content: center;
  567. }
  568. .center {
  569. font-size: 30rpx;
  570. color: #333333;
  571. line-height: 35rpx;
  572. display: flex;
  573. flex-direction: column;
  574. align-items: center;
  575. justify-content: center;
  576. padding-top: 28rpx;
  577. border-bottom: 1px solid #EEEEEE;
  578. padding-bottom: 40rpx;
  579. margin-bottom: 16rpx;
  580. .error {
  581. text-align: center;
  582. }
  583. image {
  584. width: 100rpx;
  585. height: 100rpx;
  586. margin-bottom: 10rpx;
  587. }
  588. }
  589. .sub {
  590. width: 320rpx;
  591. height: 68rpx;
  592. border-radius: 66rpx;
  593. font-size: 28rpx;
  594. color: #FFFFFF;
  595. display: flex;
  596. align-items: center;
  597. justify-content: center;
  598. margin: 0rpx auto;
  599. .button {
  600. width: 320rpx;
  601. height: 68rpx;
  602. background: #449AFF;
  603. border-radius: 66rpx;
  604. display: flex;
  605. align-items: center;
  606. justify-content: center;
  607. }
  608. }
  609. .start {
  610. background: #53CC48;
  611. }
  612. .rest {
  613. background: #FF8024;
  614. }
  615. }
  616. }
  617. }
  618. .tab-container {
  619. display: flex;
  620. justify-content: space-around;
  621. .tab-item {
  622. position: relative;
  623. padding: 18rpx 0;
  624. cursor: pointer;
  625. color: #333;
  626. font-weight: 400;
  627. font-size: 28rpx;
  628. }
  629. .tab-item.active {
  630. color: #449AFF;
  631. font-weight: 600;
  632. }
  633. .tab-item.active::after {
  634. content: '';
  635. position: absolute;
  636. bottom: -28px;
  637. left: 35%;
  638. width: 38rpx;
  639. height: 100%;
  640. background: url(/static/product/tab-act.png) no-repeat;
  641. background-size: contain;
  642. }
  643. }
  644. </style>