add.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <template>
  2. <view class="app-content" style="background:white;">
  3. <view class="billing_box_bg">
  4. <view class="input-wrap">
  5. <view style="padding:0upx 0upx 0upx 0upx;margin-right:10upx;" >
  6. <button class="admin-button-com middle blue" @click="selectFlowerNumFn()">选分类</button>
  7. </view>
  8. <view class="search-bar">
  9. <app-search-module v-model="py" placeholder="输拼音首字母也可以搜" @input="searchFn"/>
  10. </view>
  11. <view style="padding:0 0upx 0 20upx;" >
  12. <button class="admin-button-com middle blue" @click="pageTo({ url: '/admin/ptItem/itemList' })">添花材</button>
  13. </view>
  14. <view style="padding:0 0upx 0 20upx;" >
  15. <button class="admin-button-com middle blue" @click="removeFromSave(option.ghsId)">清除采购</button>
  16. </view>
  17. </view>
  18. <view class="scroll-middle_bx">
  19. <scroll-view scroll-y scroll-with-animation class="tab-view">
  20. <div v-for="(item, index) in globalClassItemList" :key="index" class="tab-bar-item" :class="[classIndex == index ? 'active' : '']" :data-current="index" @tap.stop="swichClass(index)">
  21. <text>{{ item.className || "" }}</text>
  22. </div>
  23. </scroll-view>
  24. <scroll-view scroll-y class="right-box" :scroll-into-view="scroll_into_view" scroll-with-animation="true" @scroll="scroll_detail" lower-threshold="100" @scrolltolower="scroll_bottom">
  25. <block v-if="!$util.isEmpty(globalClassItemList)">
  26. <view class="item_list_bx selectAll" v-for="(classItem, classIndex) in globalClassItemList" :key="classIndex" :id="`class_${classIndex}`">
  27. <view class="item_list_title">
  28. {{ classItem.className }}
  29. </view>
  30. <template v-for="(productItem, productIndex) in classItem.child">
  31. <view style="height: 180upx" :id="`class_${classItem.classId}_${productItem.id}`" :key="productIndex">
  32. <CommodityPurchase v-if="classItem.isActive"
  33. :type="selectJobType"
  34. :key="productIndex"
  35. :info="productItem"
  36. @showAddModelFn="showAddModelFn"
  37. @replaceItemFn="replaceItemFn"
  38. ></CommodityPurchase>
  39. </view>
  40. </template>
  41. </view>
  42. </block>
  43. <block v-else> <app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(globalClassItemList)" /> </block>
  44. </scroll-view>
  45. </view>
  46. <modal-module :show="isAddModel" @cancel="addItemModelHidden" @click="confirmAddItemModel" :title="customData.itemName" color="#333" :size="32" padding="30rpx 30rpx" :button="showButton" >
  47. <template slot="customContent">
  48. <view class="select-view">
  49. <view class="select-cmd_bx">
  50. <view class="num_bx">
  51. <!-- #ifdef APP-PLUS -->
  52. <input v-model="customData.bigCount" type="number" @focus="customData.bigCount = null" placeholder="扎数" />
  53. <!-- #endif -->
  54. <!-- #ifdef MP-WEIXIN -->
  55. <input v-model="customData.bigCount" type="number" @focus="customData.bigCount = null" :focus="isAddInputFocus" placeholder="扎数" />
  56. <!-- #endif -->
  57. <input v-model="customData.userPrice" @focus="customData.userPrice = null" type="digit" placeholder="单价" />
  58. <text>¥{{customData.userPrice && customData.bigCount ? parseFloat((customData.userPrice*customData.bigCount).toFixed(2)):0}}</text>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. </modal-module>
  64. <FooterCart :price="cgAllPriceFun" :count="allCount" @confirm="confirmSaveItem"></FooterCart>
  65. <uni-popup ref="selectFlowerNumRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
  66. <view style="display:flex;padding:20upx;height:auto;justify-content: space-between;align-items:center;flex-wrap:wrap;max-height:100vh;overflow:auto;">
  67. <view v-for="(item, index) in globalClassItemList" :key="index" @tap.stop="changeClass(index)" style="margin-bottom:20upx;margin-left:3upx;">
  68. <image :src="item.classCover" style="width:120upx;height:120upx;border-radius:10upx;"></image>
  69. <view style="margin-top:5upx;overflow: hidden;white-space: nowrap;width:120upx;text-align:center;">{{item.className}}</view>
  70. </view>
  71. </view>
  72. </uni-popup>
  73. <image v-if="showClassRemind" @click="hideClassRemind" style="position:absolute;width:610upx;height:699upx;top:225upx;left:80upx;z-index:9999;" :src="`${constant.imgUrl}/class_remind.png`"></image>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. import AppSearchModule from "@/components/module/app-search";
  79. import AppTabs from "@/components/plugin/tabs";
  80. import AppWrapperEmpty from "@/components/app-wrapper-empty";
  81. import CommodityPurchase from "./components/CommodityPurchase";
  82. import ModalModule from "@/components/plugin/modal";
  83. import FooterCart from "@/components/module/app-footer-cart";
  84. import productMins from "@/mixins/product";
  85. import { mapGetters } from "vuex";
  86. export default {
  87. name: "purchase",
  88. components: {
  89. AppTabs,
  90. AppSearchModule,
  91. AppWrapperEmpty,
  92. CommodityPurchase,
  93. ModalModule,
  94. FooterCart
  95. },
  96. mixins: [productMins],
  97. data() {
  98. return {
  99. selectJobType: "purchase",
  100. isAloneAllActive: false,
  101. isAloneAllFocus: false,
  102. isWeightActive: false,
  103. isWeightFocus: false,
  104. showSubmitModel: false,
  105. autoLoad: false,//不自动请求花材数据
  106. showButton:[{text: '取消',plain: true}, {text: '确定',plain: false}],
  107. checkStock:false,//不需要验证库存
  108. showClassRemind:false
  109. };
  110. },
  111. computed:{
  112. ...mapGetters(["getMyShopInfo","getLoginInfo"]),
  113. cgAllPriceFun(){
  114. let price = 0;
  115. if (this.selectList) {
  116. for (const item of this.selectList) {
  117. price += Number(item.userPrice)*Number(item.bigCount)
  118. }
  119. }
  120. return Math.round(price * 100) / 100;
  121. },
  122. },
  123. onShow(){
  124. this.cgItemInit()
  125. },
  126. onUnload() {
  127. },
  128. onLoad() {
  129. if(!this.$util.isEmpty(this.option.ghsId)){
  130. this.selectJobId = this.option.ghsId
  131. }
  132. },
  133. methods: {
  134. changeClass(index){
  135. this.$refs.selectFlowerNumRef.close()
  136. this.swichClass(index)
  137. },
  138. selectFlowerNumFn(){
  139. this.$refs.selectFlowerNumRef.open('top')
  140. },
  141. hideClassRemind(){
  142. },
  143. cgItemInit(){
  144. this.shopId = this.getMyShopInfo.id;
  145. let type = '';
  146. this.initData({ type, shopId: this.shopId,status:0});
  147. },
  148. confirmSaveItem() {
  149. if (this.$util.isEmpty(this.selectList)) {
  150. this.$msg('请选择花材')
  151. return false
  152. }
  153. this.$util.pageTo({url:'/pagesPurchase/details?ghsId='+this.option.ghsId+'&ghsName='+this.option.ghsName,type:2})
  154. }
  155. }
  156. };
  157. </script>
  158. <style>
  159. .change-input{
  160. width: 170upx !important;
  161. }
  162. </style>
  163. <style lang="scss" scoped>
  164. .billing_box_bg {
  165. height: 100%;
  166. display: flex;
  167. background:white;
  168. flex-direction: column;
  169. .input-wrap {
  170. display: flex;
  171. padding: 22upx 20upx 22upx 13upx;
  172. .search-bar {
  173. flex: 1;
  174. }
  175. }
  176. .scroll-middle_bx {
  177. flex: 1;
  178. width: 100%;
  179. height: 100%;
  180. display: flex;
  181. overflow: hidden;
  182. }
  183. .tab-view {
  184. height: calc(100vh - 140upx);
  185. width: 170upx;
  186. flex-shrink: 0;
  187. background-color: #f0f2f6;
  188. .tab-bar-item {
  189. position: relative;
  190. width: 170upx;
  191. height: 90upx;
  192. box-sizing: border-box;
  193. display: flex;
  194. align-items: center;
  195. justify-content: center;
  196. font-size: 26upx;
  197. color: #444;
  198. font-weight: 400;
  199. .tag {
  200. display: flex;
  201. padding: 0 20upx;
  202. align-items: center;
  203. position: absolute;
  204. right: 0;
  205. top: 0;
  206. height: 32upx;
  207. background: #ff2842;
  208. border-radius: 16upx;
  209. color: #fff;
  210. font-size: 20upx;
  211. }
  212. &:last-child{
  213. margin-bottom: 110upx;
  214. }
  215. }
  216. .active {
  217. position: relative;
  218. color: $mainColor;
  219. font-size: 26upx;
  220. background: #fff;
  221. }
  222. .active::before {
  223. content: "";
  224. position: absolute;
  225. border-left: 8upx solid $mainColor;
  226. height: 100%;
  227. left: 0;
  228. }
  229. }
  230. .right-box {
  231. height: calc(100vh - 140upx);
  232. flex: 1;
  233. box-sizing: border-box;
  234. }
  235. .item_list_bx {
  236. padding: 40upx 16upx;
  237. &:last-child{
  238. margin-bottom: 70upx;
  239. }
  240. }
  241. .item_list_title {
  242. margin-bottom: 20upx;
  243. font-size: 24upx;
  244. font-weight: 600;
  245. color: #666666;
  246. }
  247. .select-view {
  248. margin-bottom: 30upx;
  249. }
  250. .select-cmd_bx {
  251. margin-top: 30upx;
  252. & .num_bx {
  253. display: flex;
  254. align-items: center;
  255. .kc {
  256. width: 80upx;
  257. font-size:32upx;
  258. }
  259. & > text{
  260. width:100upx;
  261. font-size:30upx;
  262. }
  263. & > input {
  264. flex: 1;
  265. height: 80upx;
  266. border: 1upx solid #dddddd;
  267. border-radius: 4upx;
  268. text-align: center;
  269. margin-right: 24upx;
  270. font-size: 32upx;
  271. }
  272. }
  273. }
  274. }
  275. .class-popup-style{
  276. z-index:999999;
  277. }
  278. </style>