creatStandard.vue 16 KB

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