creatStandard.vue 16 KB

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