selectItem.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <view class="app-main app-content">
  3. <view class="input-wrap_box">
  4. <view>
  5. <AppSearchModule v-model="searchText" placeholder="输入拼音首字母搜索" @input="searchFn"/>
  6. </view>
  7. </view>
  8. <block v-if="!$util.isEmpty(list.data)">
  9. <block v-for="(item, index) in list.data" :key="index">
  10. <tui-list-cell :arrow="false" @click="selectCurrent(item)">
  11. <view class="tui-msg-box">
  12. <img :src="item.cover" class="tui-msg-pic" mode="widthFix"/>
  13. <view class="tui-msg-item" style="position:relative;">
  14. <view class="tui-msg-name">
  15. <view class="tui-user-name">
  16. {{ item.name }}
  17. </view>
  18. </view>
  19. <view class="tui-msg-content">
  20. <text>
  21. <block v-if="item.ratioType == 0">
  22. {{item.ratio}}{{item.smallUnit}}/{{item.bigUnit}}
  23. </block>
  24. <block v-else>
  25. 若干{{item.smallUnit}}/{{item.bigUnit}}
  26. </block>
  27. </text>
  28. <text class="balance-amount">
  29. <text>
  30. <text style="color:#333333;font-weight:normal;">¥{{ item.hjPrice?parseFloat(item.hjPrice):0 }}</text>
  31. <text style="margin-left:11upx;color:red;font-weight:bold;">¥{{ item.price?parseFloat(item.price):0 }}</text>
  32. <text style="margin-left:11upx;color:#333333;font-weight:normal;">¥{{ item.skPrice?parseFloat(item.skPrice):0 }}</text>
  33. </text>
  34. </text>
  35. <text style="margin-left:30upx;color:#9397a4;">剩 {{ item.stock?parseFloat(item.stock):0 }}</text>
  36. </view>
  37. </view>
  38. </view>
  39. </tui-list-cell>
  40. </block>
  41. </block>
  42. <block v-else>
  43. <app-wrapper-empty :is-empty="$util.isEmpty(list.data)" />
  44. </block>
  45. </view>
  46. </template>
  47. <script>
  48. import TuiListCell from "@/components/plugin/list-cell";
  49. import BadgeModule from "@/components/plugin/badge";
  50. import AppWrapperEmpty from "@/components/app-wrapper-empty";
  51. import appVipModule from "@/components/module/app-vip";
  52. import AppTag from "@/components/module/app-tag.vue";
  53. import AppSearchModule from "@/components/module/app-search";
  54. import { list } from "@/mixins";
  55. import { mapGetters } from "vuex";
  56. import { getItemList } from '@/api/item';
  57. export default {
  58. name: "selectItem",
  59. components: {
  60. TuiListCell,
  61. BadgeModule,
  62. AppWrapperEmpty,
  63. appVipModule,
  64. AppTag,
  65. AppSearchModule,
  66. couldScan:false
  67. },
  68. mixins: [list],
  69. data() {
  70. return {
  71. tabIndex: 0,
  72. selectStyle:1,
  73. searchText:''
  74. };
  75. },
  76. computed:{
  77. ...mapGetters(["getMyShopInfo"]),
  78. },
  79. onPullDownRefresh() {
  80. this.resetList();
  81. this.getMyList().then((res) => {
  82. uni.stopPullDownRefresh();
  83. });
  84. },
  85. onReachBottom() {
  86. if (!this.list.finished) {
  87. this.getMyList().then((res) => {
  88. uni.stopPullDownRefresh();
  89. });
  90. } else {
  91. uni.stopPullDownRefresh();
  92. }
  93. },
  94. onLoad() {
  95. },
  96. onShow(){
  97. },
  98. methods: {
  99. selectCurrent(item){
  100. let style = this.option.style ? this.option.style : 1
  101. this.selectStyle = style
  102. if(style == 1){
  103. //花材开单
  104. //this.$util.pageTo({url: '/admin/billing/index2?customId='+item.id+'&customName='+item.name,type:2})
  105. }else if(style == 2){
  106. //用于选择客户并且需要返回的情况
  107. let pages = getCurrentPages();
  108. let prevPage = pages[ pages.length - 2 ];
  109. if(this.option.losingItem){
  110. prevPage.$vm.losingItem = item.id
  111. prevPage.$vm.losingItemName = item.name
  112. }
  113. if(this.option.zjGatheringItem){
  114. prevPage.$vm.zjGatheringItem = item.id
  115. prevPage.$vm.zjGatheringItemName = item.name
  116. }
  117. prevPage.$vm.selectItemOk=1
  118. uni.navigateBack({})
  119. }else if(style == 3){
  120. //修改拆散库存到的花材
  121. let pages = getCurrentPages();
  122. let prevPage = pages[ pages.length - 2 ];
  123. prevPage.$vm.partAcceptItemModify = 1
  124. prevPage.$vm.partAcceptItem = item.id
  125. prevPage.$vm.partAcceptItemName = item.name
  126. uni.navigateBack({})
  127. }else{
  128. //无操作
  129. }
  130. },
  131. init() {
  132. this.getMyList()
  133. },
  134. searchFn() {
  135. this.resetList()
  136. this.getMyList()
  137. },
  138. getMyList() {
  139. let params = {classId:0,requestType:'itemList',page:this.list.page,search:this.searchText,customId:0,globalCgMyCharge:0,lookStock:0}
  140. getItemList(params).then((res) => {
  141. this.completes(res)
  142. if (this.$util.isEmpty(res.data)){
  143. return false
  144. }
  145. })
  146. }
  147. }
  148. };
  149. </script>
  150. <style lang="scss" scoped>
  151. .app-content {
  152. padding-top: 100upx;
  153. padding-bottom: 20upx;
  154. }
  155. .tabs-wrap {
  156. position: fixed;
  157. .tabs-left {
  158. width: 80%;
  159. }
  160. .tabs-right {
  161. width: 19%;
  162. border-left: $borderColor;
  163. @include disFlex(center, center);
  164. }
  165. }
  166. .input-wrap_box {
  167. background-color: #fff;
  168. position: fixed;
  169. top: 0;
  170. z-index: 10;
  171. /* 手机mobile屏幕小于1000px */
  172. @media screen and (max-width: 1100px) {
  173. width: 100%;
  174. }
  175. /* 收银台cashier屏幕大于1000px */
  176. @media screen and (min-width:1100px) {
  177. width: 40%;
  178. }
  179. height: 100upx;
  180. display: flex;
  181. align-items: center;
  182. padding: 0 30upx;
  183. & > view:nth-child(1) {
  184. flex: 1;
  185. }
  186. }
  187. .tui-msg-box {
  188. display: flex;
  189. align-items: center;
  190. .tui-msg-pic {
  191. width: 80upx;
  192. height: 80upx;
  193. border-radius:18upx;
  194. margin-right: 20upx;
  195. }
  196. .tui-msg-item {
  197. max-width: 500upx;
  198. min-height: 80upx;
  199. overflow: hidden;
  200. display: flex;
  201. flex-direction: column;
  202. justify-content: space-between;
  203. & > div {
  204. @include disFlex(center, flex-start);
  205. & > div:first-child {
  206. margin-right: 8upx;
  207. }
  208. }
  209. .level-img {
  210. ::v-deep.vip-text {
  211. left: 70upx;
  212. top: 8upx;
  213. }
  214. }
  215. .normal-img {
  216. width: 70upx;
  217. padding: 2upx 6upx;
  218. color: #999;
  219. background-color: #f0f2f6;
  220. border-radius: 20upx;
  221. .vip-text {
  222. font-size: 24upx;
  223. transform: scale(0.6);
  224. position: relative;
  225. top: -2upx;
  226. left: -8upx;
  227. }
  228. }
  229. .member-img {
  230. width: 70upx;
  231. padding: 2upx 6upx;
  232. color: green;
  233. background-color: #f0f2f6;
  234. border-radius: 20upx;
  235. .vip-text {
  236. font-size: 24upx;
  237. transform: scale(0.6);
  238. position: relative;
  239. top: -2upx;
  240. left: -8upx;
  241. }
  242. }
  243. .iconfont {
  244. color: #00aaed;
  245. }
  246. }
  247. .tui-msg-name {
  248. overflow: hidden;
  249. white-space: nowrap;
  250. text-overflow: ellipsis;
  251. font-size: 30upx;
  252. line-height: 1;
  253. color: #262b3a;
  254. margin-bottom: 4upx;
  255. .tui-user-name {
  256. overflow: hidden;
  257. text-overflow: ellipsis;
  258. white-space: nowrap;
  259. width: 450upx;
  260. font-size: 34upx;
  261. .super-man{
  262. margin-left:30upx;
  263. color:red;
  264. font-size:24upx;
  265. display:inline-block;
  266. color:white;
  267. border:1upx solid green;
  268. padding:6upx 10upx;
  269. background-color: green;
  270. border-radius: 11upx;
  271. }
  272. .ls-man{
  273. margin-left:30upx;
  274. font-size:24upx;
  275. display:inline-block;
  276. color:white;
  277. border:1upx solid #a5b1a5;
  278. padding:6upx 10upx;
  279. background-color: #a5b1a5;
  280. border-radius: 11upx;
  281. }
  282. }
  283. }
  284. .tui-msg-content {
  285. width:500upx;
  286. overflow: hidden;
  287. white-space: nowrap;
  288. text-overflow: ellipsis;
  289. font-size: 24upx;
  290. color: #9397a4;
  291. .balance-amount{
  292. margin-left:30upx;
  293. }
  294. }
  295. }
  296. .tui-msg-right {
  297. max-width: 120upx;
  298. height: 80upx;
  299. margin-left: auto;
  300. margin-right: 24upx;
  301. text-align: right;
  302. display: flex;
  303. justify-content: space-between;
  304. align-items: center;
  305. }
  306. .user_tag {
  307. border: 1upx solid #cccccc;
  308. padding: 5upx 12upx 5upx 12upx;
  309. border-radius: 25upx;
  310. color: #bbbbbb;
  311. margin-right: 10upx;
  312. margin-bottom: 12upx;
  313. display: inline-block;
  314. font-size: 30upx;
  315. }
  316. </style>